2

I can't make my brushless motor move; it kepps on beeping. I have connected it to an electronic speed control (ESC) and am trying to signal the ESC from the GPIO pins of Raspberry pi B+. How do I initialize my ESC with the correct PWM signals with the Python code.

  • 1
    Hello and welcome. Out of curiosity what's an ESC? Not so common abbreviations or acronyms should really be introduced. – Ghanima Apr 12 '15 at 19:33
  • ESC stands for Electronic Speed Controller for handling brsuhless motors – Abhinav Pawar Apr 14 '15 at 11:20
2

I suggest you have a look at the answer I gave to Controlling a brushed motor ESC from the Raspberry Pi

If that works it will be trivial to use Python instead.


Example pigpio Python code

#!/usr/bin/env python

# esc_start.py
# 2015-04-14
# Public Domain
#
# Sends the servo pulses needed to initialise some ESCs
#
# Requires the pigpio daemon to be running
#
# sudo pigpiod

import time

import pigpio

SERVO = 4

pi = pigpio.pi() # Connect to local Pi.

pi.set_servo_pulsewidth(SERVO, 1000) # Minimum throttle.

time.sleep(1)

pi.set_servo_pulsewidth(SERVO, 2000) # Maximum throttle.

time.sleep(1)

pi.set_servo_pulsewidth(SERVO, 1100) # Slightly open throttle.

time.sleep(1)

pi.set_servo_pulsewidth(SERVO, 0) # Stop servo pulses.

pi.stop() # Disconnect from local Raspberry Pi.

RPIO.GPIO (note: not RPi.GPIO) and pigpio both send DMA timed pulses from within Python. You can also use the servoblaster module, but you need to control it via its file interface.

Other modules will use software-timed PWM which will not be as reliable (timing jitter).

| improve this answer | |
  • it worked by installing pigpio library and by initializing my ESC with low pwm signal ,then waiting for it to be armed and then starting the motor via pwm pulses – Abhinav Pawar Apr 14 '15 at 10:49
  • I've added a pigpio Python example. You should be able to do the same using RPIO.GPIO and servoblaster. Other modules will use software timed PWM which isn't as reliable. – joan Apr 14 '15 at 11:18
  • with ur code i was able to run my motors ,hearty thanx for that.But I am facing a new problem that one of my motor (after arming ) start at 1100 and the other one starts at 1300(pulse width).Whats is that?any ideas – Abhinav Pawar Apr 14 '15 at 13:10
  • @AbhinavPawar I only use hobby servos, I have not used an ESC. With the servos you'll find that each one may accept different pulse widths. One model might accept 500-2500, another model just 1000-2000. Within models there will be small variations as well. It sounds like you will have to individually calibrate your ESCs. – joan Apr 14 '15 at 13:38
  • i have heard that the ESC should be provided with 1000 to 2000 pulse width.But how to callibrate ESC s .All ESC and Motors are of same make and model – Abhinav Pawar Apr 14 '15 at 13:46

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