Author Options:

Connect DC motor to Servo Output? Answered

I am currently working on a robot of sorts, and have a quick question i would like to ask.
I am using a Raspberry Pi as my "Brain", and am using ServoBlaster as my software. I am currently working on driving 6 servos and two motors with said software. My question is, how would i attach the motors to the board? I would like to control the motors with the same software (ServoBlaster) and thus would like to have them run off of PWM. The software allows me to change the min and max range of width, along with a whole bunch of other things, but that is for a later date. 
So, my question is, how would i wire a motor up to a PWM output? I would like the motor to be continuous rotation (I am using a Mindstorms motor for the task, which will move the robot). I guess i could use an ESC, but i would like to do it without one (Though, if you linked one that would work in this situation, I wouldn't kill you :P Here is a link to the motor if you need more info on it: http://www.amazon.com/LEGO-Mindstorms-Interactive-Servo-Motor/dp/B003BCCYSK ) 
Preferably a method that doesn't require purchasing something i don't have would be best. If this isn't possible, please keep it on the lower end of price tags, as my funding is running dry.


Why not modify a servo for continuous rotation?

The servo drive expects to send a signal out of the Pi which controls the servo position. That signal is a variable width and repeated at a 20 Msec frame rate. A lot of people refer to this as PWM but it isn't quite the same as PWM use to control the speed of a motor where the pulse train is continuous and variable. For the servo control the information is transferred in the width of the pulse.

You may be better off using an H bridge to drive the motors and the Pi to control the H bridge.

At best your going to need a separate power supply for the motors that is switched on and off by your control signal. The Pi isn't going to produce enough current to drive a DC motor. (Typically max O/P around 20Ma I think.)

First off, the frame is constructed of mindstorms, and so a mindstorms motor works the best. Second, I am well aware that the pi cannot power it. The motor itself is a 6 volt motor, along with the six simultaneous servos I will be driving. The pi isn't powering anything. I have heard of people using this software for speed control, however, normally they have some other type of hardware (ESC) between it. I would like to do it without one. Can an H bridge be powered by PWM? I really don't want to find/write another program for motor control, and then figure out a way to interface it. My time runs short on the due date of this project.

Thanks for replying!

Not wanting to be pedantic but your question says

"I am currently working on driving 6 servos and two motors with said
software. My question is, how would i attach the motors to the board?"

It's a easy assumption to think your trying to attach them directly. Many people do.

The link below will tell you all about microprocessor interfacing - although NOT aimed at the Pi the information is just as valid.

You can also find info on driving An H bridge in there as well. in the stepper motor section The L239D will handle up to an amp but you will be better off assuming around 750 Ma. There are other H bridges that can handle more current.


Definitely not driving it off of the pi. Probably will go with an H bridge as earlier recommended.