Control a quadcopter brushless motor with ESC and PWM

Dear All, I am writing to you because I do need your advice on driving a brushless motor with ESC and an Arduino Uno. I am using the following motor ... https://www.hobbyking.com/hobbyking/store/uh_viewItem.asp?idProduct=66424 and the following ESC ... https://www.hobbyking.com/hobbyking/store/uh_viewItem.asp?idProduct=64209. May I use the Servo library? If positive which wires should I connect to Arduino Uno? Which PWM pin of Arduino should I use since do not all have the same frequency. The input frequency of this ESC is 1khz, so should I use pins 5 & 6 that have 1khz frequency? In order to change direction of the motor which of the three motor wires should I swap? I am looking forward to hearing from you. Best regards George

The Servo library drives any pin (its not using PWM hardware). You connect ground and signal
to the 3-pin header ground and signal pins.

If the ESC has a BEC I’d advise against using it if you can avoid it, I’ve seen ESCs fail dramatically,
you don’t want to fry your microcontroller should this happen.

Thanks Mark for your reply and your great help! Best regards George

So what I have to do is to use the Servo library and particularly the command servo.write(angle) or servo.write(speed) for continuous rotation like the brushless motors do. If I am correct then is it right to control direction/speed in the following way …

  1. Direction 1: 0 (max) <= speed1 <= 90 (stop)
  2. Direction 2: 90 (stop) <= speed2 <= 180 (max)

Best regards
George

The direction is changed by switching any two of the three motor wires.

The speed is controlled exactly the same in each case. 1ms pulse = stop, 2ms pulse = full throttle.

I use a bigger HobbyKing motor/ESC and the Adafruit 16 channel PWM/Servo breakout board. Just tested it connected to the motor for the first time yesterday. Works great! :)

Note you have to power down the ESC to swap wires, or you risk it failing.

Its not a way to dynamically change direction - indeed standard ESC’s cannot work
at low speeds under load.

What are you trying to do?

Thank you all for your replies. I am trying to implement PID control algorithm for controlling the motors of a quadcopter. So I need to be able to control the speed of the four brushless motors using Arduino and ESCs. Two motors rotate CW and the other two CCW. Thanks!

What are you using for the feedback data from the servos ESCs?

Like I said before, I use the Adafruit 16 channel servo controller to get the servo timing processing off the Arduino so I can use the Arduino’s processor time for other measurements and calculations. For $15 it is hard to beat. The only downside (if you want to call it that) is the servo has only 250 positions from minimum to maximum. I’m not sure what accuracy limits the ESCs have, but it won’t be too much greater than that.

chr9: Thank you all for your replies. I am trying to implement PID control algorithm for controlling the motors of a quadcopter. So I need to be able to control the speed of the four brushless motors using Arduino and ESCs. Two motors rotate CW and the other two CCW. Thanks!

Normally the ESC firmware aren't ideal for this (they are normally optimized for RC planes under human control), but my understanding is many ESCs can be reprogrammed with better firmware for PID loop control (faster response, 2-quadrant control). A lot of ESCs use ATmega microcontrollers.

Specialist multi-rotor forums are the place for the latest and most details information.

Thank you all for your great help! Best wishes George