Set Speed Control of Brushless DC Motor using Servo Library

Hello,

I am relatively new in using Arduino. I am trying to run a Brushless DC Motor using the Servo library. I have the correct power supply, ESC, and correctly connected to the arduino pin 9. I got it to work using many different sketches I have found, however I am trying to set it to a certain speed and have it spin constantly at that speed while turned on. Eventually, I will incorporate some sort of feedback for the speed. I would like to avoid using a potentiometer and be able to set the desired speed directly within the code. Seems like it should be simple, but I am having trouble.

I am now using the following code:

#include <Servo.h> 

Servo myservo;

void setup() 
{ 
  myservo.attach(9);
  myservo.write(60);  //Sets speed of motor (60 (low) - 180 (high) i think)
} 

void loop() {}

Through trial and error, any lower than 60 the motor will stop running, however, it is still relatively fast. Is this a limitation from my ESC or from my motor? I would like to understand the process of what is going on better so I can have more precise control over the speed. Any input would be greatly appreciated!

Thanks
Nick

In my experience, whether driving the ESC directly from a R/C receiver, or Uno, the minimum speed can be quite fast. Without a load. If there is friction from your finger or a large propeller it will be much slower. This may be a limitation of some ESC's, but not others.

rader945:
Through trial and error, any lower than 60 the motor will stop running, however, it is still relatively fast. Is this a limitation from my ESC or from my motor? I would like to understand the process of what is going on better so I can have more precise control over the speed. Any input would be greatly appreciated!

Thanks
Nick

The problem is the ESC is using back-EMF to commutate and the slower the motor spins the less
back-EMF there is to provide commutation signal - its also a very noisy environment since the windings
are being PWM'd at 8kHz or something like that. ESCs are usually designed to just spin a propeller in
an RC aircraft, don't expect them to be great at doing anything else.

Also ESCs aren't normally set up to control rotation speed, they are usually just controlling the PWM
mark-space ratio going to the motor (some compensate for reduced battery voltage though).

Try this video Running ESC and Brushless Motor using Arduino, might help good luck :slight_smile:

xxxxhttp://www.youtube.com/watch?v=Hwv040lBAz4 (just remove xxx to copy)

or Search "Arduino Running an ESC and BLDC Brushless DC Motor "

The servo library may have very large increment, control it by creating a pulse from 1150us and slowly increase +1 up to 1500us - Use digital.Write(pin HIGH) AND digital.Write(pin, LOW) to create a PWM signal, same principle to blink the LED.