1

A friend and I are trying to build a raspberry pi-powered quadrocopter. We've ordered four ESCs, four motors, and the Pi, but we're having trouble getting a motor to actually move. The motor makes a three-tone beep when the power is connected to the ESC, and then beeps every few seconds thereafter.
My question is: what should the code look like in order to drive current to the motors? At the moment I'm using Python and the RPi.GPIO library, but C, or another language would be fine as well. As I understand it, software PWM will be needed to drive all four motors.

The ESCs are Maytech Multicopter 25A BEC
The motors are Maytech Outrunner Brushless

Thanks,
Jack

1

Servos/ESCs need precisely timed pulses in the range 1ms to 2ms. If the pulses are not precise you have a condition called jitter where servos will twitch and ESCs will speed up/down at random.

I suggest you use a module which provides hardware timed pulses such as servoblaster, RPIO.GPIO (note NOT RPi.GPIO) or my own pigpio which is a C library but has a Python wrapper.

Try giving the ESCs a 2ms pulse for a couple of seconds, then a 1ms pulse for a couple of seconds. Then it should accept pulses in the range 1 to 2 ms to control the speed.

For pigpio you can do this from the command line

sudo pigpiod # start daemon

pigs s 4 2000 # 2000 us pulses to Broadcom gpio 4
#wait
pigs s 4 1000
#wait
pigs s 4 1500

change 4 to reflect the gpios you are using.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.