kramer65
Posts: 40
Joined: Mon Mar 18, 2013 2:59 pm
Location: Amsterdam

How to start with this ESC? Some simple questions

Tue Sep 10, 2019 1:54 pm

I'm building an autonomous boat for which I've been using a brushed DC motor. I now want to try my luck with a brushless DC motor. So I just ordered this brushless motor and I still have this ESC laying around (which I never used before).

My questions:

1. Can I use this ESC with this motor? (same links as above)
2. How do I know what kind of PWM values I need to send to the ESC? Is that the same for all ESCs? Or is that a trial and error thing?
3. Is it possible to use the ESC to reverse the direction of the motor? Or do I also need to use an H-bridge for that (just like I do with the brushed DC motor)?

All tips are welcome!

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

Re: How to start with this ESC? Some simple questions

Tue Sep 10, 2019 3:59 pm

1. You should be able to use the ESC with that brushless motor.

2. ESCs are controlled in a similar way to servos. By default they expect a continuous stream of pulses at 50 Hz. The pulses should be in the range 1000 µs (power off) to 2000 µs (full power).

3. You can't use an ESC to change the motor direction. When you bought the motor you would have specified whether you want clockwise (CW) or counter clockwise (CCW). You would need swap two of the three motor wires to change direction (although I'm not sure how well the motor would then work in the water).

I suppose you could build your own hardware and include a H-bridge. It's not easy to drive a brushless motor though, that's why ESCs exist.

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

Re: How to start with this ESC? Some simple questions

Tue Sep 10, 2019 4:12 pm

Some ideas here for driving brushless motors from the Pi without an ESC.

https://www.raspberrypi.org/forums/view ... 0&p=818568

kramer65
Posts: 40
Joined: Mon Mar 18, 2013 2:59 pm
Location: Amsterdam

Re: How to start with this ESC? Some simple questions

Tue Sep 10, 2019 4:38 pm

joan wrote:
Tue Sep 10, 2019 3:59 pm
1. You should be able to use....
That is awesome, thanks!

I also found some reversible ESCs, such as this one. But I guess I'll start with the one way ESC that I already have.

kramer65
Posts: 40
Joined: Mon Mar 18, 2013 2:59 pm
Location: Amsterdam

Re: How to start with this ESC? Some simple questions

Tue Sep 10, 2019 4:39 pm

kramer65 wrote:
Tue Sep 10, 2019 4:38 pm
joan wrote:
Tue Sep 10, 2019 3:59 pm
1. You should be able to use....
Thanks for the complete answer!

I also found some reversible ESCs, such as this one. But I guess I'll start with the one way ESC that I already have.

User avatar
clicky
Posts: 455
Joined: Thu Oct 25, 2012 7:34 am

Re: How to start with this ESC? Some simple questions

Tue Sep 10, 2019 6:01 pm

kramer65 wrote:
Tue Sep 10, 2019 1:54 pm
1. Can I use this ESC with this motor? (same links as above)
2. How do I know what kind of PWM values I need to send to the ESC? Is that the same for all ESCs? Or is that a trial and error thing?
3. Is it possible to use the ESC to reverse the direction of the motor? Or do I also need to use an H-bridge for that (just like I do with the brushed DC motor)?

All tips are welcome!
3. Dead easy - install servoblaster (https://github.com/richardghirst/PiBits ... rvoBlaster) or any equivalent (there's at least one or two more libraries that work on very similar/same principles and refer back to servoblaster)

To drive ESC all you need is to connect ESC to GPIO servo blaster is driving (signal pin - ground needs to go to ground while it is smart not to connect 5V from ESC back to Pi ! (*)) - you can see servoblaster documentation to how to configure which pins it is going to drive (and which are driven by default) and you can control your ESC even by simple:

Code: Select all

echo >/dev/servoblaster "0=150"
Values from around 70-90 will keep motor stationary - values from those to around 240 will drive motor from 0-100% of speed.

1. That ESC is not the best for what you're after. Maybe you would rather have ESC that can drive motor forward and backwards - search for car/boat ESC instead. With such ESC value of 150 is 'middle' and will mean motor being stopped, while numbers from 150 to around 70-90 would drive motor to one direction and numbers from 150 to ~ 210-230 will drive it to opposite direction.

2. PWM there is actually 'ordinary' servo signal - a pulse that repeats 50 times a second and of width from around 0.7ms to 2.40ms. Nominally it should be from 1ms to 2ms but many modern devices - ESCs and servos allow much wider pulses and 'middle' defined with 1500us (1550us by specs I think)

I suggested servoblaster as it is the easiest way to drive servos and ESCs - pulses are precise and driven by DMA (not by software in non realtime OS as Raspbian is). If you want to control it with python all you need is to open that file (/dev/servoblaster) and write 0=xxx where xxx is number from 70 to 240... Of course you would need to 'calibrate' your code to exact figures.

(*) ESCs provide 5V back to devices that are normally driving them (receivers usually) and such small ESC might not provide enough current back to power RPi. Read specs on ESC (what is 'BEC' current they provide) and try out first - checking the temperature of ESC just powering back Pi (no other power to Pi should be brought in that case). If it gets too hot just provide your own power for Pi (separate BEC for instance).

Do ask if you get stuck with any of above. I've used it in quite a few projects driving several servos and/or several ESCs including https://www.thingiverse.com/thing:2763746 where each wheel has such ESC and is directly driven by RPi.

cruster
Posts: 120
Joined: Mon Sep 01, 2014 7:56 pm

Re: How to start with this ESC? Some simple questions

Tue Sep 10, 2019 6:15 pm

Love the Rover. Awesome!

Return to “General discussion”