Arduino UNO + Tamiya twin gearbox + 298 H bridge. Please help.

Hi guys,

I am trying to control a 3.3 volts Tamiya twin gearbox by using an L298 H bridge connected to the Arduino UNO. All the electronics seem ok as other motors I have tried run without problems. But in the case of the Tamiya gearbox the motors don't even move. Can it be the problem that the L298 can´t control 3.3 volts motors?

Please leave any commets to help me on this. Thanks!

What is the power supply for the motors?

Regarding the power supply for the motors so far I have tried 5 volts so it`s a bit more than the 3.3 volts advised for this motors. When I supply 5 volts directly to the motors they run well. However, when I supply the 5 volts through the H Bridge they don't move at all.

Thanks.

You should be using a sepqrqte power supply for the h bridge, you are not trying to run it from the arduino 5v pin are you ?

If so this isnt going to work. Check the two links related to servos in my signature below for a demonstration of the problem and the solution.

The link relates to servos, but its the aame concept, the arduino is great for control signals, but cannot power servos, motors, speakers etc the solution is to have a separate power circuit which cqn be as simple as a few batteries.

Duane B

I use two separated 5 volts power supply: one for the Arduino (from the computer) and other for the Tamiya motors (3 AA batteries).

As I followed the datasheet and other motors run well, I dont understand why these motors in particular dont work at all.

Thanks for the links. I will have a look at them later on during the day.

The only other suggestion is to make sure you have a common ground between arduino and 298.

The motors do turn if you power them directly with one or two AAs dont they ?

Duane B

Did you build your own h-bridge ckt, or is it a commercial board?

Did you read the datasheet on the L298 'before' starting to play with it?

Those devices have certain requirements for minimum logic and motor-input voltages. Also, because
they are linear analog devices [BJTs, and not MOSFETs], there is a 1-1.5V loss of voltage between the
battery input and the motor output.

Also, for reference, the Tamiya twin gearbox motors don't draw a lot of current, and can be run off
of 754410 and L293 chips = 16pin DIP.

My H bridge is a commercial board. And yes, I did read the L298 datasheet.

A understand that there is a 1-1.5V loss of voltage. The 3.3 volts Tamiya motors however should work well even in that case as there is a 5 vots input from the batteries. That´s why I am so puzzled about these motors not moving at all.

So far even with all the valuable help I couldn´t get this sorted.

Just in case, this is the code I am using to run the two motors and read an ultrasonic sensor:

/*
HC-SR04 Ping distance sensor]
VCC to arduino 5v GND to arduino GND
Echo to Arduino pin 13 Trig to Arduino pin 12
More info at: TrollMaker.com is for sale | HugeDomains
*/

#define trigPin 12
#define echoPin 13
int ENA=5;//connected to Arduino's port 5(output pwm)
int IN1=2;//connected to Arduino's port 2
int IN2=3;//connected to Arduino's port 3
int ENB=6;//connected to Arduino's port 6(output pwm)
int IN3=4;//connected to Arduino's port 4
int IN4=7;//connected to Arduino's port 7

void setup() {
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(ENA,OUTPUT);//output
pinMode(ENB,OUTPUT);
pinMode(IN1,OUTPUT);
pinMode(IN2,OUTPUT);
pinMode(IN3,OUTPUT);
pinMode(IN4,OUTPUT);
digitalWrite(ENA,LOW);
digitalWrite(ENB,LOW);//stop driving
}

void loop() {
int duration, distance;
digitalWrite(trigPin, HIGH);
delayMicroseconds(1000);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
if (distance >= 20 || distance <= 0){
Serial.println("Out of range");
analogWrite(ENA,255);//start driving motorA
analogWrite(ENB,255);//start driving motorB
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);//setting motorA's directon
digitalWrite(IN3,HIGH);
digitalWrite(IN4,LOW);//setting motorB's directon
}
else {
Serial.print(distance);
Serial.println(" cm");
analogWrite(ENA,255);//start driving motorA
analogWrite(ENB,255);//start driving motorB
digitalWrite(IN1,HIGH);
digitalWrite(IN2,LOW);//setting motorA's directon
digitalWrite(IN3,LOW);
digitalWrite(IN4,HIGH);//setting motorB's directon
}
delay(500);
}

It all work as expected when I use other motors but it doesn´t with the tamiya gearbox.

It all work as expected when I use other motors but it doesn´t with the tamiya gearbox.

Strange it works with other motors. The Tamiya's are toy motors, and such as those usually take higher
PWM duty values before they start turning, but you seem to have that covered with

analogWrite(ENA,255);//start driving motorA

[BTW, you should use the '#' button to wrap your code].

Care to give a link for the h-bridge board.

I agree with you oric_dan(333). It seems to me very strange in fact that other motors work but the Tamiya don´t. And I really need those Tamiya motors for my present project.

I coudn´t find any info from my local supplier nor a datasheet for my H bridge board. But this is a link I found that shows exactly the board I´m using now:

http://www.aliexpress.com/item-img/2xL298N-Stepper-Motor-Driver-Board-Modules-Dual-H-Bridge-Stepper-Motor-Robot/678198447.html

Dealing with stuff bought cut-rate from China is really beginning to be an enormous PITN.
No direct websites, no support, no documentation, no schematics. Do you have any of these?

What I might try is measuring the voltages coming out of the 2 h-bridge motor terminals, or if
not having a DMM, connect the Tamiya motor from each motor output to ground to check for
live pins [ie pull one wire off the motor out and touch to ground]. You can power motors that way.

biotech:
My H bridge is a commercial board. And yes, I did read the L298 datasheet.

Are you sure? See this version of the datasheet:

See page 3 - Electrical Characteristics (table).

Note what the minimum value for Vs (Supply Voltage - ie, what powers the motors) can be? Minimum is VIH+2.5; now look at what VIH can be (a few lines down): 2.3 volts to VSS (logic supply voltage).

That means - if you are working with the Arduino's 5V TTL logic signals - VIH will be 5 volts; so what is the minimum supply voltage (Vs) you can switch?

7.5 volts (VIH + 2.5 volts)

So - you now have a problem: You can run 7.5 volts into the h-bridge, minus the approximate 1.5 - 2.0 volt drop - leaving you with about 6 volts for the motor. This is bad:

As you can see from that, running these toy motors at well above their voltage rating reduces their life dramatically. So what can you do?

Well - you can try to find another h-bridge. Or - you can replace the motors when they die:

Or...you could replace them with equivalent physical size 6 volt motors, like these:

Of course - that brings up another possible issue, but it may or may not be any big deal: That motor is more powerful than the original motor used in the gearbox, so be aware that you'll be "overdriving" the gearbox now, and you could strip the gears or such should your wheels stall or something...

Pololu - 2. Initial Results: Motors Running at 7.2 and 6 V

Good info. I hadn't realized they're now selling those gearboxes with such low-voltage motors,
and I would definitely substitute in the higher voltage ones. The gearbox I have uses the higher
voltage ones. They're just cheapo toy motors to start with, so I'm sure it pays to go with the
better ones.

http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_358248_-1

http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_2114546_-1

http://www.jameco.com/webapp/wcs/stores/servlet/StoreCatalogDrillDownView?langId=-1&storeId=10001&catalogId=10001&refineType=String&sub_attr_name=Manufacturer&refineValue=TAMIYA AMERICA&from=mflisting

Well - you can try to find another h-bridge. Or - you can replace the motors when they die:

Well, I'd go cheap and put sufficiently large reverse paired diodes on the motor leads to drop the voltage to the motors by ~.7v per diode pair. Not efficient, but could resolve the over voltage to the motor issues with just a stop by radio shack.

I finally got the 3.3v Tamiya gearbox working well. Not with that H bridge board though. I got a new one that works also under the L298 chip.

So now I know that the chip can handle 3.3 volts motors without any problems. Therefore the problem was with something else on the board (I don´t know what it was).

Thanks to you all for the help!