EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: hlavac on February 21, 2015, 02:48:27 pm

Title: Sensing stepper motor winding currents
Post by: hlavac on February 21, 2015, 02:48:27 pm
I'm thinking about making a little tool for mesuring total current thru a bipolar stepper motor on my 3D printers, as setting current thru potentiometers on the driver boards seems to be very unreliable.

It would plug between the stepper motor and driver board onto the four wires going to the stepper motor.
I guess it would put small current sense resistor in series with each winding, measure the voltages, rectify them and sum the two rectified voltages to get the measure of the total current thru both wingings.
But the devil is in the details and I'm not too experienced in the analog stuff :)

My naive implementation would consist of:
I'm a bit worried about having to use symmetric power supply. Having to use two batteries sucks.
Any good ideas on how to do this? Mybe some interesting components for current sensing?
Title: Re: Sensing stepper motor winding currents
Post by: T3sl4co1l on February 21, 2015, 03:14:50 pm
I should think this would be solvable in the first place based on the driver boards... are they really that bad?  Get better ones, that actually work...  This is all stuff that can be solved in the design phase.  Or, if the driver board / controller datasheet simply doesn't tell you enough to be able to make a solid design... it doesn't get to play in your design.  Simple as that.

I'd suggest a hall effect type sensor, so you don't need all that isolation stuff.  Yes it's possible to resolve a small shunt voltage drop over a high common mode voltage (even one that's rapidly switching), but the less you have to deal with, the better.

Tim
Title: Re: Sensing stepper motor winding currents
Post by: hlavac on February 21, 2015, 03:28:44 pm
I don't design the drivers, they are off the shelf stuff like the Pololu step sticks and compatible variants...

One of the things I'm not sure about is - how to handle ground? I don't have a ground connection to the driver, and all four of the wires are jumping between 0 and 12/24V... My device is floating, does it matter at all? I'm a bit confused... do I pick one of the leads as my ground maybe? Other leads will then jump +/- 30Vish?
Title: Re: Sensing stepper motor winding currents
Post by: zapta on February 21, 2015, 03:50:52 pm
Can't you use a DMM with current measurement capabilities? The current is applied also in steady state.
Title: Re: Sensing stepper motor winding currents
Post by: hlavac on February 21, 2015, 03:55:47 pm
I could, two of them (there are two windings).
Title: Re: Sensing stepper motor winding currents
Post by: RR on February 21, 2015, 04:02:16 pm
Can you measure before H bridge? that will be easier

This might help-
https://www.eevblog.com/forum/projects/high-side-current-sense-circuit-jelly-bean-parts-only/msg577040/#msg577040 (https://www.eevblog.com/forum/projects/high-side-current-sense-circuit-jelly-bean-parts-only/msg577040/#msg577040)
Title: Re: Sensing stepper motor winding currents
Post by: zapta on February 21, 2015, 04:43:28 pm
What problem do you have with your drivers? I am using the rule to adjust up until it doesn't miss steps and then an extra 1/8 of a turn.

Make sure everything moves smoothly with no mechanical obstruction. I had a problem for example with my spool holder that didn't turn smooth and created mechanical load on the x carriage that damaged the driver.
Title: Re: Sensing stepper motor winding currents
Post by: rob77 on February 21, 2015, 04:55:26 pm
Can you measure before H bridge? that will be easier

This might help-
https://www.eevblog.com/forum/projects/high-side-current-sense-circuit-jelly-bean-parts-only/msg577040/#msg577040 (https://www.eevblog.com/forum/projects/high-side-current-sense-circuit-jelly-bean-parts-only/msg577040/#msg577040)

was about to post the link to that thread, but you did the job for me  ;) :-+
Title: Re: Sensing stepper motor winding currents
Post by: hlavac on February 21, 2015, 05:04:41 pm
What problem do you have with your drivers?

The tiny smd trimmers for setting current are flaky, sometimes wipers seem to lose contact, and its hard to get feedback on what the current is (have to measure voltage on the tiny wiper while moving it...)
Title: Re: Sensing stepper motor winding currents
Post by: Richard Crowley on February 21, 2015, 05:08:56 pm
1) Put the current sense shunt in a common node like the power supply or the ground return. No reason to sense the current in each winding separately.
2) You should not need any voltage dividers. A proper shunt will put out millivolts and will require amplification, NOT attenuation.
3) Use a Hall-effect sensor which has very low burden and built-in amplification.  Like Allegro ACS712
https://www.sparkfun.com/products/8882 (https://www.sparkfun.com/products/8882)
Title: Re: Sensing stepper motor winding currents
Post by: hlavac on February 21, 2015, 05:24:21 pm
My interface to the circuit is just the motor wires. I'd have to pull out the driver module and put something in between it and the RAMPS board to measure on the low side.

