Introduction: Controlling DC Motors With Arduino and L293
Easy way to control DC motors.All you need is knowledge in electronics and programming
If you have any questions or problems you can contact me on my mail:firstname.lastname@example.org
Visit my youtube channel: https://www.youtube.com/channel/UCuS39O01OyPeChjf...
So let's begin.
Step 1: Watch a Video
You can also see how this project is working
Step 2: Materials
All materials you need can be found on ebay or amazon.But if you any old electronics devices such as printers or something else you can get materials from there.
For this project you will need:
-motor driver L293D
-Arduino Mega 2560 or Uno
-9V battery case
-Green and red LED diodes
-two push buttons
-two 10k ohm resistors
Motor driver L293D
You can use this chip for controlling one or two different motors.It belongs in TTL family, that means it runs on 5V+.
It has 16 pins
Pin 1 no connect
Pin 2 is input
Pin 3 is output for motor
Pin 4 and 5 are connected to GND of battery
Pin 6 is second output for motor
Pin 7 is second input
Pin 8 is V+ from battery (9V)
On the other side is the same except :
Pin 16 is Vcc+
Pin 9 no connect
Step 3: Wiring
If you will have any problems with wiring you can help youself with the pictures.On top there is circuit for controlling 1 motor and down is circuit for controlling 2 motors.I made exemple with only one motor.
Digital input 2 is connected to ON button (button with blue cap)
Digital input 3 is connected to OFF button (button with red cap)
With this two buttons you can change direction of spinning
You need to connect 10k ohm resistor between GND from Arduino to push button pin.
Green LED diode is connected to digital output 5
Red LED diode is connected to digital output 4
Pin 1 no connect so you let it empty.
Next is Pin 2 which is connect to digital output on Arduino (you can choose any digital output from 2 to 53)
Pin 3 is connected directly to motor
Pin 4 and 5 are connected to battery GND
Pin 6 is connected directly to motor
Pin 7 is connecte to digital output on Arduino
Pin 8 is V+ from battery.I recommend you to use 9V battery so the motor will run smoothly
If you have need chance you can make circuit.
You must be careful that you connect GND of Arduino with GND of battery.In opposite case the whole thing won´t work
If you want to control two motors you need to wire the other side of L293D
Pin 16 is Vcc+.You get 5V voltage from Arduino
Pin 15 is connected to digital output on Arduino
Pin 14 is connected directy to motor
Pin 13 and pin 12 are connected to GND of battery
Pin 11 is connected directy to motor
Pin 10 is connected to digital output on Arduino
Pin 9 no connect
Step 4: Fabricate the Circuit Board
I made this circuit by myself.For drawing the circuit is used SprintLayout.This is program for drawing circuits, in this program you have all the dimensions of electronic components so basicly you can make circuit for everything you want.
For engraving this board is used CNC engraving milling machine.I used normal board for circuits which is cotted with copper on one side.When board was finished I polished it with very fine sand paper.Then I mixed industrial alcohol and rosin in powder.With this mix I then coatted copper side to protect it.
Step 5: Code
I made three different codes.
After every 5 seconds motor changes the way of spinning
Motor controlling with 1 button:
When you hit button first time motor spinns in one direction, when you hit button second time motor starts spinning in other side
Motor controlling with 2 buttons:
When you hit ON button motor spinns in one direction, when you hit OFF button motor spinns in other direction.
We have a be nice policy.
Please be positive and constructive.