More and more people are starting to use what's called an "ESC" (Electronic Speed Controller) in robotic applications or DIY projects. These are low cost, readily available motor controllers that can drive brushed or brushless DC motors and most of the time are found in Radio Control (RC) applications. Given this market, they use standard RC PWM signals as input but with some "twists" to avoid any issues of safety. These differences sometimes make it difficult to use directly with the Arduino Servo library if you are unaware of some details, so this post describes a new ESC library to help you get started. An ESC has the following nuances:
We've created a simple library which can help you understand and use an ESC with an Arduino based platform. This library is largely based on the Arduino Servo library and even use it in the background but we created different commands as well as examples which make sense for ESCs. The library is open source and although each function is not described in detail here, the library itself and the examples are well commented.
You can now declare an object for your ESC with all the details needed to control it. This makes the process easier even more if you have many ESC's to control. For example: Assigns the pin connected to the ESC, the MIN PWM value, MAX PWM VALUE and arming value.
The following functions are implemented in the library.
Initiation of the calibration process. this require you to connect the ESC power at the right moment when the LED is ON and a few seconds (5s) after.
A simple command that sends the "arming" PWM value to initiate the ESC.
Will send a 500us value to stop the ESC. This value can be changed in the library if needed.
The most useful function which updates the corresponding ESC speed.
There is a good tutorial on how to install an Arduino library: Arduino - Importing a .zip Library The RC_ESC library is available on GitHub and you can use the following link to download the .zip. GitHub - RC_ESC Library ZIP
A few examples are provided which use the standard commands, and include:
This example was created to perform the ESC calibration and this is usually done only once, so will probably never be used in a full project. The example will provide the standard steps to calibrate an ESC which is to send a High value at power up and after a delay goes down to the Low value. Those values will then be saved in the ESC and used for the range of speed.
Example of a full initialisation and start of the motor at a given speed then implements the stop function.
Largely based on the "Knob" example in the Servo Library, but using the RC_ESC's Library to control the ESC.
Largely based on the Servo Library 's"Sweep" example which will in that case ramp up and down the speed on the given range. Reference Links: Arduino Servo Library Material Shown: Lynxmotion BotBoarduino Shield-Compatible Robot Controller Octopus Rotary Potentiometer Brick Lynxmotion 12A Multirotor ESC 1A BEC (With Connectors) Brushless Rotor Motor 1000Kv 15A 11.1V, 2500mAh, 30C LiPo Battery