Bipolar Stepper Motor: Current Limit or Not!

Go To Last Post
23 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I plan on using an ATmega168PB to drive a bipolar stepper motor for a watch winder project. I've read dozens of articles online and tutorials, but I'm still uncertain about one thing. Do I need to control/limit the current through the coils?

 

In some articles, there's no mention of controlling the current; just hook her up to a H-bridge and drive it with the correct sequence. I do notice that some stepper motors list a voltage and current and/or resistance and others list just a current. So, I'm thinking that the ones that list a voltage don't need current limiting and the ones that list only current need current limiting.

 

In other articles/datasheets, there say to hook up the coils through a current limiting circuit such as a chopper.

 

So, I'm very confused. Do I need to monitor and limit the current or not? I would love to just hook the motor up with a simple MOSFET H-bridge, but I don't want to burn out the coils on the first power-up. So, I might want to use some IC's like the L298.

 

Can someone shed some light on this?

 

Thanks!

Last Edited: Mon. Feb 19, 2018 - 11:07 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In essence, the motor coils have a reactance and a resistance. If the motor stands still, only the resistance is important. The coil can dissipate a certain amount of heat at a certain temperature. The amount of heat generated can simply be calculated with Ohm's law.
But as soon as the motor turns, the coils need to be turn on and off. Then, the reactance, which is of inductive nature in a coil, becomes relevant. The faster a motor turns, the faster the coils need to be switched.
The motor's torque is now dictated by the strength of the magnetic field, which in turn depends on the current.

Now when you switch on a coil, the current builds up only gradually. The speed with which it builds up depend on the inductance of the coil and the voltage at the terminals.

So when the motor turns fast, the current can not build up fully until the power is switch off again. This means that the torque decreases with speed.
What can be done to counteract this is to use constant current sources for the coils. These can deliver much higher voltages that would be normally acceptable for the motor.

Now when the coils are switched on, they see a high voltage so the current builds up faster. Once the limit is reached, the voltage is regulated to just the right level to maintain that current until the coils are switch off again.

This meas that torque is almost constant over a wide speed range. You must limit the current when you go with a higher voltage because when the motor stands still, it would burn out as current also is higher than normal then.

 

So the short answer is no, you don't have to limit the current if you limit the voltage instead. If you want to get maximum performance however, you should use a higher voltage and current limiting.
 

"Some people die at 25 and aren't buried until 75." -Benjamin Franklin

 

What is life's greatest illusion?"  "Innocence, my brother." -Skyrim

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks. That makes sense. So, I'll look to run the motor at a higher voltage and current limit it. 

 

Of course, for my application speed is not important. I plan on turning the motor at about 10 sec/rev or about 6 RPM since mechanical watches are meant to be wound on the wrist while your arm is swinging.

 

I've been researching ways to drive the motor and think I like the L297/L298 ICs or L6506/L298 IC's. I'm not sure I'm 100% on board with the L298 since it uses bipolar transistor with Vce(sat) of a few volts. Seems like a waste of power which can generate a lot of heat. Are there better MOSFET alternatives?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

There’s a number of chips available at low cost. 3d printing has created the need for low cost stepper driver boards - google the likes of drv8825 and others. They can be got for less than a McMeal.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm not sure about the size of the motor you need to wind up a watch.

But there are a lot of pretty small stepper motors on Ali / Ebay and some of them might be small enough to be directly driven from a few AVR pins.

Ali / Ebay is usually short on specs, but what can you expect from a 50ct motor?

Would this suffice for you:

 

2

 

And drivers like L297 / L298 are ancient. If you need a stepper motor driver choose something more modern (and smaller) ... which is also cheaper.

A4988 or the DRV mentioned earlier are much better choices.

 

Some of the modern stepper motor controllers use a high number of micro steps and pulse shaping which make your motor run almost silent.

You might want to invest a bit of money into that if noise is an issue for you.

 

But for low rpm low performance there is no need to drive your stepper from a high voltage.

Unless of course you want to use a Nema 52 size motor.

 

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

Last Edited: Tue. Feb 20, 2018 - 04:09 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

devils4ever wrote:
Thanks. That makes sense. So, I'll look to run the motor at a higher voltage and current limit it. Of course, for my application speed is not important.

I plan on turning the motor at about 10 sec/rev or about 6 RPM since mechanical watches are meant to be wound on the wrist while your arm is swinging.

 

