Go Down

Topic: help with stepper.. (Read 8766 times) previous topic - next topic

Lucky13_

Hello, Im trying to control a stepper motor from an old epson printer(EM-483 is the model of the stepper). I couldn't  find the datasheet so i've measured the ohm of the coils and i found how to connect it. I connect it with a L298N bridge and i wrote the code above.
Code: [Select]
int motorPin1 = 2;
int motorPin2 = 4;
int motorPin3 = 3;
int motorPin4 = 5;
int delayTime = 0;

void setup() {
 pinMode(motorPin1, OUTPUT);
 pinMode(motorPin2, OUTPUT);
 pinMode(motorPin3, OUTPUT);
 pinMode(motorPin4, OUTPUT);
}

void loop() {
 digitalWrite(motorPin1, HIGH);
 digitalWrite(motorPin2, LOW);
 digitalWrite(motorPin3, LOW);
 digitalWrite(motorPin4, HIGH);
 delay(delayTime);
 digitalWrite(motorPin1, HIGH);
 digitalWrite(motorPin2, HIGH);
 digitalWrite(motorPin3, LOW);
 digitalWrite(motorPin4, LOW);
 delay(delayTime);
 digitalWrite(motorPin1, LOW);
 digitalWrite(motorPin2, HIGH);
 digitalWrite(motorPin3, HIGH);
 digitalWrite(motorPin4, LOW);
 delay(delayTime);
 digitalWrite(motorPin1, LOW);
 digitalWrite(motorPin2, LOW);
 digitalWrite(motorPin3, HIGH);
 digitalWrite(motorPin4, HIGH);
 delay(delayTime);
}


My problem is that i cant control the speed. If a use 0msec delay it's turning but if put a greater value than zero it turns a bit and stop and then again the same and the l298n getting very hot..im trying to solve this problem all day but i couldnt find a solution so any help would be appreciated.

MikMo

Without a schematic showing how you hooked things up, it's almost impossible to give you any advice.

Grumpy_Mike

Quote
and the l298n getting very hot


It might surprise you to know this is nothing to do with your software. It is probably due to you feeding it too much current.

It sounds like it is wired up wrong.

Lucky13_

Ok thanx for the answers im posting the schematic.

andy232005

Apply ohms law to that 12v x 3.8 ohms = 3.15A  That's why its getting hot it's probably a 1.5 - 2 volt stepper you need to use pwm to limit the current to drive it at higher voltages.  

Grumpy_Mike

#5
Sep 22, 2010, 11:23 am Last Edit: Sep 22, 2010, 11:23 am by Grumpy_Mike Reason: 1
Quote
12v x 3.8 ohms = 3.15A


And remember that is just for one coil so in total you are taking 6.3A. Best bet is to feed the L298 with 5V or even smaller.

Quote
you need to use pwm to limit the current to drive it at higher voltages.

This can't really be done with the arduino directly. It is a technique used by stepping motor drive chips as part of a feedback loop to cut off the voltage when the current reaches a certain value.

It is probably this heat that is causing the motor to cut out, the L298 might be going into thermal shut down.

andy232005

Thanks Mike I could of put that a bit better I've done loads of work with stepper motors.

Lucky13_

Thanx for the answers. I still have that problem..i changed the supply to the stepper with 5v from an old pc PSU. Im trying this code now
Code: [Select]
#include <Stepper.h>

#define STEPS 100

Stepper stepper(STEPS, 2, 3, 4, 5);


void setup()
{

 stepper.setSpeed(100);
}

void loop()
{

 stepper.step(100);


}

the motor goes left-right all the time, sometimes it go for some seconds in one direction but later start again to go left-right very fast and as a result of this the bridge gets hot.. Any ideas of whats going on here? :-/

andy232005

the l298n will do 4 amps in total that's 2 amps each phase with a heat sink its okay to run it at half the power without the heat sink else it will get hot and the internal thermal cut out will shut it off. I've ran that code you've posted and it works. try it at 1.5 - 2 volt I'm sure it will be okay have a look at my solid state H-Bridge I made without any current limiting I do have some current limiting chips that I got free from a place in weymouth I could send you one and we could try them together if you like I haven't used them yet here's my vid on you tube. http://www.youtube.com/watch?v=D0u078MTbJ0

Go Up