RC Speed Controller (ESC) Arduino Library | RobotShop Community

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.


This is a companion discussion topic for the original entry at https://community.robotshop.com/blog/show/rc-speed-controller-esc-arduino-library
1 Like

Hello,
i think im blind, but where can i download the libary?
regards

@MIchi, Don’t worry, the library link can be found under “3.0 - Installation” on the blog post. (GitHub – RC_ESC Library ZIP) Or the complete GitHub HERE.

hi- how can i use more than one esc and calibrate them

@mahran, You can create multiple “ESC” with their respective pins.

Hi,
i have a problem when install library:
The library “RC_ESC-master” cannot be use.
Library names must contain only basic letters and numbers.
When I change the name (manual install) and try to run an example (Knob) it throws the error:

ESC_Knob.ino:13:17: error: ESC.h: No such file or directory
ESC_Knob:17: error: ‘ESC’ does not name a type
ESC_Knob.ino: In function ‘void setup()’:
ESC_Knob:23: error: ‘myESC’ was not declared in this scope
ESC_Knob.ino: In function ‘void loop()’:
ESC_Knob:31: error: ‘myESC’ was not declared in this scope

IDE Arduino 1.0.5-r2
board olimexino-32U4

@Manuel Toto: Please note that the Arduino IDE version you are using, 1.0.5-r2, is quite old. It is actually over 3 years old (release date is 2014-01-08). Please download and install the newest version of the IDE. You can get a copy from here. At the time of this message, the newest version is 1.8.4. In this version, the installation of the library works as is. Once you have the new IDE installed, simply get a copy of the master ZIP here and follow the steps outlined here.

@scharette : Thanks, it is solved! …Everything works fine, but except that the output PWM frequency is 50 HZ (it should be 500 HZ) … this would be library or board problem?

@Manuel Toro: The RC control signal has to be 50 Hz and not any other number. This is the standard used by RC servomotors, ESCs, etc. You can read more about it here and here. Please note that the position is expressed by the length of the pulse. This pulse is usually between 1000 to 2000 µs or 1.0 to 2.0 ms, with 1500 µs or 1.5 ms being the center. Most servomotors actually support signals between 500 to 2500 µs or 0.5 to 2.5 ms. Actually, if the control signal was at 500 Hz (instead of 50 Hz), it would mean it would repeat every 2 ms, which would not work since pulses can be longer than that.

Hello, i want to use the library for an RC Car i’ve made, is there any way to use reverse with this library?

@Redin, The library itself do not handle reverse at the moment but you could use it anyway. When you declare your object you can set the arming value to whatever your ESC does arm EX: “ESC myESC (9, 1000, 2000, 1500);” where the 1500 value is your arming.

Hello, can I use this to control a normal dc motor, without havin to die an ESC
Okay let me brief you about my project, and supposed to build a system that has a dc motor with soft start and soft stop(starts gradually, stops gradually) by increasing the speed at intervals…

@dapo, This library is mostly a modifications or added layer of the “Servo” library which allow you to send a PWM signal to a R/C servo. In theory you could use a R/C brushed DC motor controller with this library but it’s usually easier to go straight to a motor controller instead.

Hi. I’m trying to control my RC car with arduino, and wanna use this code to test that I can control esc of my RC car.
I installed ur esc lib and made a simple code but it doesn’t work
#include

ESC m1(9, 1000, 2000, 1500);

void setup() {
m1.speed(1600); // put your setup code here, to run once:

}

void loop() {
// put your main code here, to run repeatedly:

}
can you help me?
Thanks

@Kimppa, What’s exactly not working and what do you think your code should do ? Looking at your code you might not have the right values for your ESC controller. Most Car ESC will not arm at 1500 but slightly bellow, make sure you set it to the right value.
Note: It would be easier to follow if you post on the RobotShop Forum.

Hi, I purchased a Lynxmotion brushless motor 930Kv 28.9A and an Energy Sport 50A BEC ESC from Robotshop. My power source is a 12V SLA battery (35AH) and I am trying to learn how to calibrate, arm and run the motor using an Arduino Mega 2560 and the example sketches in the RC_ESC library. I am trying to follow the directions given in the sketches, but it appears the ESC keeps defaulting to the program mode. Its as if it is ignoring any of the signals from the Mega. I have not changed any of the values in the sketches as I do not know what the Min, Max, Arm values might be. I am a newbie at this and any suggestions would be most appreciated. Thanks.

@Kevin - It would be easier to troubleshoot if you can post a new topic over the RobotShop Forum. Please add pictures in attachement as well as your code.

Hello, have just arrived at this website as I am attempting to build simple r/c units based on arduino and the nrf24l02 2.4 GHz units. I was having problems sending appropriate code for ESC to function and this has solved that problem very well. I have only used the library ESC for testing so far, calibration etc but it is working ver well indeed… I can now see how to send rudder servo signals using “servo” library and ESC signals using “ESC” library. First tests are excellent, I can get proportional forward and reverse speed from a brushed motor connected to an Mtronics ESC using a simple 10k pot. My intention is to replace the innards of old 27 and 40 MHz r/c sets with Arduino NANO units and transceivers and utilise the 2.4GHz band. The goal is to have 12 units function at the same time for our small persons r/c boating fleet. Thank you so much for enabling the code to be freely available. I will keep you up to speed with developments. Kim. [Mr] PS I will register with you shortly, still demonstrating this code set-up to colleagues.

@Kim - Thanks a lot for the kind words. Don’t hesitate to create a RobotShop Forum Post as well to show the community what you are doing.

Very very very thanks