Arduino L298N connection problem explained withpic

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); }

hey fellows i need urgent help please :'( :'(

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.

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

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.

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

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.

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.

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

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

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.

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

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.

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

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.

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

http://www.st.com/stonline/books/pdf/docs/1773.pdf im using this datasheet

No the data sheet shows it as this:-

That is looking at the plastic side. Pin 1 is current sense A and is the first pin that sticks out from the package. So from your overhead view it should be on the lower row at the left hand side.

do you think this one may burn too? if i runned it that way :’( :smiley:
i runned it i couldnt stop myself till i get reply here.
i checked if it getting hot it didnt
i hope this one didnt burnt anyway im gonna try with correct connections this time lets hope it works

int ana=5; int p1=2; int p2=3; void loop() { pinMode(p1,OUTPUT); pinMode(p2,OUTPUT); pinMode(ana,OUTPUT); } void setup() { analogWrite(ana,255); digitalWrite(p1,HIGH); digitalWrite(p2,LOW); delay(3000); analogWrite(ana,255); digitalWrite(p1,LOW); digitalWrite(p2,HIGH); }

if the connections are right this code should make it work right?

this code should make it work right?

No you have loop() and setup() swapped over. It should be:-

nt ana=5;
int p1=2;
int p2=3;

void setup() {
pinMode(p1,OUTPUT);
pinMode(p2,OUTPUT);
pinMode(ana,OUTPUT);
}
void loop() {
analogWrite(ana,255);
digitalWrite(p1,HIGH);
digitalWrite(p2,LOW);
delay(3000);
analogWrite(ana,255);
digitalWrite(p1,LOW);
digitalWrite(p2,HIGH);
}