How to create Bidirectional Motor Controller Circuit
To make a motor turn in both directions, we need a way to reverse the flow of electricity (polarity) going to the motor.
To accomplish this we are going to design an H-Bridge circuit.
An H-Bridge circuit is an easy to use circuit to control the directional of a motor. Since it is straightforward and easy to create, it used in lots of systems such as robotics projects, since it controls the direction of a motor. Below is the schematic of the circuit we are going to create.
So how does the H-Bridge circuit work
When Switch A is pressed, current is sent to the Base of Transistors A1 and A2. When current is applied to the Base of the Transistor, the circuit between the Transistor’s Emitter and Collector is closed, allowing electricity to flow from the Collector to the Emitter.
In fig. 2 (Schematic of Switch A pressed) you can see what direction the electricity is flowing when switch A is pressed in the H-Bridge circuit.
(note: The resistor values should be 10 ohm not 10k ohm in both figure A and B)
Now when Switch B is pressed, current is sent to the Base of Transistors B1 and B2. The electricity is now flowing through the Collector and Emitter of B1 and B2. This reverses the direction the electricity is flowing through the motor. You can see this the in fig. 3 (Schematic Switch B pressed).
There is a problem within the schematics. If Switch A and Switch B are pressed simultaneously, you will short the circuit and destroy the transistors.
To over come this problem, we need to add some diodes (D1-D4) in the circuit. These diodes give a way for thefrom the motor to escape. This protects the bipolar transistors from damage (See Fig. 1 Schematic of a H-Bridge Motor Controller). The resistors (R1-R4) are used to lower the level of current being sent to the Base on the Transistors, when the switches are closed.
Time to build the circuit.
|4||NPN-Transistor||part # 2n2222a|
|4||Rectifier Diode||part # 1N4001|
|4||10k Ω Resistor|
|1||Battery Pack||Voltage 3V|
Try building the circuit below. If everything is correct the motor will spin one way when Switch A is pressed, and when Switch B is pressed the motor will spin in the opposite direction. If both Switches are pressed the motor should stop.
Congratulation you can now control the direction the motor will spin.
In the next post, we will show you how to use the GPIO on the Beaglebone Black in as a substitution of the switches to control the motors.
We’ve include ourproject file . This file also includes PDFs of the PCBs.