Millivolts across the shunt, but the shut is floating high in the sky as either end of it is connected to the driver voltage by the H-bridge at different times :)
Opamps usually require input voltages to stay between the opamp power rails or they malfuction.

Anyway, I made a  crazy simulation in Falstad's circuit simulator (http://www.falstad.com/circuit/#%24+1+1.0E-8+3.452441195350251+50+5.0+50%0Av+48+384+48+288+0+2+50000.0+24.0+0.0+0.0+0.5%0Av+48+192+112+192+0+3+10000.0+5.0+0.0+1.5707963267948966+0.5%0Ar+48+288+112+288+0+12.0%0Ar+112+192+112+288+0+0.1%0Av+48+384+112+384+0+1+100000.0+5.0+0.0+0.0+0.5%0Ar+48+480+112+480+0+12.0%0Ar+112+384+112+480+0+0.1%0Ad+128+544+128+512+1+0.805904783%0Ag+128+544+128+560+0%0Aw+160+288+160+512+0%0Ad+144+544+144+512+1+0.805904783%0Ag+144+544+144+560+0%0Aw+144+384+208+384+0%0Ad+160+544+160+512+1+0.805904783%0Ag+160+544+160+560+0%0Aw+176+192+176+512+0%0Ad+176+544+176+512+1+0.805904783%0Ag+176+544+176+560+0%0Aw+48+480+48+384+0%0Aw+160+288+208+288+0%0Aw+176+192+208+192+0%0Ar+272+576+272+528+0+12000.0%0Ar+304+576+304+528+0+12000.0%0Ar+336+576+336+528+0+12000.0%0Ar+368+576+368+528+0+12000.0%0Ar+208+480+272+480+0+100000.0%0Ar+208+384+272+384+0+100000.0%0Ar+208+288+272+288+0+100000.0%0Ar+208+192+272+192+0+100000.0%0Ag+272+576+272+592+0%0Ag+304+576+304+592+0%0Ag+336+576+336+592+0%0Ag+368+576+368+592+0%0Aw+272+528+272+480+0%0Aw+304+528+304+384+0%0Aw+272+384+304+384+0%0Aw+336+528+336+288+0%0Aw+336+288+272+288+0%0Aw+368+528+368+192+0%0Aw+368+192+272+192+0%0Aw+368+192+400+192+0%0Aw+336+288+400+288+0%0Aw+304+384+400+384+0%0Aw+272+480+400+480+0%0Aw+112+480+128+480+0%0Aw+144+384+144+512+0%0Aw+112+384+144+384+0%0Aw+112+288+160+288+0%0Aw+112+192+176+192+0%0Aw+208+480+128+480+0%0Aa+400+464+512+464+0+6.5+-1.0+1000000.0%0Aw+512+464+512+416+0%0Aw+512+416+400+416+0%0Aw+400+416+400+448+0%0Aw+48+288+48+192+0%0Aa+400+368+512+368+0+6.5+-1.0+1000000.0%0Aw+512+368+512+320+0%0Aw+512+320+400+320+0%0Aw+400+320+400+352+0%0Aa+400+272+512+272+0+6.5+-1.0+1000000.0%0Aw+512+272+512+224+0%0Aw+512+224+400+224+0%0Aw+400+224+400+256+0%0Aa+400+176+512+176+0+6.5+-1.0+1000000.0%0Aw+512+176+512+128+0%0Aw+512+128+400+128+0%0Aw+400+128+400+160+0%0Aa+576+192+688+192+0+6.5+-1.0+1000000.0%0Ar+512+176+576+176+0+1000.0%0Ar+576+128+688+128+0+100000.0%0Aw+688+192+688+128+0%0Aw+576+176+576+128+0%0Aw+512+224+512+208+0%0Ar+512+208+576+208+0+1000.0%0Ar+576+256+672+256+0+100000.0%0Ag+672+256+672+272+0%0Aw+576+208+576+256+0%0Aw+688+192+720+192+0%0Aw+576+400+576+448+0%0Ag+672+448+672+464+0%0Ar+576+448+672+448+0+100000.0%0Ar+512+400+576+400+0+1000.0%0Aw+576+368+576+320+0%0Aw+704+384+704+320+0%0Ar+576+320+704+320+0+100000.0%0Ar+512+368+576+368+0+1000.0%0Aa+576+384+704+384+0+6.5+-1.0+1000000.0%0Aw+512+416+512+400+0%0Aa+784+144+848+144+0+6.5+-1.0+1000000.0%0Aw+720+192+720+128+0%0Ar+720+128+784+128+0+100000.0%0Aw+784+128+784+96+0%0Ad+848+144+880+144+1+0.805904783%0Aw+784+96+816+96+0%0Ad+816+96+848+96+1+0.805904783%0Aw+848+96+848+144+0%0Aw+880+144+880+64+0%0Ar+880+64+784+64+0+100000.0%0Aw+784+64+784+96+0%0Ag+784+160+768+160+0%0Aw+880+144+896+144+0%0Aw+880+288+896+288+0%0Ag+784+304+768+304+0%0Aw+784+208+784+240+0%0Ar+880+208+784+208+0+100000.0%0Aw+880+288+880+208+0%0Aw+848+240+848+288+0%0Aw+784+240+816+240+0%0Aw+784+272+784+240+0%0Ar+720+272+784+272+0+100000.0%0Aa+784+288+848+288+0+6.5+-1.0+1000000.0%0Ad+848+240+816+240+1+0.805904783%0Ad+880+288+848+288+1+0.805904783%0Aw+720+272+720+192+0%0Aa+944+304+1008+304+0+6.5+-1.0+1000000.0%0Ar+896+288+944+288+0+100000.0%0Ar+944+256+1008+256+0+100000.0%0Aw+944+288+944+256+0%0Aw+1008+304+1008+256+0%0Ag+944+320+928+320+0%0Aa+896+128+960+128+0+6.5+-1.0+1000000.0%0Aw+1072+176+1072+304+0%0Aw+960+128+960+80+0%0Aw+960+80+896+80+0%0Aw+896+80+896+112+0%0Aa+1008+112+1072+112+0+6.5+-1.0+1000000.0%0Ar+960+128+1008+128+0+100000.0%0Aw+1072+112+1072+64+0%0Aw+1008+64+1008+96+0%0Aw+1072+112+1088+112+0%0Aw+928+352+928+384+0%0Aw+992+352+928+352+0%0Aw+992+400+992+352+0%0Aw+1072+464+1072+576+0%0Aa+928+400+992+400+0+6.5+-1.0+1000000.0%0Aw+1040+576+1072+576+0%0Ag+976+592+960+592+0%0Aw+1040+576+1040+528+0%0Aw+976+560+976+528+0%0Ar+976+528+1040+528+0+100000.0%0Ar+928+560+976+560+0+100000.0%0Aa+976+576+1040+576+0+6.5+-1.0+1000000.0%0Aw+752+544+752+464+0%0Ad+912+560+880+560+1+0.805904783%0Ad+880+512+848+512+1+0.805904783%0Aa+816+560+880+560+0+6.5+-1.0+1000000.0%0Ar+752+544+816+544+0+100000.0%0Aw+816+544+816+512+0%0Aw+816+512+848+512+0%0Aw+880+512+880+560+0%0Aw+912+560+912+480+0%0Ar+912+480+816+480+0+100000.0%0Aw+816+480+816+512+0%0Ag+816+576+800+576+0%0Aw+912+560+928+560+0%0Aw+912+416+928+416+0%0Ag+816+432+800+432+0%0Aw+816+336+816+368+0%0Ar+912+336+816+336+0+100000.0%0Aw+912+416+912+336+0%0Aw+880+368+880+416+0%0Ad+848+368+880+368+1+0.805904783%0Aw+816+368+848+368+0%0Ad+880+416+912+416+1+0.805904783%0Aw+816+400+816+368+0%0Ar+752+400+816+400+0+100000.0%0Aw+752+464+752+400+0%0Aa+816+416+880+416+0+6.5+-1.0+1000000.0%0Aw+704+464+752+464+0%0Aw+704+384+704+464+0%0Aw+1008+128+1008+176+0%0Aw+1008+176+1072+176+0%0Ar+1008+304+1072+304+0+100000.0%0Ar+992+400+1072+400+0+100000.0%0Aw+1072+400+1072+304+0%0Ar+1072+464+1072+400+0+100000.0%0Ar+1008+64+1072+64+0+100000.0%0Ar+1008+64+1008+16+0+5600.0%0Ag+1008+16+976+16+0%0Ac+1008+176+1008+208+0+2.2E-10+0.085294009527176%0Ag+1008+208+1008+224+0%0Ar+1008+176+960+176+0+25000.0%0Ag+960+176+960+208+0%0Ax+60+242+103+245+0+12+Sense1%0Ax+62+434+105+437+0+12+Sense2%0Aw+128+512+128+480+0%0Ax+116+601+181+604+0+12+LOL+ground%0Ax+208+165+358+168+0+12+Input+voltage+range+dividers%0Ax+470+83+591+86+0+12+Instrumentation+amps%0Ax+853+22+905+25+0+12+Rectifiers%0Ax+1030+25+1176+28+0+12+Output+adder+and+amplifier%0AO+1088+112+1104+112+0%0Ax+1083+141+1125+144+0+12+To+ADC%0Ao+129+64+0+34+5.0+9.765625E-5+0+-1%0A) that seems to work ;)
Title: Re: Sensing stepper motor winding currents
Post by: langwadt on February 21, 2015, 05:34:05 pm
What problem do you have with your drivers? I am using the rule to adjust up until it doesn't miss steps and then an extra 1/8 of a turn.

that'll work for wimpy drivers and big steppers, setting the current higher that the stepper is rated will just cook it.

I don't  see the big problem, look at the datasheet and the current senses resistor, use voltmeter to set the reference voltage
Title: Re: Sensing stepper motor winding currents
Post by: rob77 on February 21, 2015, 06:56:13 pm

Millivolts across the shunt, but the shut is floating high in the sky as either end of it is connected to the driver voltage by the H-bridge at different times :)
Opamps usually require input voltages to stay between the opamp power rails or they malfuction.



exactly that's solved here:

Can you measure before H bridge? that will be easier

This might help-
https://www.eevblog.com/forum/projects/high-side-current-sense-circuit-jelly-bean-parts-only/msg577040/#msg577040 (https://www.eevblog.com/forum/projects/high-side-current-sense-circuit-jelly-bean-parts-only/msg577040/#msg577040)

you just have to sense the current before the H_bridge (stepper controller module), it's worth of cutting a trace and use the circuit ;) (instead of trying to sense at the motor wires)
Title: Re: Sensing stepper motor winding currents
Post by: zapta on February 21, 2015, 07:52:51 pm
What problem do you have with your drivers?

The tiny smd trimmers for setting current are flaky, sometimes wipers seem to lose contact, and its hard to get feedback on what the current is (have to measure voltage on the tiny wiper while moving it...)

Try better quality drivers then. For example, the Pololu Black Edition. They also have better heat dissipation due to the additional two layers.
Title: Re: Sensing stepper motor winding currents
Post by: langwadt on February 21, 2015, 09:02:12 pm

Millivolts across the shunt, but the shut is floating high in the sky as either end of it is connected to the driver voltage by the H-bridge at different times :)
Opamps usually require input voltages to stay between the opamp power rails or they malfuction.



exactly that's solved here:

Can you measure before H bridge? that will be easier

This might help-
https://www.eevblog.com/forum/projects/high-side-current-sense-circuit-jelly-bean-parts-only/msg577040/#msg577040 (https://www.eevblog.com/forum/projects/high-side-current-sense-circuit-jelly-bean-parts-only/msg577040/#msg577040)

you just have to sense the current before the H_bridge (stepper controller module), it's worth of cutting a trace and use the circuit ;) (instead of trying to sense at the motor wires)

you can't just measure the supply current, anything but the most primitive stepper driver is basically a switch mode converter , so the supply current is much less than
the motor current


Title: Re: Sensing stepper motor winding currents
Post by: rob77 on February 21, 2015, 09:19:57 pm

Millivolts across the shunt, but the shut is floating high in the sky as either end of it is connected to the driver voltage by the H-bridge at different times :)
Opamps usually require input voltages to stay between the opamp power rails or they malfuction.



exactly that's solved here:

Can you measure before H bridge? that will be easier

This might help-
https://www.eevblog.com/forum/projects/high-side-current-sense-circuit-jelly-bean-parts-only/msg577040/#msg577040 (https://www.eevblog.com/forum/projects/high-side-current-sense-circuit-jelly-bean-parts-only/msg577040/#msg577040)

you just have to sense the current before the H_bridge (stepper controller module), it's worth of cutting a trace and use the circuit ;) (instead of trying to sense at the motor wires)

you can't just measure the supply current, anything but the most primitive stepper driver is basically a switch mode converter , so the supply current is much less than
the motor current

can you name some examples ? because the most common ones (e.g. allegro A4988 , texas instruments DRV8825) are just a pair of H bridges with control logic and PWM + control for micro-stepping.
Title: Re: Sensing stepper motor winding currents
Post by: langwadt on February 21, 2015, 11:52:44 pm

Millivolts across the shunt, but the shut is floating high in the sky as either end of it is connected to the driver voltage by the H-bridge at different times :)
Opamps usually require input voltages to stay between the opamp power rails or they malfuction.



exactly that's solved here:

Can you measure before H bridge? that will be easier

This might help-
https://www.eevblog.com/forum/projects/high-side-current-sense-circuit-jelly-bean-parts-only/msg577040/#msg577040 (https://www.eevblog.com/forum/projects/high-side-current-sense-circuit-jelly-bean-parts-only/msg577040/#msg577040)

you just have to sense the current before the H_bridge (stepper controller module), it's worth of cutting a trace and use the circuit ;) (instead of trying to sense at the motor wires)

you can't just measure the supply current, anything but the most primitive stepper driver is basically a switch mode converter , so the supply current is much less than
the motor current

can you name some examples ? because the most common ones (e.g. allegro A4988 , texas instruments DRV8825) are just a pair of H bridges with control logic and PWM + control for micro-stepping.

the ones you mention :) the PWM into an inductor basically makes it a buck converter, how else would you regulate say 1A in a 2 Ohm stepper from a 24V supply  without setting the controller on fire?


Title: Re: Sensing stepper motor winding currents
Post by: Seppy on February 22, 2015, 01:23:06 am
If you wanted to use something pretty nifty there are these IC's
http://www.allegromicro.com/en/Products/Current-Sensor-ICs/Zero-To-Fifty-Amp-Integrated-Conductor-Sensor-ICs/ACS712.aspx
 (http://www.allegromicro.com/en/Products/Current-Sensor-ICs/Zero-To-Fifty-Amp-Integrated-Conductor-Sensor-ICs/ACS712.aspx)
Shove one on each of the motor coils, or ideally have the 2 H-Bridge supply intercepted before it reaches either H-Bridge.

EDIT: Didn't see Richard Crowley's post linking to allegro hall effect, pretty cool stuff they do :)
Title: Re: Sensing stepper motor winding currents
Post by: rob77 on February 22, 2015, 08:23:53 am

Millivolts across the shunt, but the shut is floating high in the sky as either end of it is connected to the driver voltage by the H-bridge at different times :)
Opamps usually require input voltages to stay between the opamp power rails or they malfuction.



exactly that's solved here:

Can you measure before H bridge? that will be easier

This might help-
https://www.eevblog.com/forum/projects/high-side-current-sense-circuit-jelly-bean-parts-only/msg577040/#msg577040 (https://www.eevblog.com/forum/projects/high-side-current-sense-circuit-jelly-bean-parts-only/msg577040/#msg577040)

you just have to sense the current before the H_bridge (stepper controller module), it's worth of cutting a trace and use the circuit ;) (instead of trying to sense at the motor wires)

you can't just measure the supply current, anything but the most primitive stepper driver is basically a switch mode converter , so the supply current is much less than
the motor current

can you name some examples ? because the most common ones (e.g. allegro A4988 , texas instruments DRV8825) are just a pair of H bridges with control logic and PWM + control for micro-stepping.

the ones you mention :) the PWM into an inductor basically makes it a buck converter, how else would you regulate say 1A in a 2 Ohm stepper from a 24V supply  without setting the controller on fire?

i would strongly suggest you to study the mode of operation of those a bit ;) but i will not say that for now... i'll be politically correct :D

so where in the data sheet you can find that BUCK-converter feature ?

the IC will not burn down because it's mosfets are fully on and it dissipates only current squared times Rdson ;) it's the poor winding of the stepper who is suffering in this picture ;)

from the allegro fatasheet:
Quote
Internal PWM Current Control. Each full-bridge is controlled by a fixed off-time PWM current control circuit that limits the load current to a desired value

and

Quote
Synchronous Rectification.  When a PWM-off cycle is triggered by an internal fixed-off time cycle, load current recirculates according to the decay mode selected by the control logic.  This synchronous rectification feature turns on the appropriate FETs during current decay, and effectively shorts out the body diodes with the low FET R DS(ON) .  This reduces power dissipation significantly, and can eliminate the need for external Schottky diodes in many applications.


sorry, no buck converter there ;)
Title: Re: Sensing stepper motor winding currents
Post by: T3sl4co1l on February 22, 2015, 09:32:35 am
Rob,

That's the definition of a buck converter.

Tim
Title: Re: Sensing stepper motor winding currents
Post by: rob77 on February 22, 2015, 06:30:14 pm
Rob,

That's the definition of a buck converter.

Tim

