RC Speed Controller (ESC) Arduino Library

Posted on 28/04/2017 by dialfonzo in Arduino Tutorials
RC_ESC - Arduino Calib RC_ESC - Arduino RC_ESC - Arduino Ramp

  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 brusless 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:

  • Upon power up, the ESC will wait for a low PWM signal to arm itself. Without being armed, it won't respond to signals.
  • The ESC's minimum and maximum PWM values can usually be calibrated (and often needs to be for specific applications)

  RC_ESC - Main 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.

1.0 - Library Object

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.

2.0 - Library Functions

The following functions are implemented in the library.

2.1 - calib

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.

F-RC_ESC - Calib

2.2 - arm

A simple command that sends the "arming" PWM value to initiate the ESC.

RC_ESC - F-Arm

2.3 - stop

Will send a 500us value to stop the ESC. This value can be changed in the library if needed.

RC_ESC - F-Stop

2.4 - speed

The most useful function which updates the corresponding ESC speed.

RC_ESC - F-Speed

3.0 - Installation:

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

4.0 - Library Examples

A few examples are provided which use the standard commands, and include:

4.1 - ESC_Calib:

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.

4.2 - ESC_Stop

Example of a full initialisation and start of the motor at a given speed then implements the stop function.

4.3 - ESC_Knob

Largely based on the "Knob" example in the Servo Library, but using the RC_ESC's Library to control the ESC.

4.5 - ESC_Ramp

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

LikedLike this to see more

Spread the word

Flag this post

Thanks for helping to keep our community civil!


Notify staff privately
It's Spam
This post is an advertisement, or vandalism. It is not useful or relevant to the current topic.

You flagged this as spam. Undo flag.Flag Post