Let's get started.
When we need to drive a DC motor we just need to supply electricty to its inputs. But What if we need to rotate the DC Motor both directions? To do this we should change the inputs and suply the voltage again. In normal operation this generally not possible. So we need a electronic circuit to accomodate this action instead of us. This electronic circuit named as H-Bridge.
A H-Bridge circuit consist of voltage input, voltage output and four switches. We will supply the electricity with voltage in and out, then we will make some combinations with these switches to change the voltage path and motors rotation direction. Attention! Wi will not change the connection, just open and close some switches. This makes the easier to control a DC motor rotation.
Below image you can see the most basic H-Bridge circuit.
There are some important things which we have to be carefull about H-Bridge circuits. These are:
- We have to select switching component that can work with enough current values. If we use the transistor that can work with maximum 2 amperes, it will be damaged over this value.
- We should use PNP type transistors at the upper side of circuit and NPN type transistors at the bottom side of circuit.
- We should be careful to short circuit. If we close the switches directly from positive to negative, we weill probably burn our circuit and electronic components.
- We should consider the discharging times of component. I mean If the timing and sensitivity is important for us we can use transistor not to magnetic relays. Of course we can use magnetic relays when we need much amperes but not need the sensitivity.
- We alwasy consider the voltage drops of the transistor or relay which we connected as switching components.
Below image you can see an example of H-Bridge circuit with transistors.
Locating of the transistors is important.
As you can see the above image PNP transistors located at the upper side of circuit and NPN transistors located bottom side of circuit.
So, Why to do this?
Firstly Never forget to consider this:
The arrow mark at the transistor symbol is always show the emitter side.
At the PNP transistor the current goes from Emitter to Collector. So you should connect the load to output of the transistor.
At the NPN transistor the current goes from Collector to Emitter. So you should connect the load to input of the transistor.
Most microcontrollers have 3.3V digital output voltage. Also you will need more voltage than 3.3v which supplied from microcontroller digital output. You can supply more voltage with PNP type transistor. For example if your motor need 12-VDC You can connect a +9V to the emitter pin of PNP transistor and microcontroller digital output which has 3.3V to the base pin of PNP transistor. At the end you will have 12.3V DC voltage at the collector pin. You can measure this value with a standart multimeter or you can connect here a DC-Motor.
If we connect the NPN transistr to the positive voltage output with the same directions the motor will not be working. Because we habeen connected the load output of the NPN transistor instead of input.
As our tansistor and connection subject okay, now we can talk about switching for rotation directions.
As I mentioned above we are changing the path of the voltage and so motor rotation direction is changing.
Below images you can see the current flow directions.
When we close the Switch 1 and Swtch 4, open the Switch 2 and switch 3 The current flow direction will be like below image:
When we close the Switch 2 and Swtch 3, open the Switch 1 and switch 4 The current flow direction will be like below image:
As a result of these combinations voltage inputs will be changed and the direction of the motor will be changed.
At last we are ready to rotate our motor with both directions. But do we know if some voltages remaining in the circuit after opening the switches it will go somewhere else. To avoid this we have connected the returning path with diodes to the Ground. By this way the remaining voltage will go to the GND safely. And it will protect the circuit.
NOTE: Youcan change the motor speed with the PWM signal. This article just about H-Bridge and DC-Motor controlling.
That is all in this article.
Have a nice DC Motor controlling.
Burak Hamdi TUFAN.