$1 Motor Driver Circuit for Arduino
by Imetomi in Circuits > Electronics
42399 Views, 783 Favorites, 0 Comments
$1 Motor Driver Circuit for Arduino
![DSCN0520.JPG](/proxy/?url=https://content.instructables.com/FNM/EIMC/IJWUVAMI/FNMEIMCIJWUVAMI.jpg&filename=DSCN0520.JPG)
![DSCN0517.JPG](/proxy/?url=https://content.instructables.com/FV1/DLOV/IJWUVAMD/FV1DLOVIJWUVAMD.jpg&filename=DSCN0517.JPG)
![DSCN0531.JPG](/proxy/?url=https://content.instructables.com/FI8/D27X/IJWUVAMP/FI8D27XIJWUVAMP.jpg&filename=DSCN0531.JPG)
The story of this motor shield is that I wanted to make a robot for my multifunctional brainwave controlled system and I decided to share this with you. It's a very simple circuit I used the L293D IC that is a dual bridge motor driver IC. I also added an output for a servo motor. Finally this circuit was able to control 2 DC motors or 1 stepper motor and a servo motor.
So let's get started!
Gathering the Parts
![DSCN0508.JPG](/proxy/?url=https://content.instructables.com/FPT/V2DP/IJWUVANR/FPTV2DPIJWUVANR.jpg&filename=DSCN0508.JPG)
![DSCN0506.JPG](/proxy/?url=https://content.instructables.com/FKJ/OV58/IJWUVAMW/FKJOV58IJWUVAMW.jpg&filename=DSCN0506.JPG)
For this project you'll need only a few parts:
- 2 Screw Terminals
- L293D IC
- 3 Header Pin
- 9 Header Pin (90 degrees)
- 1k Resistor
- Red LED
- Wires
- A PCB Board
Tools:
- Soldering Iron
- Solder
- Wire Stripper/Cutter
Soldering
![L293d.PNG](/proxy/?url=https://content.instructables.com/FMD/2HGI/IJWUVAMQ/FMD2HGIIJWUVAMQ.png&filename=L293d.PNG)
![DSCN0507.JPG](/proxy/?url=https://content.instructables.com/FHP/8HH5/IJWUVANN/FHP8HH5IJWUVANN.jpg&filename=DSCN0507.JPG)
![DSCN0510.JPG](/proxy/?url=https://content.instructables.com/F3Z/9LKE/IJWUVAIU/F3Z9LKEIJWUVAIU.jpg&filename=DSCN0510.JPG)
![DSCN0511.JPG](/proxy/?url=https://content.instructables.com/FL4/25QZ/IJWUVAKL/FL425QZIJWUVAKL.jpg&filename=DSCN0511.JPG)
![DSCN0512.JPG](/proxy/?url=https://content.instructables.com/FMP/QLJS/IJWUVAKM/FMPQLJSIJWUVAKM.jpg&filename=DSCN0512.JPG)
As you can see I used a LinkIt ONE but you can use an Arduino UNO as microcontroller. And you can connect the pins to any I/O pin of the microcontroller. First insert the parts in the holes of the PCB then solder to it.
Wiring Up
![DSCN0513.JPG](/proxy/?url=https://content.instructables.com/FE6/69D6/IJWUVALC/FE669D6IJWUVALC.jpg&filename=DSCN0513.JPG)
I used some copper wires and following the schematic connected the pins of the IC to the header pins. Doesn't matter that which pin goes to which header pin, just remember that were did you connected them. The LED is connected in series with the resistor and in paralell with the 5v VCC.
Powering Up
![DSCN0514.JPG](/proxy/?url=https://content.instructables.com/FDX/L2I1/IJWUVALI/FDXL2I1IJWUVALI.jpg&filename=DSCN0514.JPG)
![DSCN0515.JPG](/proxy/?url=https://content.instructables.com/FI9/JJY7/IJWUVAMC/FI9JJY7IJWUVAMC.jpg&filename=DSCN0515.JPG)
I simply connected a 5 volt power source to the test the circuit.
Connect the Motors
![DSCN0509.JPG](/proxy/?url=https://content.instructables.com/FW2/C6ZK/IJWUVAON/FW2C6ZKIJWUVAON.jpg&filename=DSCN0509.JPG)
![DSCN0528.JPG](/proxy/?url=https://content.instructables.com/FR9/PWBU/IJWUVOXY/FR9PWBUIJWUVOXY.jpg&filename=DSCN0528.JPG)
![DSCN0538.JPG](/proxy/?url=https://content.instructables.com/FWY/LX6U/IJWUVP25/FWYLX6UIJWUVP25.jpg&filename=DSCN0538.JPG)
Connect the motors to the motor driver circuit. Then the digital pins to the header pins. Example if D6 is high the motor starts spinning because the IC pulls up the output pin to HIGH. So if the selected pin is HIGH the motor spins to the programmed direction.
In my Case:
- D11---> Motor 1 Right
- D10---> Motor 1 Left
- D6---> Motor 2 Right
- D5---> Motor 2 Left
Downloads
The Code
Copy this Code in your IDE then upload as you see every pin controls a direction of the motor.
#include <Servo.h> Servo MyServo void setup() { // initialize digital pin 13 as an output. pinMode(11, OUTPUT); pinMode(10, OUTPUT); pinMode(6, OUTPUT); pinMode(5, OUTPUT); pinMode(3, OUTPUT) MyServo.attach(3); //connect the servo to pin D3 }
// the loop function runs over and over again forever void loop() { digitalWrite(11, HIGH); delay(2000); digitalWrite(11, LOW); digitalWrite(10, HIGH); delay(2000); digitalWrite(10, LOW); digitalWrite(5, HIGH); delay(2000); digitalWrite(5, LOW); digitalWrite(6, HIGH); delay(2000); digitalWrite(6, LOW); MyServo.write(170); delay(1000); MyServo.write(0); }