Last active
August 22, 2017 16:44
-
-
Save mnemocron/71ed3b3034b3a1bfeabbe208cf74f04d to your computer and use it in GitHub Desktop.
Tutorial to set up and calibrate a Hobbyking brushless motor control with an Arduino.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author: Simon Burkhardt - github.com/mnemocron | |
* @date: 2017-07-02 | |
* | |
* Calibrate HobbyKing ESC (tutorial) | |
* tested with: | |
* ESC: HK-SENS-35A https://hobbyking.com/en_us/hobbykingr-tm-35a-sensored-sensorless-car-esc-1-10-1-12.html | |
* Motor: Quanum MT 1806-1600KV https://hobbyking.com/en_us/quanum-mt-series-1806-2300kv-brushless-multirotor-motor-built-by-dys.html | |
* Arduino Uno | |
* 11V / 3A bench power supply | |
* | |
* Connect the brushless motor according to the manual. | |
* Connect the ESC-RX pins like this: | |
* BLACK - GND of Arduino | |
* RED - DO NOT CONNECT ! this is a 6V source and could destroy the 5V parts of the Arduino or the computer's USB port! | |
* WHITE - ESC pin of the Arduino (9) | |
* Connect a sufficient power source to the ESC's thick wires (red/black). | |
* For example a 11.1V Li-Po battery. Though be careful with using a battery on a breadboard setup. | |
* Short circuits are dangerous because a large Li-Po battery can discharge with way over 100 Amps and catch fire. | |
* Use a bench power supply instead. | |
* | |
* Calibration: | |
* Upload this code to the Arduino. | |
* ESC power switch is OFF. | |
* Turn on the power supply. | |
* | |
* 1. Send the value "1000" via the terminal. | |
* 2. Keep pressing the "set" button of the ESC as you switch the power switch to "ON". | |
* 3. Wait ~4s till the orange LED stays solid, then release the "set" button. | |
* 4. Send the value "2000" via the terminal, the red LED will blink and the motor will beep. | |
* 5. Send the value "1500" via the terminal, the orange LED will blink then stay solid and the motor will beep. | |
* 6. Turn OFF the ESC. | |
* 7. Turn the ESC back on, you are ready to go. | |
* | |
* Your speed range is now within: 1000 (full reverse) - 1500 (stop) - 2000 (full forward) | |
* | |
*/ | |
#include <Servo.h> | |
int value = 0; | |
Servo ESC; | |
void setup() { | |
ESC.attach(9); | |
Serial.begin(9600); | |
} | |
void loop() { | |
ESC.writeMicroseconds(value); | |
if(Serial.available()) { | |
value = Serial.parseInt(); // Parse an Integer from Serial | |
Serial.println(value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment