Souvik Bagchi
Posts: 17
Joined: Tue May 13, 2014 10:04 am

Brushless Motor run via Rpi

Tue Aug 19, 2014 5:50 pm

I'm trying to run a brushless 750kv motor via the Rpi and I seem not to be able to do it.
I made connections as follows -
ESC - signal --> RPi gpio where i send the PWM
Positive --> left disconnected
Negative --> ground

and then i connected the esc to the motor

code -
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(12,GPIO.OUT)
p=GPIO.PWM(12,50)
p.start(50)

please help. I'm at a loss what to do next.
any suggestion regarding the aforementioned will be helpful (Code or Other wise)

PS- i connected a led to the pwm port of the raspi and it blinks while when i connect the esc to the esc output it doesn't

PPS - the positive wire of the ESC is left disconnected on purpose. I followed the instructions on how to connect from this blog -->http://techvalleyprojects.blogspot.in/2 ... orial.html
and this one - https://solenerotech1.wordpress.com/201 ... pberry-pi/

User avatar
joan
Posts: 14473
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Brushless Motor run via Rpi

Tue Aug 19, 2014 6:08 pm

You have not followed the tutorial.

The tutorial uses the RPIO Python module.

You appear to be using the RPi Python module.

Souvik Bagchi
Posts: 17
Joined: Tue May 13, 2014 10:04 am

Re: Brushless Motor run via Rpi

Wed Aug 20, 2014 7:57 am

joan wrote:You have not followed the tutorial.

The tutorial uses the RPIO Python module.

You appear to be using the RPi Python module.

Yes but i just used the connections that were made in that tutorial. I wrote the code on my own. So is that the reason why it isn't working ?
Should I change the connections ? Or should i follow the tutorial completely.
I figured if i made the connections right then it should give an output with the code I have written.

User avatar
joan
Posts: 14473
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Brushless Motor run via Rpi

Wed Aug 20, 2014 8:06 am

There could be all sorts of reasons it is not working.

Using the wrong software could be one. If you have connected the hardware as per the tutorial why not use the software as per the tutorial? If that works then you can develop your own software with confidence that the hardware is not the problem.

Souvik Bagchi
Posts: 17
Joined: Tue May 13, 2014 10:04 am

Re: Brushless Motor run via Rpi

Wed Aug 20, 2014 8:23 am

It worked :)
Thanks Joan.

User avatar
A1i2T3R
Posts: 99
Joined: Sat Apr 13, 2013 1:08 pm
Location: England - Kent

Re: Brushless Motor run via Rpi

Wed Aug 20, 2014 12:10 pm

personally i dont think it is possible to learn much from a tutorial kit. I think it is best to experiment
Enthusiastic pi user, with a hoby for modding everyday objects and using the pi as the brain!

RaspISteve
Posts: 98
Joined: Wed Oct 24, 2012 9:15 pm
Location: Cheltenham, UK

Re: Brushless Motor run via Rpi

Wed Aug 20, 2014 9:17 pm

S,
Just a thought but you say when you connect a LED it blinks. If you are using one of the many brushless controllers aimed at the model car/boat/plane world it'll be expecting a very particular signal. As I recall the pulse stream needed has a rate around 50Hz and a pulse of 1.5mSec as neutral with +/- 0.5mSec to go forward/reverse. At this duty cycle you are unlikely to see a LED blinking because of our eye's response time and it'll be very dim given the 1/20th duty cycle.

You might get a better idea of what is happening using a crystal ear piece and just listening to what's happening.
Share and Enjoy.

User avatar
joan
Posts: 14473
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Brushless Motor run via Rpi

Wed Aug 20, 2014 9:32 pm

RaspISteve wrote:S,
Just a thought but you say when you connect a LED it blinks. If you are using one of the many brushless controllers aimed at the model car/boat/plane world it'll be expecting a very particular signal. As I recall the pulse stream needed has a rate around 50Hz and a pulse of 1.5mSec as neutral with +/- 0.5mSec to go forward/reverse. At this duty cycle you are unlikely to see a LED blinking because of our eye's response time and it'll be very dim given the 1/20th duty cycle.

You might get a better idea of what is happening using a crystal ear piece and just listening to what's happening.
That's correct for servos (50 Hz, 1.5mS neutral etc.).

ESCs are slightly different as they control the speed of a motor rather than the angle of a servo.

I believe 1mS is normally power off and 2mS is maximum power. They can also be updated at higher rates, up to 400Hz is fairly typical, although the theoretical maximum is 500Hz.

RaspISteve
Posts: 98
Joined: Wed Oct 24, 2012 9:15 pm
Location: Cheltenham, UK

Re: Brushless Motor run via Rpi

Thu Aug 21, 2014 11:45 am

joan wrote:
RaspISteve wrote:S,
<snip>. As I recall the pulse stream needed has a rate around 50Hz and a pulse of 1.5mSec as neutral with +/- 0.5mSec to go forward/reverse. At this duty cycle you are unlikely to see a LED blinking because of our eye's response time and it'll be very dim given the 1/20th duty cycle.

You might get a better idea of what is happening using a crystal ear piece and just listening to what's happening.
That's correct for servos (50 Hz, 1.5mS neutral etc.).

ESCs are slightly different as they control the speed of a motor rather than the angle of a servo.

I believe 1mS is normally power off and 2mS is maximum power. They can also be updated at higher rates, up to 400Hz is fairly typical, although the theoretical maximum is 500Hz.
Yep, I know this.

I've just bought an ESC for a brush-less motor and I certainly hope it'll work in exactly the same signal as my servo if for no other reason it'll get plugged in to where a previous servo went and currently a brushed motor controller that does forward/stop/reverse and I've found nothing yet that tells me otherwise. I also know these things are quite smart and can be programmed to react differently. Mine has a little button to signal an auto-configure cycle to my existing kit.

My point was a LED may not be the best debugging tool for low duty cycle pulses and pulses in general. Using an acoustic transponder the Mk 1 ear can usually discriminate far more detail than the Mk 1 eyeball at frequencies above a few hertz.
Share and Enjoy.

Return to “Beginners”