Hi you all guys,
After reading the PWM signals theorical and practical posts I hope that you all know perfectly how to control DC Motor's velocity. Thus, let's move forward and see how we could control the direction as well.
The pictures below show how the H-Bridge concept works. Note that when transistors S2 and S3 are enabled, electricity goes through the motor from its right side to its left one and the motor therefore moves forward. In contrast, when transistors S1 and S4 are enabled instead, electricity goes through the motor from its left side to its right one and the motor then moves backward.
Thus, the DC Motors directions may be controlled by enabling and disabling transistors.
However, there are easier solutions such the L298, which is an integrated chip that internally has two h-bridges and therefore provides full control of 2 motors. Those who don't know about it yet, below is a link where you will find its datasheet.:
In addition, there are some PCBs that are already prepared for being used with this L298. In the picture below you will see the PCB which I used:
As you can see, on the left side of the PCB are placed the inputs and on the right side are the outputs. Specifically, ENA, IN1 and IN2 provide the control for the MotorA while the ENB, IN3 and IN4 provides the control for the MotorB. The ENA and ENB receives a 5V PWM signal each and the IN1-IN2 and ÍN3-N4 pairs work as told in the true table below.
IN1/IN3 IN2/IN4 Motor status
´ 0 0 Stopped
0 1 Move forward
1 0 Move backward
1 1 Emergency break
Unfortunately, the L298 is prepared for current peaks lower than 2,5A on each channel and 3A on both channels working in parallel. The DC Motor, which my trains use, may consume current peaks higher than 3A, so by the moment I am using another PCB which is prepared for current peaks around 10A. You will find a picture of this PCB below.
Please, leave your comments!!!
See you guys!