Stepper motor controller current limiting question

H

HC

Guest
Hello, all. I'm trying to build my first stepper motor controller and
I have two questions. In trying to learn about stepper motors and
controllers I read the document AN907 from Microchip among other
documents and sites: http://ww1.microchip.com/downloads/en/AppNotes/00907a.pdf

In that document the author writes about current limiting a stepper
motor that is purposefully driven at a voltage that is higher than its
designed voltage in order to get the current up more quickly
(overcoming the inductance of the coils) and then using current
limiting to prevent the motor from being run at higher than maximum
current. Several methods are discussed including PWM and using a
current-sense resistor.

I think I understand the reasons why a current-sense resistor is not
ideal (cost and heat dissipation). PWM sounds great and I've used a
PWM circuit for controlling the speed of a DC motor in the past.
However, let's say the motor is rated at 5V and I choose to drive it
with 10V so I'd need to limit the duty cycle to 50%, what happens when
the winding is first energized? Let's say that I'm using a frequency
of 31kHz or so, it seems that, when the winding is first energized,
the voltage may need to be applied longer than the 50% pulse to get
the current to the maximum the motor is rated at, and then run it at
the 50% duty cycle once the current is at the maximum. If you look at
the document you will see that Figure 21 shows a longer-than target
pulse at the beginning of the power cycle and then short pulses (lower
duty cycle) to maintain the target maximum current in the winding.
Therefore, I must conclude that the circuit is requiring some kind of
current detection in the winding. And if I rely soley on calculated
duty cycle for the PWM, obviously I would have to be careful of the
duration of the pulses (50% duty cycle at 0.5 hertz would give 1
second of full power to the winding, so pulse duration can impact the
current across the motor). That said, it would seem that a way to
monitor the current in the winding would be important.

