I have an mbed project with firmware that controls some PwmOut
switches. All works fine firmware opens and closes switches as expected. I tested this with a LED (and resistor).
Now my goal is that instead of a light coming on, a electric brush motor (with a simple +/-) 3v-5v should run. I understand that the PwmOut
from the mbed will not provide enough current to run the motor.
Will I need a transistor that connects the PwmOut
port with the motor?
If yes:
- how do I know what type I need?
- these three legged guys - how are they hooked up?
-
\$\begingroup\$ It's worth adding how much current the motor draws (or a datasheet if you're not sure). If it's a small motor you could probably use the circuit from the answer to electronics.stackexchange.com/questions/7235/… \$\endgroup\$PeterJ– PeterJ2013年11月15日 10:20:29 +00:00Commented Nov 15, 2013 at 10:20
1 Answer 1
You can follow the recipe at http://mbed.org/cookbook/Motor which uses the Motor
interface for driving a standard DC motor with PWM and an H-Bridge.
enter image description here
If, instead of using the L293D dual H bridge driver, you want to use a transistor to drive the motor. You choose the transistor mainly by looking for a switching transistor which has a current and voltage rating that exceed the current and voltage ratings of the motor (so it depends on the motor) - for high currents you may need a heatsink for the transistor.
For a bipolar junction transistor (BJT) you'll need a resistor to limit base current. Most driver circuits incorporate a diode to prevent harm to the transistor from back-EMF from the motor windings.
enter image description here
The connections to a BJT are base, emitter, and collector
enter image description here
You can find out which leg is which by looking at the data sheet for the specific transistor you have chosen. For example
enter image description here
You can instead use a MOSFET, these can be more efficient (lower voltage drop when 'on')
Some rather good instructions can be found here