Welcome to OpenBuilds Community

Signup today and join in on the fun!

Sign Up

About Motor Control

Discussion in 'Motors' started by kreaturen, Feb 22, 2014.

  1. kreaturen

    kreaturen New Builder

    Hi, I am trying to get to more about the NEMA 17 stepper motor that they sell in the store here. The LDO-42STH47-1684AC specifically. I do not know much about stepper motors, and this is the first time I have tried to operate one.

    I have it connected to an Arduino through a simple motor drive: http://www.ebay.com/itm/Dual-H-Brid...810?pt=LH_DefaultDomain_0&hash=item3a75930dfa. The pcb itself, I do not have a datasheet for, but the driver chip is an L298N which does have proper documention...

    Never mind that. What puzzles me though is that the motor draws a lot of current at low speed and voltage. I know that stepper motors may consume quite a bit, but I thought that depended somewhat on the voltage provided and (load?).

    Right now the motor is not attached to any load. I can get the voltage up to 4.5V and then the motor draws 1.5amps at slow stepping, slightly less for higher rpms. (If I understand correctly, this may be because it takes some time for the coils to fully charge and discharge, causing the current to fluctuate more on higher rpms, simply because the the coils do not have time to fully fill up).
    I thought however that it would draw less current at that voltage. I mean, the motor struggles even moving at less than 3V?


    Edit: I explained my self poorly. What I intended was first to provide the motor with 12V, to see how it performed on that, and then gradually increase towards 20+V if necessary. However none of this has been possible, due to the motors insatiable current consumption.

    My power source can provide 30V and 2A (alternatively 7V and4A). The driver can handle 35V and at least 2A.

    I limited the current to roughly 1.7A due to the motor's current rating (1.68A). I did at the time not know that the code was running the motor in half step mode (which I discovered with the aid of LEDs), thus powering both coils at the same time and therefor would require twice as much power (roughly). However I switched code to run the motor in full step one phase mode instead, and managed then to increase voltage to 8V. At 8V the current reaches its limit, and so I am unable to increase voltage any further...
    Last edited: Feb 27, 2014
  2. Tweakie

    Tweakie OpenBuilds Team Staff Member Builder

    kreaturen likes this.
  3. JustinTime

    JustinTime Veteran Builder

    What do you mean 4.5V? Is that what you input from your power supply? I looked at the board you linked and there is no voltage adjustment on it. The external power should be AT LEAST 12V better yet 24V. If you fed it 3V external, I'm surprised it even moved.

    At any rate, 1.5A is OK for these motors and the driver you linked can take 2A. You should be concern about the amps only if you go over the spec amps. As long as you are not heating the motor, you are OK. That goes for idle and for load runs.
  4. The Dude

    The Dude Veteran Builder

    My NEMA 17's take 2.8A at 12V. I tried lower voltages and currents but the motors wouldn't move sometimes or they were seriously weak. I'd like to throw out 18V at 2A but haven't upgraded my power supply. You might be surprised how much power it takes to drive a nema17
  5. kreaturen

    kreaturen New Builder

    Thank you. That seem quite useful. I've so far just skimmed trough it, and I wonder perhaps if the motor I've got is one of those high torque ones? I.e. that it is useful with "heavy loads" at low speeds? As is, the motor just slips when I start to gain some speed, and produce laud "knocking" sounds at slow speeds. Then again, as I'm unable to rise the voltage above 4.5V for half step and 8V for full step. I don't understand yet why it eats all the current available at such low voltage...
    Last edited: Feb 25, 2014
  6. kreaturen

    kreaturen New Builder

    You and me both. ;) It was my intention to run it with 12V at first and then try 20-24V eventually... I have the drive fed by an adjustable power source that can provide up to 30V and 2A in its current mode. Initially I set it to provide 12V and limited current to roughly 1.7A. I didn't have specs on the driver pcb board at that time, only for the H-bridge chip (L298n) itself, so I didn't want to go higher with the amps. I didn't expect it to hit the current limit so quickly though. But, when the motor started, the current hit the ceiling and the voltage dropped to 4.5V. That was for half stepping, which is what the arduino stepper library runs. I've since written a full step, one phase, code. The voltage now only drop to 8V, but the motor eats all the current.


    I have since read at a vendor webpage that my driver can handle 2A for a single bridge. Since it is a dual bridge, does that mean that the driver could potentially handle 4A in total if I were to run both coils at once?

    The motor moves forward and in reverse in incremental steps (so I believe I have wired it correctly) but only quite slowly. The shaft stop spinning before I can no longer distinguish the steps, it can't keep up. There are some weird knocking sounds (and other weird noises) coming from it, and some mild heating (although nothing unpleasant as far as heating goes).
    Last edited: Feb 25, 2014
  7. Tweakie

    Tweakie OpenBuilds Team Staff Member Builder

    Your stepper motor is 'stalling' -I think (as already said by others) you need to be using a much higher voltage to get reliable performance.

    The general rule of thumb is that the stepper motor manufacturers specification for maximum current should never be exceeded but the manufacturers voltage specification can be exceeded by up to x25 (subject to the voltage limitations of the driver chip, of course).

    If your stepper motor driver will only allow a maximum of 8 Volts then it may be best to look for an alternative driver, perhaps one which will allow 24 Volts (or more).

    Tweakie.
  8. kreaturen

    kreaturen New Builder

    Yes. But as I've said (or tried to anyways...) is that it was my intention to use higher voltage, but that I am unable to do it. My power source can provide as much as 30V, but how can I raise the voltage above 8V, when the motor consumes or slightly exceeds its rated current limit (which is 1.68A I believe..) already at 8V?

    The driver is not the problem. I've since learned that it can supposedly handle 35V (unofficial) and 2A for a single bridge. It's a dual H-bridge, so perhaps combined it can handle 4A in total?
  9. Tweakie

    Tweakie OpenBuilds Team Staff Member Builder

    Sorry, my mistake - I thought you had voltage limitations with your stepper driver not your PSU. :oops:

    Basically you need a PSU which will hold the set voltage whilst providing the required current.
    Perhaps a 24Volts 15Amp PSU (quite cheap on the bay) would fit the bill. ;)

    Tweakie.
  10. JustinTime

    JustinTime Veteran Builder

    While it says 'dual bridge' you still can use only 2A, not 4A.

    Do what Tweakie said and get yourself a 'real' power supply. The one that you have seems like not being able to handle the task.
  11. kreaturen

    kreaturen New Builder

    Alright.
    Alright. But if I get one of those, would not the motor draw more current that it can handle, i.e. overheat and such? What prevents current from exceeding 1.68Amps per phase, if there is so much more available? These things confuses me as I have very little hands on experience...
    Last edited: Feb 25, 2014
  12. kreaturen

    kreaturen New Builder

    I'll start looking for one right away. The PSU I've been using is an adjustable 'lab' PSU that I have borrowed at my collage. Thought it would do the trick at this experimental stage. The collage is unfortunately lacking in expertise at the moment, apparently the only 'electro-guru' we've got is having daddy-leave, so I'm on my own. Appreciate the advise you both have been giving me :)

    About the driver though. Where did you come across that information? I've been looking all over. Are you referring to the L298n in general or this particular pcb-model? Basically I have no official specs on the pcb and I do not know who makes them, but the datasheet for the L298 claim that:

    Io Peak Output Current (each Channel)

    – Non Repetitive (t = 100µs): 3A

    –Repetitive (80% on –20% off; t_on = 10ms): 2.5A

    –DC Operation: 2A

    To me, that looks as if the L298n can handle 4 amps (DC), 2A for each channel, in case I wanted to do half step (which I imagine that I do;)), or run two normal DC-motors from it. Am I wrong?
    Last edited: Feb 25, 2014
  13. JustinTime

    JustinTime Veteran Builder

    2A per channel is correct and that's where it stays, 2A. The channels are not fired, IIRC, at the same time. It's one winding at a time. 2A to one winding and then 2A to the other. They don't get fed at the same time.

    I'm not familiar with the driver you have. In my driver I can set the current that the motor gets. It's not depended on the voltage that I feed the driver. I know it sounds crazy but it works that way.
  14. kreaturen

    kreaturen New Builder


    Well that depends on the mode of operation. Right now I'm running the motor (or trying to, that is...) in full step one phase mode, which only provides power to one coil at a time. 2A is of course sufficient for that. But you can half step too, literally double the number of steps per revolution, but for that you need to power both coils simultaneously, only with a phase shift between the two.
    You can even microstep, but I have no idea how (probably need a fancy driver). Anyhow, if my driver can't handle both channels at the same time, I guess I'll have to make do with full step, but it sure would be nice to have those extra steps. Still not quite sure how you can claim that it can't handle both channels at the same time though... Not to be argumentative (think we've established that I don't know a whole lot about this...), just want to get to the bottom of it before I burn something is all ;)

    Damn, that sounds convenient, I'm jealous. Mine is much more rudimentary; no regulatory features on it except turning logic circuits on/off... That why I'm slightly worried that it'll burn the motor if I hook it up to, lets say the 24V 15Amps PSU. What's to stop it from getting all that juice?
  15. The Dude

    The Dude Veteran Builder

    Dude you can't run a motor with 2 coils on one coil or it will stall, miss steps, jerk, grind, vibrate, etc.
  16. Tweakie

    Tweakie OpenBuilds Team Staff Member Builder

    Hi Kreaturen,


    I, like you, have been unable to find any real data on your stepper driver circuit so it appears that it has a fixed current limit of 2Amps per phase. This, as you have already described, leads to a compatibility problem here as your stepper motors are rated at just 1.6 Amps per phase

    It is the stepper driver (not the PSU) that controls the current applied to the stepper motor and as your driver appears to have no provision for current adjustment I think it would be unwise to drive a 1.6A stepper at 2A as overheating and damage to the motor is almost certain to occur sooner or later so you need to change one or the other in order to have a matching setup.


    Tweakie.
  17. The Dude

    The Dude Veteran Builder

    You can run one bipolar stepper off an L298N. You can control/limit the current by changing the resistor on the current sense pin. This will output 4A total, or 2A to each coil. You have to provide 4 inputs to the board from the arduino and it's a very complicated series of ons and offs if you want to do microstepping. I'm sure the arduino can handle it but if you get the wrong code it won't work very well. You can probably use 2 unipolar motors and PWM but I'm not familiar with that setup on these chips.
    Last edited: Feb 26, 2014
  18. Tweakie

    Tweakie OpenBuilds Team Staff Member Builder

    Probably easier said than done on that particular stepper driver board but maybe worth a try.

    Tweakie.
  19. kreaturen

    kreaturen New Builder

    Umm, I reserve my right to be foreign language impaired. I did not say that, or at least I did not intend to ;)

    I use both coils. Have the driver hooked up to Arduino with four wires that I subsequently send pulses like this:
    A+ 1 0 0 0
    B+ 0 1 0 0
    A- 0 0 1 0
    B- 0 0 0 1

    What I'd like to do eventually, if I get the PSU/driver situation in order, is this:
    A+ 1 1 1 0 0 0 0 0
    B+ 0 0 1 1 1 0 0 0
    A- 0 0 0 0 1 1 1 0
    B- 1 0 0 0 0 0 1 1

    Don't think I'll be reaching for microstepping just yet.

    So if I change those resistors I could limit the driver's output, to lets say 1.6A? I imagine that those resistors are soldered somewhere to the pcb then? Because the pcb doesn't seem to have any sense outputs. How difficult is it to replace those (assuming that I find them)?
    Last edited: Feb 28, 2014
  20. JustinTime

    JustinTime Veteran Builder

    That totally depends on the board you are using. If they are SMD resistors then it will be a bit more complicated. If they are throughhole resistors it may be easier. They biggest problem may be to unsolder/remove them. Maybe paralleling the resistors can be an option too. Makes it unnecessary to remove existing resistor.
  21. kreaturen

    kreaturen New Builder

    Ok, I think I've got more of an idea how to proceed now. The motor already runs smoother after having corrected some issues with the code, but still runs on just 8V.

    Would it be safe (and easiest) to simply use a laptop AC adapter as the PSU? Those things are PSUs in their own right, ain't they? Something like this: http://www.ebay.com/itm/AC-Adapter-...12-Power-Supply-Charger-20V-65W-/301033616904. It gives 20V 3.2Amps, which ought to make a decent match right? It would provide each coil with 1.6A each, so that I could half step and not have to worry about overload.
    Last edited: Feb 26, 2014
  22. The Dude

    The Dude Veteran Builder

    The max rating of your power supply means it will overheat if you draw more current than that. Try it out but keep an eye on the heat. Also, I have about 10 power supplies that say 12V and they ALL put out 15+V. It's really annoying when trying to match voltages but the PSU has bad info printed on them. My suggestion is an old ATX power supply from a defunct computer. They give a rock solid 12V and go as high as 25A.
  23. The Dude

    The Dude Veteran Builder

    Yes. You can download the datasheet for L298N and it will tell you which pin is the current sense(pins 1 and 15) and what to set the resistance to. Then look at your board. I bet your board doesn't have any resistor, thus giving the max current. You could add a trim pot that would allow you to adjust the current over the whole range
  24. kreaturen

    kreaturen New Builder

    You are right. The voltage on those pins are zero. Do you mean that the two pins could share one pot?
  25. The Dude

    The Dude Veteran Builder

    I have no idea... The spec sheet says -1 to 2 V and nothing about the resistance... WTF? Maybe you can make sense of it http://forum.allaboutcircuits.com/showthread.php?t=17915
  26. kreaturen

    kreaturen New Builder

    It seems to me that a resistor on the sensory pins does not reduce the driver's current outputs, but rather enables your microprocessor to sense the current output by measuring the voltage potential across the sense resistor. For instance it could shut the driver off in case currents exceeded a predefined limit. Like a sensor :)

    That would be a useful safety measure, but I still need to find a way to limit my current supply so that I can increase the voltage. I'm still unsure how to do that. I thought an AC adapter would do the trick, but if it can get overloaded too, then I do not know. I can't hook the motor up to a psu that may give as much as 25Amps without knowing how to restrict access to all that Amp :/
    Last edited: Feb 27, 2014
  27. kreaturen

    kreaturen New Builder

    Ok, good to know. So you're saying that power supplies can draw more current than they should also? So I need a psu that can handle more current than I'm gonna use. I guess that makes sense, although now I am truly unsure how to power this thing.
  28. kreaturen

    kreaturen New Builder

    Let me just ask you guys something. Are stepper motors optimal for slow and gradual acceleration, or is it more rapid and precise motion they're used for? The reason I ask is because I really need it to accelerate smoothly, but it struggles so much at slow speeds. Makes an awful lot of noise and vibration. At higher speeds the current drops and supply voltage increases, and it runs much smoother, putting off a nice electric hum. Today, while running it quite fast, I got the voltage up to 15V, and the motor used only about 1A, shared by the two coils. I have it accelerate with an analog stick, but the motor is not happy with slow speeds.
  29. The Dude

    The Dude Veteran Builder

    You can enable microstepping to smooth out the motion. You sacrifice holding torque though. The acceleration is totally programmable on the driver. For 3D printing the fast acceleration is good because they do lots of back and forth motion and it needs to be done quickly for the plastic to fuse. I turned my acceleration way down and it sucked. Took a long time to turn around and go the other way. When I'm cutting, acceleration doesn't matter much because the feed rate is like 10% or less of the machine's max speed.
  30. kreaturen

    kreaturen New Builder

    Hey. I think I've found a solution to my problem, but have yet to try it. I'll try tomorrow. Me and some guys are building a camera tracking device (student project), and that's why we need smooth acceleration. Right now we're controlling the motor and belt drive and a couple of servos on the platform with a PS2 controller, but the motor only handles rapid speed at the moment and so acceleration is a bit rough. The camera rocks like a bubblehead on top of its mount. The load is of course very light, so I think I'll go for microstepping eventually if I only get the rudimentary in order first.

    The solution I thought of though, is to find the right time to cut power to the coils when slow stepping, and not feed it for the entire step-delay. I need to measure the rise time for the current and give the coil just enough to complete the step, but no more. At least I hope that works. Would be more energy efficient too I suppose, producing less heat. It'll be a whole lot of work for nothing if it doesn't work though :)
    Last edited: Mar 4, 2014

Share This Page