So the first question is: what method would be best to measure the
current in the motor windings considering that I am using a PIC (I
have several to choose from including the PIC16F630, PIC16F684,
PIC16F54, and some PIC16F84's) to control the motor? My test motor is
a 6-wire unipolar and I intend to power the common junctions with
positive voltage and just switch the negative with a MOSFET (I have
some TIP41C's I will try). I am good with the PWM control but I am
not sure how to handle limiting the current. At present I'm just
running the motor on its rated voltage.

The second quesiton is, as I eventually use larger motors, how do I
properly choose the protection diodes I will use in parallel with the
windings? I have some 1N4148's but they seem small. I also have
several larger ones like 1N4004 and other, similar part numbers.

Thanks in advance.

--HC
 
On Tue, 16 Feb 2010 15:57:04 -0800 (PST), HC <hboothe@gte.net> wrote:

Hello, all. I'm trying to build my first stepper motor controller and
I have two questions. In trying to learn about stepper motors and
controllers I read the document AN907 from Microchip among other
documents and sites: http://ww1.microchip.com/downloads/en/AppNotes/00907a.pdf

In that document the author writes about current limiting a stepper
motor that is purposefully driven at a voltage that is higher than its
designed voltage in order to get the current up more quickly
(overcoming the inductance of the coils) and then using current
limiting to prevent the motor from being run at higher than maximum
current. Several methods are discussed including PWM and using a
current-sense resistor.
[snippety snip]

Take a look at the discussion over at
http://www.cs.uiowa.edu/~jones/step/ for some recommendations.

--
Rich Webb Norfolk, VA
 
On Feb 16, 7:12 pm, Rich Webb <bbew...@mapson.nozirev.ten> wrote:
On Tue, 16 Feb 2010 15:57:04 -0800 (PST), HC <hboo...@gte.net> wrote:
Hello, all.  I'm trying to build my first stepper motor controller and
I have two questions.  In trying to learn about stepper motors and
controllers I read the document AN907 from Microchip among other
documents and sites:http://ww1.microchip.com/downloads/en/AppNotes/00907a.pdf

In that document the author writes about current limiting a stepper
motor that is purposefully driven at a voltage that is higher than its
designed voltage in order to get the current up more quickly
(overcoming the inductance of the coils) and then using current
limiting to prevent the motor from being run at higher than maximum
current.  Several methods are discussed including PWM and using a
current-sense resistor.

[snippety snip]

Take a look at the discussion over athttp://www.cs.uiowa.edu/~jones/step/for some recommendations.

--
Rich Webb     Norfolk, VA
Rich, thank you for your time and response. I am looking over the
information at that site. It will take some time as there appears to
be a lot there. I will read through all that and see where I am, but
it appears, after only a cursory look, to address my main concern
about current limiting PWM controllers.

Thank you again.

--HC
 
On Tue, 16 Feb 2010 15:57:04 -0800 (PST), HC
<hboothe@gte.net> wrote:

Hello, all. I'm trying to build my first stepper motor controller and
I have two questions. In trying to learn about stepper motors and
controllers I read the document AN907 from Microchip among other
documents and sites: http://ww1.microchip.com/downloads/en/AppNotes/00907a.pdf

In that document the author writes about current limiting a stepper
motor that is purposefully driven at a voltage that is higher than its
designed voltage in order to get the current up more quickly
(overcoming the inductance of the coils) and then using current
limiting to prevent the motor from being run at higher than maximum
current. Several methods are discussed including PWM and using a
current-sense resistor.

I think I understand the reasons why a current-sense resistor is not
ideal (cost and heat dissipation). PWM sounds great and I've used a
PWM circuit for controlling the speed of a DC motor in the past.
However, let's say the motor is rated at 5V and I choose to drive it
with 10V so I'd need to limit the duty cycle to 50%, what happens when
the winding is first energized?
I'm no stepper motor guru, but I think the above
is suspect. If you double the voltage (on a
purely resistive load, at least) the power
dissipation is *squared*. The equivalent duty
cycle to maintain the same dissipation would thus
be only 25%, not 50%.

But that's what you'd want the long-term average
to be. Presumably, you would get much higher
instantaneous power when starting up, which would
then taper off to something like 25%.

Or am I missing something here?

Best regards,


Bob Masta

DAQARTA v5.00
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Scope, Spectrum, Spectrogram, Sound Level Meter
Frequency Counter, FREE Signal Generator
Pitch Track, Pitch-to-MIDI
DaqMusic - FREE MUSIC, Forever!
(Some assembly required)
Science (and fun!) with your sound card!
 
On Wed, 17 Feb 2010 13:19:04 GMT, N0Spam@daqarta.com (Bob Masta) wrote:

On Tue, 16 Feb 2010 15:57:04 -0800 (PST), HC
hboothe@gte.net> wrote:

Hello, all. I'm trying to build my first stepper motor controller and
I have two questions. In trying to learn about stepper motors and
controllers I read the document AN907 from Microchip among other
documents and sites: http://ww1.microchip.com/downloads/en/AppNotes/00907a.pdf

In that document the author writes about current limiting a stepper
motor that is purposefully driven at a voltage that is higher than its
designed voltage in order to get the current up more quickly
(overcoming the inductance of the coils) and then using current
limiting to prevent the motor from being run at higher than maximum
current. Several methods are discussed including PWM and using a
current-sense resistor.

I think I understand the reasons why a current-sense resistor is not
ideal (cost and heat dissipation). PWM sounds great and I've used a
PWM circuit for controlling the speed of a DC motor in the past.
However, let's say the motor is rated at 5V and I choose to drive it
with 10V so I'd need to limit the duty cycle to 50%, what happens when
the winding is first energized?

I'm no stepper motor guru, but I think the above
is suspect. If you double the voltage (on a
purely resistive load, at least) the power
dissipation is *squared*.
---
A slip of the tongue, I'm sure, but since:

P2 = P1 (E2/E1)˛,

doubling the voltage across the load will cause the dissipation to just
quadruple, not square.

JF
 
On Wed, 17 Feb 2010 13:19:04 +0000, Bob Masta wrote:

On Tue, 16 Feb 2010 15:57:04 -0800 (PST), HC <hboothe@gte.net> wrote:

Hello, all. I'm trying to build my first stepper motor controller and I
have two questions. In trying to learn about stepper motors and
controllers I read the document AN907 from Microchip among other
documents and sites:
http://ww1.microchip.com/downloads/en/AppNotes/00907a.pdf

In that document the author writes about current limiting a stepper
motor that is purposefully driven at a voltage that is higher than its
designed voltage in order to get the current up more quickly (overcoming
the inductance of the coils) and then using current limiting to prevent
the motor from being run at higher than maximum current. Several
methods are discussed including PWM and using a current-sense resistor.

I think I understand the reasons why a current-sense resistor is not
ideal (cost and heat dissipation). PWM sounds great and I've used a PWM
circuit for controlling the speed of a DC motor in the past. However,
let's say the motor is rated at 5V and I choose to drive it with 10V so
I'd need to limit the duty cycle to 50%, what happens when the winding
is first energized?

I'm no stepper motor guru, but I think the above is suspect. If you
double the voltage (on a purely resistive load, at least) the power
dissipation is *squared*.
the power dissipation goes up by *two squared*.

The equivalent duty cycle to maintain the
same dissipation would thus be only 25%, not 50%.

But that's what you'd want the long-term average to be. Presumably, you
would get much higher instantaneous power when starting up, which would
then taper off to something like 25%.

Or am I missing something here?
The inductance of the motor, if the PWM frequency is fast enough.

--
www.wescottdesign.com
 
On Feb 16, 6:57 pm, HC <hboo...@gte.net> wrote:
Hello, all.  I'm trying to build my first stepper motor controller and
I have two questions.  In trying to learn about stepper motors and
controllers I read the document AN907 from Microchip among other
documents and sites:http://ww1.microchip.com/downloads/en/AppNotes/00907a..pdf

In that document the author writes about current limiting a stepper
motor that is purposefully driven at a voltage that is higher than its
designed voltage in order to get the current up more quickly
(overcoming the inductance of the coils) and then using current
limiting to prevent the motor from being run at higher than maximum
current.  Several methods are discussed including PWM and using a
current-sense resistor.

I think I understand the reasons why a current-sense resistor is not
ideal (cost and heat dissipation).  PWM sounds great and I've used a
PWM circuit for controlling the speed of a DC motor in the past.
However, let's say the motor is rated at 5V and I choose to drive it
with 10V so I'd need to limit the duty cycle to 50%, what happens when
the winding is first energized?  Let's say that I'm using a frequency
of 31kHz or so, it seems that, when the winding is first energized,
the voltage may need to be applied longer than the 50% pulse to get
the current to the maximum the motor is rated at, and then run it at
the 50% duty cycle once the current is at the maximum.  If you look at
the document you will see that Figure 21 shows a longer-than target
pulse at the beginning of the power cycle and then short pulses (lower
duty cycle) to maintain the target maximum current in the winding.
Therefore, I must conclude that the circuit is requiring some kind of
current detection in the winding.  And if I rely soley on calculated
duty cycle for the PWM, obviously I would have to be careful of the
duration of the pulses (50% duty cycle at 0.5 hertz would give 1
second of full power to the winding, so pulse duration can impact the
current across the motor).  That said, it would seem that a way to
monitor the current in the winding would be important.

So the first question is: what method would be best to measure the
current in the motor windings considering that I am using a PIC (I
have several to choose from including the PIC16F630, PIC16F684,
PIC16F54, and some PIC16F84's) to control the motor?  My test motor is
a 6-wire unipolar and I intend to power the common junctions with
positive voltage and just switch the negative with a MOSFET (I have
some TIP41C's I will try).  I am good with the PWM control but I am
not sure how to handle limiting the current.  At present I'm just
running the motor on its rated voltage.

The second quesiton is, as I eventually use larger motors, how do I
properly choose the protection diodes I will use in parallel with the
windings?  I have some 1N4148's but they seem small.  I also have
several larger ones like 1N4004 and other, similar part numbers.

Thanks in advance.

--HC
Since this is your first stepper motor project I would start by
staying within the Voltage and current ratings of the motor. Once
that is all working you can try pushing the boundaries for enhanced
performance. But at least you won't 'let the smoke out' of the motor
your first time.

George H.
 
On Feb 17, 7:19 am, N0S...@daqarta.com (Bob Masta) wrote:
On Tue, 16 Feb 2010 15:57:04 -0800 (PST), HC





hboo...@gte.net> wrote:
Hello, all.  I'm trying to build my first stepper motor controller and
I have two questions.  In trying to learn about stepper motors and
controllers I read the document AN907 from Microchip among other
documents and sites:http://ww1.microchip.com/downloads/en/AppNotes/00907a.pdf

In that document the author writes about current limiting a stepper
motor that is purposefully driven at a voltage that is higher than its
designed voltage in order to get the current up more quickly
(overcoming the inductance of the coils) and then using current
limiting to prevent the motor from being run at higher than maximum
current.  Several methods are discussed including PWM and using a
current-sense resistor.

I think I understand the reasons why a current-sense resistor is not
ideal (cost and heat dissipation).  PWM sounds great and I've used a
PWM circuit for controlling the speed of a DC motor in the past.
However, let's say the motor is rated at 5V and I choose to drive it
with 10V so I'd need to limit the duty cycle to 50%, what happens when
the winding is first energized?  

I'm no stepper motor guru, but I think the above
is suspect.  If you double the voltage (on a
purely resistive load, at least) the power
dissipation is *squared*.  The equivalent duty
cycle to maintain the same dissipation would thus
be only 25%, not 50%.

But that's what you'd want the long-term average
to be.  Presumably, you would get much higher
instantaneous power when starting up, which would
then taper off to something like 25%.

Or am I missing something here?

Best regards,

Bob Masta

              DAQARTA  v5.00
   Data AcQuisition And Real-Time Analysis
             www.daqarta.com
Scope, Spectrum, Spectrogram, Sound Level Meter
    Frequency Counter, FREE Signal Generator
           Pitch Track, Pitch-to-MIDI
         DaqMusic - FREE MUSIC, Forever!
             (Some assembly required)
     Science (and fun!) with your sound card!- Hide quoted text -

- Show quoted text -
Hello, Bob, thank you for your reply. I'm sure that's not right on my
part; it was just a loose (and inaccurate) recollection I had at the
periphery of my thoughts at the time. :(

--HC
 
On Feb 17, 1:36 pm, George Herold <ggher...@gmail.com> wrote:
On Feb 16, 6:57 pm, HC <hboo...@gte.net> wrote:





Hello, all.  I'm trying to build my first stepper motor controller and
I have two questions.  In trying to learn about stepper motors and
controllers I read the document AN907 from Microchip among other
documents and sites:http://ww1.microchip.com/downloads/en/AppNotes/00907a.pdf

In that document the author writes about current limiting a stepper
motor that is purposefully driven at a voltage that is higher than its
designed voltage in order to get the current up more quickly
(overcoming the inductance of the coils) and then using current
limiting to prevent the motor from being run at higher than maximum
current.  Several methods are discussed including PWM and using a
current-sense resistor.

I think I understand the reasons why a current-sense resistor is not
ideal (cost and heat dissipation).  PWM sounds great and I've used a
PWM circuit for controlling the speed of a DC motor in the past.
However, let's say the motor is rated at 5V and I choose to drive it
with 10V so I'd need to limit the duty cycle to 50%, what happens when
the winding is first energized?  Let's say that I'm using a frequency
of 31kHz or so, it seems that, when the winding is first energized,
the voltage may need to be applied longer than the 50% pulse to get
the current to the maximum the motor is rated at, and then run it at
the 50% duty cycle once the current is at the maximum.  If you look at
the document you will see that Figure 21 shows a longer-than target
pulse at the beginning of the power cycle and then short pulses (lower
duty cycle) to maintain the target maximum current in the winding.
Therefore, I must conclude that the circuit is requiring some kind of
current detection in the winding.  And if I rely soley on calculated
duty cycle for the PWM, obviously I would have to be careful of the
duration of the pulses (50% duty cycle at 0.5 hertz would give 1
second of full power to the winding, so pulse duration can impact the
current across the motor).  That said, it would seem that a way to
monitor the current in the winding would be important.

So the first question is: what method would be best to measure the
current in the motor windings considering that I am using a PIC (I
have several to choose from including the PIC16F630, PIC16F684,
PIC16F54, and some PIC16F84's) to control the motor?  My test motor is
a 6-wire unipolar and I intend to power the common junctions with
positive voltage and just switch the negative with a MOSFET (I have
some TIP41C's I will try).  I am good with the PWM control but I am
not sure how to handle limiting the current.  At present I'm just
running the motor on its rated voltage.

The second quesiton is, as I eventually use larger motors, how do I
properly choose the protection diodes I will use in parallel with the
windings?  I have some 1N4148's but they seem small.  I also have
several larger ones like 1N4004 and other, similar part numbers.

Thanks in advance.

--HC

Since this is your first stepper motor project I would start by
staying within the Voltage and current ratings of the motor.  Once
that is all working you can try pushing the boundaries for enhanced
performance.   But at least you won't 'let the smoke out' of the motor
your first time.

George H.- Hide quoted text -

- Show quoted text -
Hello, George, thank you for your reply. That makes the most sense to
me. I will do that. In the meantime I am still trying to learn as
much as I can and am still reading, as time permits, the site
suggested to me by the first responder (Jones on stepper motors).

--HC
 
On Feb 16, 5:57 pm, HC <hboo...@gte.net> wrote:
Hello, all.  I'm trying to build my firststeppermotorcontroller and
I have two questions.  In trying to learn aboutsteppermotors and
controllers I read the document AN907 from Microchip among other
documents and sites:http://ww1.microchip.com/downloads/en/AppNotes/00907a..pdf

In that document the author writes about current limiting asteppermotorthat is purposefully driven at a voltage that is higher than its
designed voltage in order to get the current up more quickly
(overcoming the inductance of the coils) and then using current
limiting to prevent themotorfrom being run at higher than maximum
current.  Several methods are discussed including PWM and using a
current-sense resistor.

I think I understand the reasons why a current-sense resistor is not
ideal (cost and heat dissipation).  PWM sounds great and I've used a
PWM circuit for controlling the speed of a DCmotorin the past.
However, let's say themotoris rated at 5V and I choose to drive it
with 10V so I'd need to limit the duty cycle to 50%, what happens when
the winding is first energized?  Let's say that I'm using a frequency
of 31kHz or so, it seems that, when the winding is first energized,
the voltage may need to be applied longer than the 50% pulse to get
the current to the maximum themotoris rated at, and then run it at
the 50% duty cycle once the current is at the maximum.  If you look at
the document you will see that Figure 21 shows a longer-than target
pulse at the beginning of the power cycle and then short pulses (lower
duty cycle) to maintain the target maximum current in the winding.
Therefore, I must conclude that the circuit is requiring some kind of
current detection in the winding.  And if I rely soley on calculated
duty cycle for the PWM, obviously I would have to be careful of the
duration of the pulses (50% duty cycle at 0.5 hertz would give 1
second of full power to the winding, so pulse duration can impact the
current across themotor).  That said, it would seem that a way to
monitor the current in the winding would be important.

So the first question is: what method would be best to measure the
current in themotorwindings considering that I am using a PIC (I
have several to choose from including the PIC16F630, PIC16F684,
PIC16F54, and some PIC16F84's) to control themotor?  My testmotoris
a 6-wire unipolar and I intend to power the common junctions with
positive voltage and just switch the negative with a MOSFET (I have
some TIP41C's I will try).  I am good with the PWM control but I am
not sure how to handle limiting the current.  At present I'm just
running themotoron its rated voltage.

The second quesiton is, as I eventually use larger motors, how do I
properly choose the protection diodes I will use in parallel with the
windings?  I have some 1N4148's but they seem small.  I also have
several larger ones like 1N4004 and other, similar part numbers.

Thanks in advance.

--HC
Hello, all. Where I am now is I have learned a fair bit about
programming Micrchip PICs and think I've got that well enough to
finally implement a test design. I'm taking the suggestion that I
start with rated voltages initially, so no need for current sensing
yet.

I started looking for an H Bridge circuit for my test motor because
running it bipolar yields higher holding torque than unipolar
operation. I have a number of BUZ11 N-Channel MOSFETs that I wanted
to use and, I've read, they offer less resistance to the load so less
heat is generated when they are operating, particularly switching.
Plus, I don't think I have a P-Channel MOSFET in captivity and I live
in the sticks so I can't just run to the store and grab one.

So, after reading tons of stuff on H Bridges I kind of cobbled
together a piece that works and I wanted to fly it out there and see
if I've done any good or if I'm screwing up. I have the schematic
done up and saved on Photo Bucket: (http://s938.photobucket.com/home/
nunyabusiness11). I hope that link works. If not you can hit the
site and search for my username listed at the end of that link.

I've wired it up and it works. It is simply 1/4 of an H Bridge, one
of the upper legs supplying positive voltage to the motor. Currently
I did not put in any clamping diodes around the motor because the
MOSFET has one and it'll work for just seeing if the circuit works.

Basically, I'm using 5Vdc from the PIC (simulating it now by just
touching the input to +5Vdc or Gnd) to activate a NPN
phototransistor. That switches +12Vdc to ground via a 3k3 pull-up
resistor (it is located before the phototransistor). That line
(before the phototransistor) is connected via a 10k resistor to the
base of a PNP 2N3906. The collector is tied to +12Vdc via a 1k
resistor. The emitter is connected to ground via a 2k2 pull-down
resistor. The N Channel MOSFET gate is tied to the line after the
2N3906 but before the 2k2 pull-down resistor. The N Channel MOSFET is
tied to +12Vdc on the drain and the source ties to the motor which
itself is tied to ground.

I used the phototransistor (SFH615A) to isolate the 5Vdc circuit from
the 12Vdc circuit. When the input to it gets +5Vdc it switches on the
phototransistor which allows the base of the 2N3906 to go low
switching it on. That switches voltage to the leg with the 2k2 pull-
down resistor and to the gate on the MOSFET.

I've tested it a few times, just powering the system up and touching
the input directly to +5Vdc or Gnd. The motor holds securely when the
input is energized and seems to freewheel correctly when the input is
grounded (after I changed the pulldown resistor on the MOSFET gate
from a 3k3 to a 2k2).

I'd appreciate input as to whether or not this is a good idea or if I
simply got lucky that nothing smoked. I'm not an EE by any means and
this circuit could be the silicon equivalent to a crack-baby.

Thank you.

--HC
 

Welcome to EDABoard.com

Sponsor

Back
Top