Pages: [1] 2   Go Down
Author Topic: L298 H-bridge motor controller  (Read 12164 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,

I seem to have found lots of questions about this topic, around various forums, but no answers that have helped me get things working.

I'm trying to drive a simple DC motor by using a L298 H-bridge (http://www.st.com/stonline/products/literature/ds/1773/l298.pdf) and my Arduino.

I've been following the schematics here, which seem to make sense to me:
http://www.pyroelectro.com/tutorials/l298_control/schematic.html

Yet both my output pins, that go to the motor, always seem to display the same voltage, which is whatever is coming in as my power supply voltage.  This is the same whether I hook up 2 AA batteries to the power supply or try to use Vcc from the Arduino.

Any ideas what I might be doing wrong?

Many thanks,
Josh
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 229
Intransigent prototyper
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey

sounds like a power supply problem.

The L298 needs two supplies: 5V for logic (take from arduino) and something higher for the motor supply.

The specs say that the motor supply needs to be at least 5V or so; 3V from 2xAA batteries is not going to do it. Try connecting 9V or 12V as the motor supply, and double check your wiring too. Avoid using the Arduino 5V supply as motor power, as it can bring noise back to the Arduino, and it's also not rated for much current.
« Last Edit: July 13, 2008, 12:51:38 pm by Daniel2 » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmmm, thanks  for your help.

I've since tried a 9V rechargeable RC-car battery, and still seeing the same behavior.

I've double, and triple checked the wiring, and even tried two different L298 chips, in case of a bad chip.

I'm still confused smiley-sad  Any further advice, or simple suggestions on how to wire this thing up to make sure my H-bridge is functioning properly will be greatly appreciated.

Thanks!
Josh
Logged

Las Vegas, NV
Offline Offline
God Member
*****
Karma: 0
Posts: 507
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you actually providing the proper control signals to the driver?
Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Are you actually providing the proper control signals to the driver?

That there, is a very good question  :-/
I thought it was as simple as providing HIGH to one of the inputs and LOW to the other, but I seem to be beginning to understand that's not the case?
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 296
Got Karma?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you pulling up the enable pin (or setting it HIGH through either digitalWrite/analogWrite if the enable pin on the H-bridge is connected to your arduino)? Unless the enable pin is HIGH there is no current flowing to your output pins.

Also maybe having a common ground between your motor supply and the arduino supply.

That's all I can think of.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Are you pulling up the enable pin (or setting it HIGH through either digitalWrite/analogWrite if the enable pin on the H-bridge is connected to your arduino)? Unless the enable pin is HIGH there is no current flowing to your output pins.

Yup smiley-sad  Enable pin is set to high, reading 4.8V

Quote
Also maybe having a common ground between your motor supply and the arduino supply.

Tried it smiley-sad

Thanks for the help guys... I'll keep poking at this and I'm sure I'll eventually figure it out.   :'(
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 43
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What happens if you disconnect the 298? Are then your output pins acting as expected? Did you set them as outputs on setup?

I do agree it should be quite straightforward circuit.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 639
Posts: 34725
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry if this is too much of an insult but have you connected all the earths on the unit together. These are the points marked with that triangular type symbol and should all be connected to the 0v line. I say this because my students often didn't understand that was what the symbols meant.
Logged

Las Vegas, NV
Offline Offline
God Member
*****
Karma: 0
Posts: 507
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Another consideration is that sometimes motor drivers require a load in order to function properly.  Can you try taking the measurements with a load such as a resistor (or a motor, but this might make the readings slightly noisier) across the driver outputs?  By the way, make sure you choose a resistor or motor that won't demand more current than the driver can safely deliver.

- Ben
Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 25
mostly confused
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi

i've been digging around the forums looking for that puzzling connection between the L298 and arduino, and thought best to pull up an old post rather than start a new one.

i'm using another L298 based driver kit to (hopefully) drive a 12V 2A motor. i know i've made the kit up correctly but haven't yet been able to get the motor to respond.

so far i have:
12V going to the voltage in on the board
pin 2 on the arduino going to en on the board
pin 9 PWM on the arduino going to IP1 on the board
ground from the 12V supply tied to ground on the arduino

i'm doing my testing using maxuino and max/msp and have set pin 2 to high and have tried using both a digital high and PWM from pin 9 - so far without luck.

can anyone point out to me the mistake i'm making or the thing i'm missing out?

cheers
Logged

UK
Offline Offline
God Member
*****
Karma: 0
Posts: 710
Arduino is Genius
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just for giggles, try this:

Wiring:
Arduino           L298
digital pin A -> Input 3
digital pin B -> Input 4
PWM P -> Enable B

Sketch:
setup() {
   pinMode(A, OUTPUT);
   pinMode(B, OUTPUT);
}

loop() {  
   digitalWrite(A, HIGH);
   digitalWrite(B, LOW);
   analogWrite(P, 128);
   delay (500);
}

You can choose A, B, and C, but they must be different, and C must be a PWM pin.

This is the simplest way to debug these type of things that I've found.
As long as the two Input's are different, something should happen.

HTH
GB

WARNING - this code is unVerify'ed and untested
« Last Edit: April 19, 2010, 10:21:48 am by gbulmer » Logged

UK
Offline Offline
God Member
*****
Karma: 0
Posts: 710
Arduino is Genius
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Looked at the datasheet for the L298D, and they recommend
RS1 = RS2 = 0.5 [ch937]
for the sense resistors.

They explicitly say
Quote
1.1. POWER OUTPUT STAGE
The L298 integrates two power output stages (A ; B).
The power output stage is a bridge configuration and its outputs can drive an inductive load in common or differenzial mode, depending on the state of the inputs. The current that flows through the load comes out from the bridge at the sense output : an external resistor (RSA ; RSB.) allows to detect the intensity of this current.

This may be a problem too. What value resistor (if any) is connecting 'Sense' to ground?

HTH
GB
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 25
mostly confused
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hhhmmm... sense resistors. i'm not using any...

this is the driver board - http://bloat.me/tfCD. it has motor power in, power out for two motors, IP x 2 and EN for each motor and regulated 5V out. is it this 5V out which i need to connect back to the ground? doesn't seem to make much sense.

here's a schematic for the board too

Logged

UK
Offline Offline
God Member
*****
Karma: 0
Posts: 710
Arduino is Genius
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

From my reading of the datasheet, I don't believe it needs sense resistors. But if if they're there, they need to be low enough to conduct all the current through the load (motor) to ground without dropping too much voltage (or constraining current).

The http://www.pyroelectro.com/tutorials/l298_control/schematic.html link has a 10 ohm resistor in that ground path.
I was raising the sense resistor to folks attention because it likely makes matters worse, or more confusing.

HTH
GB
Logged

Pages: [1] 2   Go Up
Jump to: