Arduino L298 Motor Shield
by badarsworkshop in Circuits > Arduino
16228 Views, 100 Favorites, 0 Comments
Arduino L298 Motor Shield
![54dee0312f7cc65af80000f3.jpeg](/proxy/?url=https://content.instructables.com/FZV/RCJ1/I63EZKB2/FZVRCJ1I63EZKB2.jpg&filename=54dee0312f7cc65af80000f3.jpeg)
![DSC05348.JPG](/proxy/?url=https://content.instructables.com/FPX/9RCD/HSVGJ5NW/FPX9RCDHSVGJ5NW.jpg&filename=DSC05348.JPG)
This is my version of a cheap and diy arduino motor shield. It is very simple and rugged. Credit goes to Ascas for the design.
Specs:
Voltage = 5 - 50 V
Current = 2 - 3 A
Maximum two motors
Speed and direction control for both
Arduino compatible
This is my Facebook page. Please like and share
https://www.facebook.com/electronicrepairandservice
Specs:
Voltage = 5 - 50 V
Current = 2 - 3 A
Maximum two motors
Speed and direction control for both
Arduino compatible
This is my Facebook page. Please like and share
https://www.facebook.com/electronicrepairandservice
Parts
![New Bitmap Image.jpg](/proxy/?url=https://content.instructables.com/F1N/DZ40/HSVGJB58/F1NDZ40HSVGJB58.jpg&filename=New Bitmap Image.jpg)
You will need:
1 x L298 Motor Driver
1 x Veroboard
1 x Male Header Strip
1 x Female Header Strip
8 x 1N4007 Diodes
3 x Block connectors
2 x Indicator Led
2 x Led Resistor
2 x 1 Ohm Resistor
Jumper Wire
You will also need basic soldering tools and some soldering skills
1 x L298 Motor Driver
1 x Veroboard
1 x Male Header Strip
1 x Female Header Strip
8 x 1N4007 Diodes
3 x Block connectors
2 x Indicator Led
2 x Led Resistor
2 x 1 Ohm Resistor
Jumper Wire
You will also need basic soldering tools and some soldering skills
Schematic
![FCKYK2THAQ39B8K.LARGE.jpg](/proxy/?url=https://content.instructables.com/FZ4/SNTV/HSVGJB2U/FZ4SNTVHSVGJB2U.jpg&filename=FCKYK2THAQ39B8K.LARGE.jpg)
![L298Pinout.JPG](/proxy/?url=https://content.instructables.com/FU8/1POC/HSVGJB2N/FU81POCHSVGJB2N.jpg&filename=L298Pinout.JPG)
This is the schematic and again credit to Ascas. Pin out for the motor driver is also given
Step 1
![DSC05327.JPG](/proxy/?url=https://content.instructables.com/FXT/Y9AX/HSVGJ5PQ/FXTY9AXHSVGJ5PQ.jpg&filename=DSC05327.JPG)
![DSC05332.JPG](/proxy/?url=https://content.instructables.com/FII/W6LA/HSVGJ5NC/FIIW6LAHSVGJ5NC.jpg&filename=DSC05332.JPG)
![DSC05335.JPG](/proxy/?url=https://content.instructables.com/FYK/0B7R/HSVGJ5NG/FYK0B7RHSVGJ5NG.jpg&filename=DSC05335.JPG)
![DSC05334.JPG](/proxy/?url=https://content.instructables.com/F9J/1GOW/HSVGJ5NF/F9J1GOWHSVGJ5NF.jpg&filename=DSC05334.JPG)
You will start off by cutting your vero board to the arduino size. Sand down the sides for a neat finish. Start off by soldering the female headers, the L298 and the block connectors as shown
Step 2
![DSC05328.JPG](/proxy/?url=https://content.instructables.com/F5X/5GB0/HSVGJ5PS/F5X5GB0HSVGJ5PS.jpg&filename=DSC05328.JPG)
![DSC05330.JPG](/proxy/?url=https://content.instructables.com/FTZ/8N6A/HSVGJ5MZ/FTZ8N6AHSVGJ5MZ.jpg&filename=DSC05330.JPG)
Next step is to solder the male headers below the female ones to make it a shield type thing. You could buy the arduino headers to make the project prettier and more sturdy but i found them to be expensive. The best way is to insert the male header in the arduino I/O pins and align the shield on top of it. Use tape to secure it and then solder away.
Step 3
![DSC05336.JPG](/proxy/?url=https://content.instructables.com/FXU/GL30/HSVGJ5NI/FXUGL30HSVGJ5NI.jpg&filename=DSC05336.JPG)
![DSC05347.JPG](/proxy/?url=https://content.instructables.com/FXT/WRO2/HSVGJ5NV/FXTWRO2HSVGJ5NV.jpg&filename=DSC05347.JPG)
Next is to make the power and other connections along with adding the diodes. Follow the schematic and add the two resistors as well.
Step 4
![DSC05357.JPG](/proxy/?url=https://content.instructables.com/FK0/V4TK/HSVGJ5OD/FK0V4TKHSVGJ5OD.jpg&filename=DSC05357.JPG)
![DSC05356.JPG](/proxy/?url=https://content.instructables.com/FJY/AJNH/HSVGJ5O9/FJYAJNHHSVGJ5O9.jpg&filename=DSC05356.JPG)
Next is to add the led and resistors along with it. Here one option is to add a LM7805 so that you could power the arduino with the the power only to the shield but for my application i didnt need that so i went with separate power supply. I also made connections to the arduino PWM pins.
Test It
![DSC05350.JPG](/proxy/?url=https://content.instructables.com/FMQ/D32B/HSVGJ5O0/FMQD32BHSVGJ5O0.jpg&filename=DSC05350.JPG)
![DSC05351.JPG](/proxy/?url=https://content.instructables.com/FM8/629X/HSVGJ5O1/FM8629XHSVGJ5O1.jpg&filename=DSC05351.JPG)
You are all done and next is to test it out.
Use the following code
int outPin = 5;
int outPin2 = 6;
int outPin4 = 10;
int outPin3 = 11;
void setup()
{
Serial.begin(9600); // setup serial
pinMode(outPin, OUTPUT);
pinMode(outPin2, OUTPUT);
pinMode(outPin3, OUTPUT);
pinMode(outPin4, OUTPUT);
}
void loop()
{
delay(3000);
analogWrite(outPin, 50);
digitalWrite(outPin2, LOW);
analogWrite(outPin3, 50);
digitalWrite(outPin4, LOW);
Serial.print(" ");
Serial.print("slow");
delay(3000);
analogWrite(outPin, 150);
digitalWrite(outPin2, LOW);
analogWrite(outPin3, 150);
digitalWrite(outPin4, LOW);
Serial.print(" ");
Serial.print("med");
delay(3000);
analogWrite(outPin, 255);
digitalWrite(outPin2, LOW);
analogWrite(outPin3, 255);
digitalWrite(outPin4, LOW);
Serial.print(" ");
Serial.print("fast");
delay(3000);
analogWrite(outPin, 0);
digitalWrite(outPin2, LOW);
analogWrite(outPin3, 0);
digitalWrite(outPin4, LOW);
Serial.print(" ");
Serial.print("stop");
delay(3000);
analogWrite(outPin2, 100);
digitalWrite(outPin, LOW);
analogWrite(outPin4, 100);
digitalWrite(outPin3, LOW);
Serial.print(" ");
Serial.print("backwards");
delay(3000);
analogWrite(outPin, 0);
digitalWrite(outPin2, LOW);
analogWrite(outPin3, 0);
digitalWrite(outPin4, LOW);
Serial.print(" ");
Serial.print("stop");
}
Use the following code
int outPin = 5;
int outPin2 = 6;
int outPin4 = 10;
int outPin3 = 11;
void setup()
{
Serial.begin(9600); // setup serial
pinMode(outPin, OUTPUT);
pinMode(outPin2, OUTPUT);
pinMode(outPin3, OUTPUT);
pinMode(outPin4, OUTPUT);
}
void loop()
{
delay(3000);
analogWrite(outPin, 50);
digitalWrite(outPin2, LOW);
analogWrite(outPin3, 50);
digitalWrite(outPin4, LOW);
Serial.print(" ");
Serial.print("slow");
delay(3000);
analogWrite(outPin, 150);
digitalWrite(outPin2, LOW);
analogWrite(outPin3, 150);
digitalWrite(outPin4, LOW);
Serial.print(" ");
Serial.print("med");
delay(3000);
analogWrite(outPin, 255);
digitalWrite(outPin2, LOW);
analogWrite(outPin3, 255);
digitalWrite(outPin4, LOW);
Serial.print(" ");
Serial.print("fast");
delay(3000);
analogWrite(outPin, 0);
digitalWrite(outPin2, LOW);
analogWrite(outPin3, 0);
digitalWrite(outPin4, LOW);
Serial.print(" ");
Serial.print("stop");
delay(3000);
analogWrite(outPin2, 100);
digitalWrite(outPin, LOW);
analogWrite(outPin4, 100);
digitalWrite(outPin3, LOW);
Serial.print(" ");
Serial.print("backwards");
delay(3000);
analogWrite(outPin, 0);
digitalWrite(outPin2, LOW);
analogWrite(outPin3, 0);
digitalWrite(outPin4, LOW);
Serial.print(" ");
Serial.print("stop");
}
Conclusion
![DSC05358.JPG](/proxy/?url=https://content.instructables.com/FT3/CWXZ/HSVGJ5OE/FT3CWXZHSVGJ5OE.jpg&filename=DSC05358.JPG)
I used this shield to make LINUS my line following robot which i will upload soon and it worked great. I put it through endurance and it stood up to the challenge although a good heat sink is essential. Thank you for viewing and i hope i effectively communicated my build.
Th schematic is very simple but still if you have issues, double check your connections. Using a multimeter always helps :P
Th schematic is very simple but still if you have issues, double check your connections. Using a multimeter always helps :P