i know it's very similar , but it's not the same ;) there is no energy stored in the inductor in this case... the inductor (stepper's windoing) is converting the energy to mechanical, not storing it and releasing it... so technically it's not a buck converter.
Title: Re: Sensing stepper motor winding currents
Post by: langwadt on February 22, 2015, 07:04:22 pm
Rob,

That's the definition of a buck converter.

Tim

i know it's very similar , but it's not the same ;) there is no energy stored in the inductor in this case... the inductor (stepper's windoing) is converting the energy to mechanical, not storing it and releasing it... so technically it's not a buck converter.

if it quacks like a duck ...

consider a stepper that isn't moving, it doesn't make any mechanical energy,  the energy stored and released from the inductor ends up the DC resistance of the inductor 

Same as a buck energy stored and released from the inductor end up in the load




Title: Re: Sensing stepper motor winding currents
Post by: rob77 on February 22, 2015, 08:24:41 pm
Rob,

That's the definition of a buck converter.

Tim

i know it's very similar , but it's not the same ;) there is no energy stored in the inductor in this case... the inductor (stepper's windoing) is converting the energy to mechanical, not storing it and releasing it... so technically it's not a buck converter.

if it quacks like a duck ...

consider a stepper that isn't moving, it doesn't make any mechanical energy,  the energy stored and released from the inductor ends up the DC resistance of the inductor 

Same as a buck energy stored and released from the inductor end up in the load


ok.. let's asume it's a buck converter (...sort off) ;) but still there is no issue to measure the current at the controller input (finally back to the topic ;) ), because the input current is proportional to the current through the winding. so it completely makes sense to use a high side current sensing in front of the controller and then scale the readings accordingly to indirectly measure the current through the  windings (quiescent current of the controller chip is insignificant in this case).
Title: Re: Sensing stepper motor winding currents
Post by: langwadt on February 22, 2015, 10:34:41 pm
Rob,

That's the definition of a buck converter.

Tim

i know it's very similar , but it's not the same ;) there is no energy stored in the inductor in this case... the inductor (stepper's windoing) is converting the energy to mechanical, not storing it and releasing it... so technically it's not a buck converter.

if it quacks like a duck ...

consider a stepper that isn't moving, it doesn't make any mechanical energy,  the energy stored and released from the inductor ends up the DC resistance of the inductor 

Same as a buck energy stored and released from the inductor end up in the load


ok.. let's asume it's a buck converter (...sort off) ;) but still there is no issue to measure the current at the controller input (finally back to the topic ;) ), because the input current is proportional to the current through the winding. so it completely makes sense to use a high side current sensing in front of the controller and then scale the readings accordingly to indirectly measure the current through the  windings (quiescent current of the controller chip is insignificant in this case).

