Go Down

Topic: Arduino UNO + Tamiya twin gearbox + 298 H bridge. Please help. (Read 3683 times) previous topic - next topic

biotech

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!




AWOL

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

biotech

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.

DuaneB

#3
Nov 13, 2012, 04:59 pm Last Edit: Nov 13, 2012, 05:02 pm by DuaneB Reason: 1
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
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

biotech

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 don`t understand why these motors in particular don`t work at all.

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


DuaneB

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
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

oric_dan

#6
Nov 13, 2012, 08:41 pm Last Edit: Nov 13, 2012, 08:42 pm by oric_dan(333) Reason: 1
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.

biotech

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.


biotech

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: http://goo.gl/kJ8Gl
*/

#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.

oric_dan

Quote
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.

biotech

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





oric_dan

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.

cr0sh


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


Are you sure? See this version of the datasheet:

http://www.sparkfun.com/datasheets/Robotics/L298_H_Bridge.pdf

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:

http://www.pololu.com/docs/0J11/2

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:

http://www.pololu.com/catalog/product/77

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

http://www.pololu.com/catalog/product/1117

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...
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

oric_dan

Quote
http://www.pololu.com/docs/0J11/2


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




zoomkat

Quote
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. 
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

Go Up