Let's Make Robots!

DIY L298N shield

Hi guy !

I've recetly build a L298N shield for my arduino based this shematics the shematics.

The only modification that i made is : - my diodes are 1N5821

                                                      - I've not put some pull up resistance on enablepin

                                                      - I use 5V from my arduino and 4,8V batterie for my motors

And when i plud the shield on my arduino and import the code ( see below) the software say:

avrdude: stk500_getsync(): not in sync: resp=0x00

So i try to import the code without put the shield on the arduino and it import correctly but when i plug the shield nothing hapen,the motor dont move.

Someone have an idea ?

sorry for spelling (french )

here is the code :

//-- MOTEUR A --
int ENA=5; //Connecté à Arduino pin 5(sortie pwm)
int IN1=2; //Connecté à Arduino pin 2
int IN2=3; //Connecté à Arduino pin 3

//-- MOTEUR B --
int ENB=6; //Connecté à Arduino pin 6(Sortie pwm)
int IN3=4; //Connecté à Arduino pin 4
int IN4=7; //Connecté à Arduino pin 7

void setup() {
 pinMode(ENA,OUTPUT);//Configurer les broches comme sortie
 digitalWrite(ENA,LOW);// Moteur A - Ne pas tourner (désactivation moteur)
 digitalWrite(ENB,LOW);// Moteur B - Ne pas tourner (désactivation moteur)

 // Direction du Moteur A

 // Direction du Moteur B
 // NB: en sens inverse du moteur A

void loop() {
  // Moteur A - Plein régime

  // Moteur B - Mi-régime

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

And a other thing, I don't have capacitors and voltage regulator on my setup because i use two power sources ( 5V of the arduino and a 9,6V batteri for my motor ).

So do you think that the capacitor are neccesery ?


I post a photo on my setup soon :)

the capacitors are essential.  In addition to the 100nF caps Duane mentioned, you also need a large cap, at least 100 uF but I would recommend about 470 uF or even 1000 uF, to provide large pulses of current.  You need all of them, close to the chip, no matter what power supply configuration you use.

Does the large cap go on the motor supply line only or does the 5V logic supply also need a large cap?

I'm guessing just the motor supply line needs it.

correct.  But it wouldn't hurt on the  5V but shouldn't be necessary

Both power supplies should have a 0.1uF capacitor. Sometimes a circuit will work without a bypass capacitor sometime they don't. Sometimes not having a bypass capacitor will ruin a chip (though not often). Use ceramic capacitors for this. 0.1uF are really cheap if you buy 100 or so at a time.

The datasheet says these capacitors should be connected as close as possible to the L298's ground pin.

I think using the Arduino's 5V for the logic supply (pin 9) should be fine.

So 5V from Arduino is connected to pin 9 of L298, ground of Arduino is connected to pin 8 of L298. The "+" wire of your 9.6V pack is connected to pin 4 of the L298 and the "-" of your 9.6V pack gets connected to pin 8 of L298. The negative wire "-" of the battery pack is often referred to as the ground. So when they say you need a common ground on a circuit if means the ground wires of both power suppllies are connected at some point. I've been told it best to have these two grounds connected in only one location.

I noticed in the datasheet that the enable pins are supposed to be low when the power is connected or disconnected on the L298. This makes me think a 10K resistor connected to both enable and ground would be a good idea.

Do you have a copy of the L298N datasheet? SparkFun has a copy if you need it.

The odd numbered pins are the ones that stick out in front of the chip. As I mentioned previously, the datasheet uses "Vss" to indicate the logic power supply (5V). "Vss" often refers to ground but not in this case. Watch out for this strange notation.

The capacitors are mentioned on page 7 of the datasheet (and a couple other places).

Here is some news,

I try to re build a shield and this time im building the shield step by step and checking at every step.

So i try Duane idea to see if my L298N work correctly and when i plug the power, the motor start spinning but for 1 second.

After this 1 second, the motor stop and keep not moving until i de-plug and re-plug power.

a Idea someone ?

Possibly a capacitor is connected wrong and causing the circuit to quit when it charges up completely.

I would check all the capacitors, especially the large ones, and make sure they are wired correctly.

This is strange. It sounds like either the L298N chip or the voltage regulator is getting too hot and shutting down.

A picture of your set up may help someone identify the problem.

I don't think you need the pull-up resisitors. In fact, I'd be inclined to use pull-down resistors (10K) to make sure the motor doesn't turn on when you don't want it to.

I don't know enough about diodes to help much. I've just read they should be fast acting and I see schottky diodes often recommended.

Here's an inexpensive L298N PCB with all the additonal components already added. These are the kind I've used in my robots.

I think i'm gonna build a second shield with the shematic of my preview post

but do you think my diodes ( 1N5821 ) are too big for my use and if the pull up resictances on the enable pin are neccecery ?

OK i'm gonna test that to see if it work. But iv not understand you says that the ground of the arduino 5V and the 12V motor supply are not connected together ?

Is this shematics good ?

Like that ?

Is the pull up resistance on the enable PIN is neccecery ? Why the value of this resistance vary between different schematics ? Is by the enable pin that we control the speed of the motors ?

Thanks for your help :)