Let's Make Robots!

Using Arduino and L298N to control Tamiya Twin Motor Gearbox

I've connected the L298N to one of the motors of the Tamiya Twin Gearbox as per the circuit diagram in the L298N data sheet. But when I set pin 10 and pin 12 to go forward or reverse, nothing happens. The voltage at pin 13 and pin 14 seems to be equal to each other regardless of what I set for pin 10 and pin 12 (with the enable pin on high). This is the Arduino code I have. The diodes I am using are IN4007. I've also tried it with the other H-Bridge and I get the same result. I'm powering the L298N (Vss) through the Arduino 5V output and the motor (Vs) through 4 Ni-MH 1.2V batteries in series. Does anyone know what I am doing wrong?


int pin_11 = 2;
int pin_12 = 3;
int pin_10 = 4;

void setup()
  pinMode(pin_11, OUTPUT);
  pinMode(pin_12, OUTPUT);
  pinMode(pin_10, OUTPUT);

void loop()
  digitalWrite(pin_11, HIGH);
  digitalWrite(pin_10, HIGH);
  digitalWrite(pin_12, LOW);






Comment viewing options

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

hi. i'm having trouble with this. i have the exact same problem as jchang. have connected pin 1,8,and 15 to ground but still no response. hoping you guys can help me. perhaps its a problem with the wiring. would appreciate if anyone could help. im just starting out in these electronic stuff (:

sorry its a bit messy




white wires are connected to 5v and gnd on arduino, brown wires are connected to pin 2,3,and 4 exactly like the program code jchang posted.

Are you connected to digital pins 2,3,4 or analog 2,3,4?
I'm using the digital pins on the Arduino. But for testing purposes right now I'm connecting the pins from the motor driver directly to Vss on the breadboard.

Do you realise that the motor drive circuit and logic circuit have seperate power connections?

Pin 8 is only the ground pin for the logic circuit. Pins 1 and 15 must be connected to ground with or without the sense resistor as these are the motor ground pins.

Pin 9 is the control logic +V.Connect this to your +5V.

Pin 4 is the +V for the motors.


If you do not have all these pins connected properly then nothing will happen. 

Yes thank you very much for pointing that out. I did not know pin 1 and pin 15 must be connected to ground regardless of whether I'm using them. I did not know that they were ground pins for the motors. Thank you!

You named the pins pin_10, pin_11, pin_12, but they are initialised as pins 2,3,4. Where is the L298 connected: at Pins 10,11,12 or 2,3,4?


It appears that pins 2,3,and 4 of the Arduino are being used to drive pins 10,11,and 12 of the L298.
Yes you're right, I didn't see that
Thanks for the quick reply. What is Vih? And how come the motor voltage needs to be 2.5 volts higher? I tried it temporary with a 9V battery and I get the same result. I know the motor is working because when I connect the battery directly to it, it works fine.
From that same Electrical characteristics section of the datasheet, Vih is Voltage input high, when the Arduino send a logical 1 (5 volts) to the input to signal a switch. The Vs probably needs to be higher than that to bias a transistor into it's on state, so that the collector is actually higher than the base voltage trying to switch it. I'd guess anyway. And if your 9 volt is one of those that clips on, it probably doesn't have enough current to drive the motor, so no movement occurs. A 9.6 pack of 8 AA rechargables would be able to delvier enough current, but those little rectangular 9 volts only really deliver double digit millimaps adequately, where your motors probably need on the order of Amps to start up.