That makes little sense to me. As I said, torque declines with increasing speed. 6 RPM is very slow, so there really is no need to use current mode. Just choose the voltage so that the resulting current is well below the limit and you're good.
If you use a fully integrated driver either way, then you could use the current control feature as it comes basically free. It gives you some added freedom in choosing the supply voltage. But I would set current mode as a definite design goal here.

"Some people die at 25 and aren't buried until 75." -Benjamin Franklin

 

What is life's greatest illusion?"  "Innocence, my brother." -Skyrim

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wow! Thanks for all the responses.

 

Kartman, the DRV8825 looks like a much better alternative to the L298. Thanks for the suggestion. I'll look at it in much more detail.

 

awneal, thanks for the link.

 

Paulvdh, I plan on placing the watch on an a double-ended arm which will be about 2" from the shaft. My watch weighs about 5.2 oz, so I'm thinking I need at least 30-40 oz-in of torque. Since this will be in my bedroom, silence is golden. Low noise would be very desirable. I think a NEMA 17 would suffice.

 

pawi777, I think driving with an IC makes sense, so current limiting is free. 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Stepper motors tend to be the noisiest motors you can get for their size.

As said before, running them from a high voltage with current limiting is only usefull for High Speed applications.

There the high voltage is needed to push all the current through the inductive windings fast enough.

This is also the noisiest.

 

Running them from the lowest voltage you can get away with will make your motor run quieter.

It could be worth putting some big inductors in series with your stepper motor (But then do not use a chopping current regulator).

The inductors resist current change

 

Lately there are some new IC's on the market which are specifially built to make stepper motors run smoother such as TMC2100 TMC2208.

Check out a datasheet of one of these, they have gone through quite some effort to make them quiter:

https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC220x_TMC222x_Datasheet.pdf

The chips themselves are QFN, but from Ali / Ebay they come on handy breakout boards.

The breakout boards for stepper motors are sort of standarized in size. They all (no guarantee) fit on "ramps"

The board below (Inclusive a bunch of stepper motor drivers) fits on an "arduino" and costs < USD10 from Ali / Ebay.

aeProduct.getSubject()

I have not tried the TMC drivers myself and don't know if they will be able to reach your golden silence.

I think it's very cool to make something run with motors and then just not being able to hear it even if you put your ear close to it.

A BLDC motor (with good driver) is a better choice for silent operation.

 

===================

Sudden epiphany:

Your best bet is probably to not use a uC / stepper driver at all.

The Ideal way to run a stepper motor is by 2 sine waves with an 90 degree phase shift.

You can run them directly from an AC transformer with a big capacitor in series with one winding.

Maybe put an inductor in series with the other winding to get closer to a 90 degree offset, but that's not critical.

Mains transformers do not deliver clean sine waves and have quite some distortion, which you might hear.

 

===================

Yet another option is to run it from a function generator and two small audio amplifiers.

A PCB with a TDA2030 costs about USD 0.70 from Ali / Ebay.

Add a wien bridge oscillator and some phase shifting with opamps and you have 2 perfect sine waves with 90 degree offset.

 

===================

Sorry for the lengthy posts, my fingers slipped on the keyboard (again :).

 

 

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One can actually use a stepper motor as a speaker. Check out this dude's channel, he's a genius: https://www.youtube.com/watch?v=...

"Some people die at 25 and aren't buried until 75." -Benjamin Franklin

 

What is life's greatest illusion?"  "Innocence, my brother." -Skyrim

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Paulvdh, thanks. I'll check them out.

 

But, looking at the DRV8825 IC, it seems to do what you're saying. It has a 1/32 mode that drives the 2 coils with a sine wave to get a smooth action. Given my low speed requirements, I think I would have no problem driving this IC in this mode.

 

In my case, 6 RPM/60 = 0.1 rev/sec. If I use a motor that's 200 steps per revolution (SPR). That's 0.1 rev/sec * 200 steps/rev = 20 steps/sec = 50 ms/step. For 1/32 mode, that's still only 640 steps/sec or 1.5625 ms/step. Easily achievable with a uC.

 

Equations: Steps/sec = SPR*(RPM/60) or Sec/step = 60/(RPM*SPR)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, I've completed my preliminary design. If I may impose, can someone do a quick check on this to see if I missed anything obvious? Thanks! Also, what is the difference between fast, slow, and mixed decay? Which one do I want?

 

Attachment(s): 

Last Edited: Sat. Mar 3, 2018 - 01:29 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Individual 0.1uF caps are required on each Vcc/gnd pairs.

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would recommend not connecting AREF to VCC. And (even if not using the analog components), add a cap between AREF and GND.

