Go Down

Topic: Arduino L298N connection problem explained withpic (Read 8320 times) previous topic - next topic

McLightning

Jul 04, 2010, 08:48 pm Last Edit: Jul 04, 2010, 09:06 pm by mclightning Reason: 1
hi,
i spent hours trying to get arduino working with l298n hbridge chip :'(
now i gave up i need help of yours please help
im trying to get to work a 5v motor with arduino and i want it to control it via arduino
i made all the connections same as explained on internet but it's not working
i took a photo of connection between l298 and arduino here it is:
http://img707.imageshack.us/img707/1567/040720101288.jpg

please help im sure it is so easy for you fellows :/
i couldnt figure out which connection is incorrect as i am a electronics noobie :/
i also wrote some info on photo about which cable connected to where

int moto=2; //input1
int mt=3;//input 2
int a=4;// enable a
void setup() {
pinMode(a,OUTPUT);
pinMode(moto,OUTPUT);
pinMode(mt,OUTPUT);
}
void loop() {
digitalWrite(a,HIGH);
digitalWrite(moto,HIGH);
digitalWrite(mt,LOW);
delay(100);
 digitalWrite(a,HIGH);
digitalWrite(moto,LOW);
digitalWrite(mt,HIGH);
}

McLightning


StevenH

You have your 0v/6v backwards!?

The minimum you need to connect is:

Pin 4 to a voltage supply, this will be either from the Arduino, or another power source.
Pin 8 to GND
Pin 9 to +5v from Arduino
Pin 10, 12 to a digital output each
Pin 11 to an analogue PWM output

Pin 13,14 are your outputs to the motor.

Pin 15 needs to be straight to GND with a very low 5Watt resistor.

Your photo looks very wrong and you could have damaged the L298 already.

McLightning

#3
Jul 05, 2010, 10:06 am Last Edit: Jul 05, 2010, 11:00 am by mclightning Reason: 1
Pin 15 needs to be straight to GND with a very low 5Watt resistor.
what do you mean by a very low 5watt resistor?
what kinda resistor for example?
im really a beginner i dunno much about anything
i just went to electronics shop and they didnt come up with any resistor when i ask for a 5watt resistor
ok i bought 0.5 ohm 5 watt resistor

Grumpy_Mike

Quote
what do you mean by a very low 5watt resistor?


Pin 15 should be connected to the current sensing resistor with the other end to ground. This allows another chip to control the current through the motor and keep it at a safe level. The value of the resistor depends on what current your load is taking and what voltage the other chip takes. The power rating of a resistor is how much energy it can burn without overheating but  to ask for a 5W resistor without a value is meaningless.
But as was pointed out you wired the power up backwards so it's probably fried by now.

McLightning

#5
Jul 05, 2010, 11:23 am Last Edit: Jul 05, 2010, 11:26 am by mclightning Reason: 1
yea it was overheated yesterday
i just bought a new one today
and bought a 0.47ohm 5 watt resistor
as i am a beginner do you think i better take a photo and share it here so you can tell me ok it's work or not
im afraid to burn this new one
thanks for all your helps

by the way is it ok if i connect both 9. ping and 4. pin which is supply voltage to arduino's 5v out

Grumpy_Mike

Quote
as i am a beginner do you think i better take a photo and share it here so you can tell me ok it's work or not

Sounds good.

Quote
by the way is it ok if i connect both 9. ping and 4. pin which is supply voltage to arduino's 5v out

Well pin 9 should be connected to the arduino's supply but pin 4 is for the motor's supply. If you connect it to the arduino you will be pulling the power for the motor through either the arduino's regulator or the USB socket. This is fine if the motor is only drawing a few hundred mA but anything over 300mA should be powered with a separate supply.

Also change:-
delay(100);
to delay(3000);
as a tenth of a second is not long enough to see the motor run.

McLightning

is it ok if these are connected like this:
pin4 and pin9 both to arduino 5v
pin8 and pin15(with resistor) both to arduino gnd

McLightning

thanks for reply i just saw it after writing the reply above

Grumpy_Mike

Quote
pin8 and pin15(with resistor) both to arduino gnd


As I said there is no need for a resistor if you don't have another chip controlling the current. Note also you need to connect pin 1 to ground as well even though you are not using the other side of the bridge.

McLightning

#10
Jul 05, 2010, 12:40 pm Last Edit: Jul 05, 2010, 12:41 pm by mclightning Reason: 1
i got a new l298n chip is that you mean by another chip?
i replaced the old burnt one
or do you mean arduino?

pff am i asking too much :/
im so sorry if i started to be annoying

Grumpy_Mike

Yes the chip is the L298, no need to replace anything else. Get the power round the right way this time.
You have not said how much current your motor takes, this is important for seeing where you power it from.

McLightning

#12
Jul 05, 2010, 02:33 pm Last Edit: Jul 05, 2010, 02:33 pm by mclightning Reason: 1
it's an rc toy car motor not a serious one it was running smoothly with 5v of arduino
here is the connections i made
http://img52.imageshack.us/img52/6655/ardl298.jpg

Grumpy_Mike

#13
Jul 05, 2010, 02:54 pm Last Edit: Jul 05, 2010, 02:57 pm by Grumpy_Mike Reason: 1
Ok on the current. That wiring looks wrong again. You label something Pin 9 to 5V ard and it is not going into pin 9 of the L298. Most other wires don't appear to be going to the right place.

All in all it looks like you are not getting the right wires identified in the L298, look at the data sheet again.

McLightning

isnt it like
14 - 12- 10 - 8 - 6- 4- 2
15-13-11-9-7-5-3-1
as shown on the photo

Go Up