Motor controller: H-Bridge
Basics of motor control
This tutorial introduces the concept of motor control and how H-bridge can be implemented to control the speed of the motor. What is a motor controller? A motor controller is a device or group of devices that serves to govern in some predetermined manner the performance of an electric motor.
This can be achieved simply by changing the polarity of the applied voltage or a mechanical two way spring loaded switch which also changes the polarity (See Fig. above).
Bi-Directional Or H-bridge control
With the help of relays or opto couplers with amplifiers (some specially designed ICs) we can change the direction of the DC motor rotation. Circuits below shows the simple concept behind H-bride control of DC motors.
In Fig.1 simple H-bridge Connection is shown using switch. Where all the switches are open and the motor is not receiving any potential difference V or current I and hence it is not rotating.
In Fig.2 switches S2 and S3 are open and S1 and S4 are closed which creates a potential difference across the motor and simultaneously a current flows through the circuit which rotates the motor shaft, let’s say, in the clockwise (CW) direction.
Similarly, in Fig.3 switches S1 and S4 are open and S2 and S3 are closed which rotates the motor in anti-clockwise direction.
After the basics here comes the real Integrated Circuit (ICs) based H-Bridges which are essentially made by using electronic circuit elements such as opto coupler switches, operational amplifiers and some safety elements.
You can also see our tutorial on how to make your own Simple Motor Driver or H-bridge? [Coming Soon]
These ICs are also called Motor controllers and come as a single package depending on the desired current and voltage ratings. One of the very common H-bridge ICs available in the market is L293B or L293D. It is in fact a double H-Bridge, since motion of two motors can be simultaneously controlled on each half. While interfacing with Microcontrollers GND (0 V) and voltage supply to the motor is needed in H-Bridge since input is being provided from microcontroller.
Additionally H-Bridge can also be used in remote controlled circuits with the only difference being that the inputs provided to the input pins of the H-Bridge (which was earlier being provided by the microcontroller) will now be in the form of external 5V supply for bit 1 (high) and ground (0 V) for bit 0 (low). It is always advised to go through the datasheet of the ICs before using them. There are a lot of manufacturers who sell these ICs, and finding a datasheet is easy. Yet a detailed description of how to use an H-Bridge IC L293D is provided below.
Firstly identify your PINs like IN for input, OUT for output, GND for ground (0 V), EN enable pin for enabling whichever half of the H-Bridge to be used (explained later in detail), Vcc for operating voltage of ICs generally 5v and lastly +V voltage applied to the motor which should be more than Vcc otherwise ICs would not work properly. (See Fig. 1)
Secondly, have a look at the numbering of the pins and try to remember them. Here we have used bit 1(one) and bit 0 (zero) in place of 5V and GND respectively (or simply we will consider our inputs in terms of binary digits 0 and 1). Let us see how L293D works
In Fig.2 a circuit connection has been shown, where M1 & M2 are two DC motors connected to the outputs on each half (pin no 3, 6 & 11, 14) .We can see that Vcc, GND and +V all have fixed potentials. Now we will simultaneously enable the two half with enable pins (1 & 9) by providing logic high i.e. bit 1 or simply value equal to Vcc i.e. 5V , then we try to rotate the motor in the same direction by applying bit 1 & 0 to INPUT pins (2,7 & 15,10). We will observe a potential difference of +V voltage across both the output terminals of M1and M2 (pin no 3,6 & 14,11).
Since we have explained earlier we can change the direction of rotation of the motor by just reversing our INPUT. Let’s say, now we have reversed our input for M1 i.e. we are now applying bit 0 & 1 to the input pins (IN1 and IN2). We can see in the circuit that the outputs for M1 has reversed and hence the direction of rotation of the motor (because polarity has been reversed). Similarly the other half can also behave as per your requirements. (See Fig. 3)
Now we will see the role of ENABLE pins (1,2EN & 3,4EN or pin no 1 & 9). In Fig. 4 we have changed the input of 1,2 EN to bit 0 (zero) and the potential difference across M1 output pins is ZERO or nil which tells us that one H-bridge has been disabled and the motor stops rotating. This is basically an additional help to control the motor by just enabling or disabling the required half of L293D IC. Some facts about L293D H-bridge
- 600-mA Output Current Capability Per Driver
- Pulsed Current 1.2-A Per Driver
- Output Clamp Diodes for Inductive Transient Suppression
- Wide Supply Voltage Range 4.5 V to 36 V
- Separate Input-Logic Supply
- Thermal Shutdown
- Internal ESD Protection
- High-Noise-Immunity Inputs
- Functional Replacement for SGS L293D
Let’s hope that you have understood the concepts of H-bridge. In case you want to learn more, read our tutorial, activities and forums related to motor drivers/controllers.