- We can not interface DC motor directly to the microcontroller, Because:
- Less voltage compatibility – simple DC motor requires minimum 9 V of power supply to run efficiently, but microcontroller pin have only 5 V CMOS logic which is not enough to drive DC motor.
- Less current compatibility – simple DC motor requires greater than 300 mA current to produce enough flux or make a torque that runs motor efficiently, but microcontroller pins have only 1.6 mA current (here I m talking about only 8051) which is not enough to drive DC motor.
- Back EMF – main and the greater difficulty in direct interfacing of motor is back current produced by induced EMF which may cause damage in microcontroller pin or whole microcontroller.
Solution is L293D motor driver IC
- Single L293D motor driver IC can drive two motor at a time as you can see in above pic.
- It has different pin called VS which is used to supply motor and there are two enable pins used to control motors externally.
How L293D IC works
- L293D motor driver IC contain two H-bridge circuit inside it, which may also use darlington transistor some times for current amplification.
- Let we understand this H-bridge circuit, in case 1, when logic ‘1’ apply to transistor T1 and T4, motor starts rotating in clockwise direction due to circuit complete and current flows through it as shown by blue indication.
- In case 2, we apply logic ‘1’ to transistor T2 and T3, so motor starts rotating in anti-clockwise direction due to circuit complete and direction of current flows through it is shown by green indication.
- As I mentioned that logic ‘1’ apply to T1 & T4 or T2 & T3 is just for simplicity cause this transistor is hard wired inside IC so you just need to take care of pin-out and apply logic to IC’s pin directly and carried out your work.
How simple or geared DC motor work with microcontroller?
- As you can see on above pic, understanding of motor is simple as seen.
- Motor rotates in the direction of higher potential to lower potential.
- Here we make this diagram as simple as we can, cause easy understanding (not use L293D IC).