Arduino L298 Motor Shield

Written by: admin@makezilla

Picture of Arduino L298 Motor ShieldDSC05348.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

Step 1: Parts

Picture of Parts

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

Step 2: Schematic

Picture of SchematicL298Pinout.JPG

This is the schematic and again credit to Ascas. Pin out for the motor driver is also given

Step 3: Step 1

Picture of Step 1DSC05335.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 4: Step 2

Picture of Step 2DSC05330.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 5: Step 3

Picture of Step 3DSC05347.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 6: Step 4

Picture of Step 4DSC05356.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. 

Step 7: Test it

Picture of Test itDSC05351.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");
}

Step 8: Conclusion

Picture of Conclusion

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

Leave a Reply