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.
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.
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.
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.
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.
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? :-/
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. Mach3 CNC + Arduino Driving a Discreet H-Bridge - YouTube