Yes _proportional_ but figuring out the ratio will involves a fair amount of guesswork, the right way to do it is to measure the reference voltage or the voltage over the sense resistor
Title: Re: Sensing stepper motor winding currents
Post by: T3sl4co1l on February 22, 2015, 11:56:08 pm
i know it's very similar , but it's not the same ;) there is no energy stored in the inductor in this case... the inductor (stepper's windoing) is converting the energy to mechanical, not storing it and releasing it... so technically it's not a buck converter.

This is probably a far more subtle argument than you are aware; however, it would only interfere with buck type operation on one condition[1], which isn't met here.

The reason it is subtle is:
- An induction motor performs work based on applied flux, not by applied current.  Yes, the current shows up as a necessary, inseparable part of operation, but the work performed is proportional to EMF.  Such motors are mechanical-to-EMF converters.  Examples: DC (brushed, or brushless with static (e.g. Hall effect) commutation), synchronous AC, AC induction (non-synchronous) less slippage.
- A reluctance machine (whether a motor, solenoid, relay coil, etc.) does operate by current; however, the work is again dependent upon flux.  As the inductance goes from low to high (say, as the solenoid armature closes, reducing space for magnetic field and therefore removing work from the magnetic field and converting it to mechanical work), in order for the current to remain constant, more and more flux must be added to the coil, which means if you merely apply a fixed voltage, current must dip as the solenoid closes, or if you apply a constant current, the voltage must spike.
- What's even more subtle than this, is that a real stepper motor is a combination of these types.  This is a necessity resulting from the small step size: to implement a stepper using an induction design would require N poles for 180/N degrees per step, and would be expensive to produce.  A pure reluctance machine can be easily designed for fine steps (by notching the rotor and driving complementary notched stators in quadrature), but has weak holding force (the force is due to the difference in magnetic field strengths between the two sides of each notch, which isn't much distance for the field to drop off over, especially when made of iron parts).  Instead, a hybrid combination is used, so that nearly the strength of an induction machine is produced, while doing it with only a pair of coils and a little machining.  (I forget exactly how this is achieved, but this is the general result.  Proof: if a stepper motor produces voltage -- as a generator -- for every step as it spins, it is of this type.  If it does not generate, or the amount it generates is suspiciously small, it's a reluctance type.)

The consequence is, electrically, a stepper motor must be driven as a hybrid of these two methods.  You must deliver enough flux (i.e., a spike of voltage for some duration of time) to build the magnetic field, in addition to the flux (voltage / frequency) required to advance the rotor due to its EMF.

If you look at only the V/I conditions at the terminals, averaged over a typical cycle (at constant frequency, say at a typical 'cruising' speed), you will measure real and imaginary components of current flow.  The real part can only ever do work or dissipate power; the imaginary part can only ever recycle it.  Physically, some of that real work will be done by induction as well as reluctance mechanisms, and some of the imaginary work will be done by stray fields (i.e., true leakage inductance) as well as mechanical effects (i.e., alternately stretching and squashing the magnetic field).  But the point is, electrically, we don't care what the physical mechanisms are; we just care that, there's a real part doing work, and the imaginary part we can recycle with diodes, or play tricks with on energy (like using it for an implicit buck converter).

[1] And so, here's the catch, and where my footnote comes from, all the way at the top:
The condition is, as long as the input frequencies are orthogonal to the rotational frequencies, over the course of one cycle -- there cannot be any real power consumed of those frequencies.  They must be recycled, reactively and therefore inductively*, back to the circuit.

(*Well, I guess inductively isn't a necessity.  It could be capacitive under suitable conditions -- maybe not for a stepper motor, but a synchronous AC machine can be used to produce capacitive power factor.  But whichever phase it is, it's not on the real axis!)

Indeed, often times this is forgotten -- bad motor controllers will succumb to such failure modes at the edges of operation.  An old fashioned L297/298 pair will typically PWM at 10-20kHz; if you attempt to spin the motor above maybe 1kHz, operation shifts noticeably, as the number of "on" pulses per winding drops from more than 4 (reaching a reasonably steady-state current regulation condition before switching off), down to 2 and 1, and finally to zero as the winding isn't even able to develop rated current in the allotted time (or discharge fully to zero while off!).

Although the pulses of the L297 are not fixed frequency or phase, the orthogonality condition still applies as it does.  When the applied flux gets terminated early (the winding gets turned off, due to peak current control, before the clock frequency would've turned it off ideally), the holding force or available torque both drop accordingly.  When the current-control pulses are so coarse that they take up appreciable chunks of the operating time, the drop in torque becomes so severe that, eventually, it simply stops rotating at all, and stalls (torque < friction).  This is ultimately why all steppers have a maximum operating frequency, but this is furthermore what limits the practical operating frequency of a PWM type stepper motor driver.

Now, I'm not saying this is what's happening in the OP's situation; this is just about steppers. :)

FYI,

Tim
Title: Re: Sensing stepper motor winding currents
Post by: langwadt on February 23, 2015, 12:45:14 am
The limiting factor on stepper speed is generally that you run out of voltage to counter the inductance and emf so you can no longer ramp the current up fast enough, doesn't really matter if you use switching, linear or series resistors to limit the current.

The other one is that in any kind of switching controller, your switching frequency needs to be substantially above the frequencies you are trying to generate to faithfully reproduce the desired waveform, as an example a class-d audio amplifier.
Title: Re: Sensing stepper motor winding currents
Post by: Siwastaja on February 24, 2015, 03:39:08 pm
i know it's very similar , but it's not the same ;) there is no energy stored in the inductor in this case... the inductor (stepper's windoing) is converting the energy to mechanical, not storing it and releasing it... so technically it's not a buck converter.

Actually, it is storing it... That's why the freewheeling diodes play a very important role - and that's why synchronous rectification is used. Windings of course also play the role of the load, but that doesn't change the fact that it's a buck converter. Of course, the stored energy is used by the motor itself (minus losses in freewheeling diode / FET).

Similarly, a boost LED driver which combines the role of the diode and the LED is still a boost converter.

A PWM motor controller converts higher input voltage to lower output voltage, and low input current to higher output current (yes, really!). You can measure it. That's the very definition of a buck converter. This is the same for high-power industrial VFD's, electric vehicle motor drives (brushed DC or AC, doesn't matter), and yes, steppers. The difference is that steppers usually have quite a lot of resistance in the windings, too, and can survive "holding" DC current; hence, the efficiency of a stepper is poor. But the PWM stepper driver is still a buck converter and the controller part has a great efficiency even if the motor does not.

So, you were just plainly wrong. It happens, life goes on. This was once a learning point for me, too. It's great when you learn things.
Title: Re: Sensing stepper motor winding currents
Post by: rob77 on February 25, 2015, 01:03:16 pm
i know it's very similar , but it's not the same ;) there is no energy stored in the inductor in this case... the inductor (stepper's windoing) is converting the energy to mechanical, not storing it and releasing it... so technically it's not a buck converter.

Actually, it is storing it... That's why the freewheeling diodes play a very important role - and that's why synchronous rectification is used. Windings of course also play the role of the load, but that doesn't change the fact that it's a buck converter. Of course, the stored energy is used by the motor itself (minus losses in freewheeling diode / FET).

Similarly, a boost LED driver which combines the role of the diode and the LED is still a boost converter.

A PWM motor controller converts higher input voltage to lower output voltage, and low input current to higher output current (yes, really!). You can measure it. That's the very definition of a buck converter. This is the same for high-power industrial VFD's, electric vehicle motor drives (brushed DC or AC, doesn't matter), and yes, steppers. The difference is that steppers usually have quite a lot of resistance in the windings, too, and can survive "holding" DC current; hence, the efficiency of a stepper is poor. But the PWM stepper driver is still a buck converter and the controller part has a great efficiency even if the motor does not.

So, you were just plainly wrong. It happens, life goes on. This was once a learning point for me, too. It's great when you learn things.

I think Tim explained it above very acurately ;) 

btw.. if my statement "it's very similar , but it's not the same" was plainly wrong, then should i assume you're stating the exact opposite ? because the opposite of my statement which would be "it is the same" is even more far away from reality ;)

but anyways...  i learned something... any inductive load with PWM control which requires a fly-back diode (or a synchronous switch replacing the fly-back diode) is a buck converter ;) now the remaining mystery is how to name the real buck converter (electric energy on both input and output) to distinguish it from the many other "buck converters" :D
Title: Re: Sensing stepper motor winding currents
Post by: hlavac on February 25, 2015, 03:18:23 pm
I absolutely love these allegro current sensor chips!  :-*

Don't they make a version that returns voltage proportional to the absolute value of the current? That would save me the rectifying/flipping...

Or maybe I could whack a bridge rectifier around the sensor? That will take off some of the voltage from the motor (two diode drops) and require beefy diodes, but that should not matter too much for the application I intend (the motors will be probably static, just in unknown phase/microstep position)...
Title: Re: Sensing stepper motor winding currents
Post by: Siwastaja on February 25, 2015, 11:45:48 pm
now the remaining mystery is how to name the real buck converter (electric energy on both input and output) to distinguish it from the many other "buck converters" :D

No need to, as there is no mystery; a buck converter is something that takes in high volts, low amps, and outputs low volts, high amps. A motor controller does exactly this; the motor wires have more current flowing than the input wires, but at a lower voltage. It's the textbook example of a buck converter, and it has "electric energy" on both sides: at the power supply, and at the motor terminals.

And, I have never seen a practical converter of any kind that only "outputs" "electric energy" (whatever that would ever mean) - they always have a useful load connected! What do you do with a DC/DC if you don't have any load, anyway?

Heck, in some cases (low-inductance motors), the motor controller may even have the inductor present, in which case it's a standard stand-alone buck converter, as it is always drawn, with a motor connected to its output like any load - which makes it two inductors in series.

But it only makes sense to work with one inductor instead of two inductors in series when the one happens to have enough inductance on its own. You are not getting rid of any basic circuit elements of a buck converter; the inductor is there anyway, in the motor. This of course limits the possible applications; the product is only be a buck controller for motor control applications, not a generic one.
Title: Re: Sensing stepper motor winding currents
Post by: rob77 on February 27, 2015, 01:12:42 pm
now the remaining mystery is how to name the real buck converter (electric energy on both input and output) to distinguish it from the many other "buck converters" :D

No need to, as there is no mystery; a buck converter is something that takes in high volts, low amps, and outputs low volts, high amps. A motor controller does exactly this; the motor wires have more current flowing than the input wires, but at a lower voltage. It's the textbook example of a buck converter, and it has "electric energy" on both sides: at the power supply, and at the motor terminals.

And, I have never seen a practical converter of any kind that only "outputs" "electric energy" (whatever that would ever mean) - they always have a useful load connected! What do you do with a DC/DC if you don't have any load, anyway?

Heck, in some cases (low-inductance motors), the motor controller may even have the inductor present, in which case it's a standard stand-alone buck converter, as it is always drawn, with a motor connected to its output like any load - which makes it two inductors in series.

But it only makes sense to work with one inductor instead of two inductors in series when the one happens to have enough inductance on its own. You are not getting rid of any basic circuit elements of a buck converter; the inductor is there anyway, in the motor. This of course limits the possible applications; the product is only be a buck controller for motor control applications, not a generic one.

a DC/DC step down converter is a standalone circuit which will work regardless of attaching a load => buck converter

a pwm motor controller is not complete buck convereter without the inductance of the motor (it won't convert anything without the motor's inductance) , therefore the motor itself must be a integral part of the buck converter => the controller alone is NOT a buck converter like the DC/DC one. and once you consider the motor's inductance as a integral part of the circuit, then there is no electrical output energy anymore, it's mechanical output energy at the motor's shaft ;)