Microcontrollers can’t driver Dc motor by them selfs
External circuit with microcontroller to drive dc motor
Using a pre-assembled dc motor driver
If you are new and don’t know about l293d pin out, its internal structure and how to effectively use it? Just take the below tutorial it will help you in understanding the arduino code written below.
From the above tutorial you can easily understand how to make motor connections with arduino uno pins and l293d motor driver. Each and every step of interfacing a load with l293d is well explained in the above tutorial.
Arduino dc motor control, L293d Motor Driver – Bidirectional motor control – connections
L293d motor driver with arduino driving dc motor – Project code
First i give delay for 2 seconds to make the circuit stable. Note that the arduino void loop function is same like while(1) continuously working function or repeating.
Next i made Pin#7 HIGH and Pin# 8 LOW, this signal goes to the L293d Pin#2 and 7 which made our motor to run in clock or anti clock wise direction depending on your configuration. Motor remains in this condition for 4 seconds then the state of the pins changes.
Now both the pins are at LOW means zero which make the motor to stop and motor stops for 3 seconds, this step is very important because now we want to change the direction and if we change it with out any delay, than it could be dangerous for our circuit and motor driver. when the motor rotates it generates a back emf(electro motive force) in it and when it stops this emf transmits back out to the circuit, which could be harmful. That’s why i stooped the motor for 3 seconds.
Then again i rotate the motor but this time in opposite direction, by making Pin# 8 HIGH and 7 LOW. Motor now rotates in opposite direction for 4 seconds. After it again a delay and motor stops. After these all the steps the loop function repeats and the circuit perform the same steps from start.
Filed Under: Arduino, Microcontroller Projects
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.