Transistor and H-bridge motor control lab, with Jason Rosen and Sara Al-Bassam
Goal of the lab:
Understand analog control of a DC motor, using a transistor (or, as absolutely nobody calls it, a T-bridge).
Understand digital control of a DC motor, using an H-bridge.
Analog control lets you fine-tune the speed but you can only go in one direction.
Digital control lets you control direction on the fly but gives you only one speed.
Imagine a guard tower, or “base” station, guarding a major trade route into the city. If nobody is in the tower, nobody can lower the drawbridge into the city. For anything to move, the control tower must be active (Base-Low current line, with a minimum current for activation) And if the bridge is up, nobody can go anywhere. The masses must wait for a complete pathway. (Collector-High current line waiting for a complete circuit)
The guards can decide whether to let the bridge down, and how many can go through at a time. (Emitter-Result of the high current line after modification by the low current line)
L293D H-Bridge IC, 16 pins (similar to L293NE)
H bridges are interesting. They use digital input so the options are (HIGH) or (LOW), no continuous range. This one lets you control up to 2 motors at a time, determine the direction of either motor’s spin, and have both an enable/disable pin (based on HIGH or LOW) and a stop (fast). Settings can be memorized as a NOT for direction (reverse direction by reversing the high and low inputs) and an AND for stop (set both inputs the same, no current differential). It requires a separate high-current power source to run the motor we are using. It has a heat sink and ground pin on each side, to accomodate the higher current.
Analog – Potentiometer, Transistor, 12V 650 mA power, motor
Amusing mistakes –
1. Connecting the breadboard’s ground and power into both ground pins on the Uno. Result: Nothing happens
2.Connecting the potentiometer to A1 instead of A0 as I had written in the code. Result: Nothing happens
Digital – H-bridge, 12V 650 mA power, motor
Amusing mistakes –
1. Setting the enable/disable pin in setup instead of loop. Result: Nothing happens
2. Unknown: Having fixed the enable bug, motor spins rapidly in one direction. A digital switch should swap the HIGH and LOW settings on the motor input/output, causing it to change direction. Serial monitor shows that the switch is working, and input/output are communicating. However, pressing the switch does not currently cause the motor to change direction. Result: Fast motor spin
Setting up the H-bridge made quite a mess of wires on the breadboard. But we checked all the connections are they are set correctly, so the error is probably somewhere in my code. Still working on it.