David

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DRV8825 uses pwm, as most stepper motor drivers do to regulate the current.

The inductance of the motor winding acts as a low pass filter for the current.

If the current needs to increase then the H-bridge creates a path From Vcc to GND through a motor winding.

 

If the current needs to decrease there are 2 options:

With "slow decay" the winding is shorted to itself (By either opening the two top or two bottom fets of the H- bridge. usually the bottom 2 fets)

The inductance of the motor winding will push the current around untill it's energy is dissipated in the Ohmic resistance of the motor winding (and the switches).

 

In "fast decay" the motor current is pushed back into Vcc.

Because the Vcc is connected "backwards" here to the motor the current decreases faster.

This more agressive aproach sometimes makes more noise than the "slow decay" mode.

This might be neccesarry for high rpm of the motor.

 

In the "mixed decay" both techniques are used together.

On the "rising" part of the (approximated sine by mircostepping) slow decay is used, an when it is nessasary to lower the current fast (falling part of the sine wave) then fast decay is used.

 

It is (briefly) expained on page 13 (figure 7) of the datasheet.

http://www.ti.com/lit/ds/symlink/drv8825.pdf

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

Last Edited: Sat. Mar 3, 2018 - 04:50 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, I added another 0.1uF decoupling cap. I disconnected AREF from +5V and added a 0.1uF cap to ground.

 

I've read the description of the different decays modes, but I'm not sure which one I should use. Since I plan on running this very slow, I assume I use slow decay?

 

Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Slow decay is probably what you want.

 

But beware that the thing you are building is "experimental".

One of your spear points is to reduce noise.

The DRV... ones seem to be reasonable at this, bus as I said before, the TMC... series is very likely to be quiter.

Read the datasheet to understand what is needed to make a stepper motor run quiet.

This is a non trivial task.

 

Because your circuit is "experimental" I advise you to keep your options open.

Use jumpers, or solder bridge pads on your pcb so you can easily switch between slow and fast decay.

Then you can easily compare the (noise and other) performance differences.

Other parameters you want to experiment with are the motor current (Don't just run it at it's maximum current) and power supply voltage for the motor.

 

Another part of keeping the noise down is purely mechanical.

Mounting the stepper motor to something hard wil make it act as a sound board and ampify the stepper motor's noise.

There are vibration dampers for stepper motors:

https://www.aliexpress.com/wholesale?SearchText=stepper+damper

 

As an alternative you can glue the stepper motor with a thick layer of someting elastic such as silicone chaulk or do something with rubber from a bicycle inner tube.

A heavy inertia disk will transform any vibration of the stepper motor to much lower and less audible frequencies.

An inertia disk can be a valuable addon to a stepper motor system.

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Paulvdh,

 

Thanks for the detailed explanation. I have a 3 position header for the DECAY pin so I can set it to any mode. So, I can try all three, I'm thinking SLOW may be the best.

 

Also, for the current limit, I have a pot so I can adjust the value. I have a NEMA 17, 2 Amp motor but was hoping to run it a much lower current to reduce heat and noise.

 

I never thought about the box. I'm an amateur woodworker and was planning on making a nice wood case for it. Never thought about the case acting like a sound board. Good point.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wrote some basic code in AS and realized I need to use two 16-bit timers for better resolution. So, I'm switching to an ATMEGA328PB part instead.

 

I'm not sure if this is the right forum, but I think I found an error in the datasheet. Maybe, this should be moved to the megaAVR forum?

 

In any case, I'm trying to hook up the serial programming lines to my 6-pin header. MOSI, MISO, SCK and RESETn. There are 2 on this device labeled "0" and "1". So, I assume it's the one labeled "0". To confirm, I look at the MEMPROG section of the datasheet (section 32) under Serial Programming. Figure 32.6 shoes the following mapping: MOSI==PB5, MISO==PB6, SCK==PB7. Then, I look below at Table 32.15 and see: MOSI==PB3, MISO==PB4, SCK==PB5. 

 

I believe the table to be correct since that's the way they are labeled in section 6 under Table 6-1. PB3==MOSI0, PB4==MISO0, PB5==SCK0.

 

Can anyone confirm this is correct? Is there an error in the datasheet?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The ISP header on the 328PB xplained mini connects to PB3-PB5. I believe Figure32.6 is just an error cut/paste from another datasheet...

David

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, here's my updated schematics. Please give it a quick review for obvious errors. THANKS!

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Read post#13

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My project is a success! I used KiCad tools for the PCB and OshPark to fab my board. Here is a photo of the finished, populated board running my software and the bare board.