EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Stepper Motor Driver (LPC21xx, etc.)

Started by Kevin Townsend September 16, 2008
Robert Adsett wrote:
> At 04:01 PM 9/16/08 -0400, Charles R. Grenz wrote:
>> Kevin Townsend wrote:
>>> Is it realistic to implement something using only an ARM7 processor, or
>>> is it just not worth the effort? I'm not objectionable to using an
>>> external chip, but would have preferred a software approach if
>>> possible ... though I have no idea how feasible that would be (ergo
>>> this post).
>>>
>>> Kevin
>> Hi Kevin,
>>
>> You will need to use an external driver and you will not have
>> enough time to perform all the necessary control directly from the 2148.
>> That's the short answer. What I was going to ask you are the following:
>
> Will not enough time seems somewhat pessimistic (depends on how fast you
> are expecting to move the motors of course). Many a moon ago I did two
> axis microstepping on a Z80 and on a 5MHz 186. A 2148 with timing
> peripherals would run circles around those setups. Then again we were
> running slow enough for open loop to be sufficient.
>
> Robert
>

Hi Robert,

I designed one with a 8051 running at 4MHz and also with a 6800 at 2MHz. It was an update to an old design that used a 4004! Did yours run linear motion and more then 1 axis of control? Also considering the processors you where using I would also assume you where using unipolar over bipolar with no microstepping?

I am talking with Kevin now and that 200 sps is probably not going to work considering the mass he has to move (which may mean a gear head with a 10:1 ratio will be involved or better) which means he is now at 2K sps per axis.

Yes I am being pessimistic but I am assuming that he will need some processor time left to do other things. ;-)

regards,
Charles

An Engineer's Guide to the LPC2100 Series

--- In l..., "Kevin Townsend" wrote:

> > 6) What is the operating voltage of the driver?
>
> Again, it depends on what motor I find that can most dependable
> support an appropriate load. In any case, I will need to keep things
> 12V or under for the motors if its possible.
>

The thing is, 12V motors are almost never run on 12V. More than
likely it will be several times this value.

The idea is to have excessive voltage available in the early part of a
step to overcome the winding inductance. That's why all the neat
chips have a current sense feature that controls the winding current
via PWM. When you start talking about microstepping, PWM is what
makes it work. There are proportional winding currents all controlled
by PWM.

This is one application where software MIGHT be able to produce an
acceptable driver under some conditions but it will never be as
capable as a hardware solution.

I would really prefer that this thread continue on this forum rather
than go off line. It is a topic in which I have a large interest and
absolutely no relevant experience.

Richard

At 04:56 PM 9/16/2008 -0400, Charles R. Grenz wrote:

> > Will not enough time seems somewhat pessimistic (depends on how fast you
> > are expecting to move the motors of course). Many a moon ago I did two
> > axis microstepping on a Z80 and on a 5MHz 186. A 2148 with timing
> > peripherals would run circles around those setups. Then again we were
> > running slow enough for open loop to be sufficient.
> >
> I designed one with a 8051 running at 4MHz and also with a 6800
> at 2MHz. It was an update to an old design that used a 4004! Did yours
> run linear motion and more then 1 axis of control? Also considering the
> processors you where using I would also assume you where using unipolar
> over bipolar with no microstepping?

It was basically ran a two axis X-Y table, sine wave excitation for
micro-stepping.
> I am talking with Kevin now and that 200 sps is probably not
> going to work considering the mass he has to move (which may mean a gear
> head with a 10:1 ratio will be involved or better) which means he is now
> at 2K sps per axis.
>
> Yes I am being pessimistic but I am assuming that he will need
> some processor time left to do other things. ;-)

Well, now you are getting picky:)

We were doing data acquisition at the same time but that probably slowed us
down waiting for the lock-amp to settle.

Most of the details have been blown away by the sands of time. I don't
remember much about the actual stepping rate, we were running 0.8um
substeps as I recall and it would take a few seconds to move a cm at full
speed as I recall. The load was rather small though.

Robert

Another sign of the end of civilization, our technical magazines are
getting chatty
From an EETimes product descriptions 2006/08/09
".... systems that can sample gobs of inputs simultaneously"
Now just what is the technical definition for gobs again?
http://www.aeolusdevelopment.com/
hi charles,
Do u have any Idea on V F drives(speed control of Motor)

Raj

----- Original Message ----
From: Charles R. Grenz
To: l...
Sent: Wednesday, September 17, 2008 12:28:28 AM
Subject: Re: [lpc2000] Stepper Motor Driver (LPC21xx, etc.)
Kevin Townsend wrote:
> I was wondering if anyone knows of any publicly available stepper motor
> drivers or code for the LPC21xx (LPC2148 in my case)? I have a 4 wire
> bi-polar stepper that I would like to control, and was hoping to find a
> decent ARM7 example to at least start from since I've never tried to
> use a stepper motor before.
>
> Has anyone here tried reliably driving three stepper motors using an
> LPC2148 or similar device, that could offer some insight or experience
> on it?
>
> Kevin.
>

Hi Kevin,

Contact me directly so we can discuss.

regards,
Charles


I did a design with a LPC2104 and an Allegro A3977. Works excellent. I considered trying to do the logic control inside the ARM, but it's simply not worth it. You've got to use some kind of power driver chip anyway in most cases. You can do it with discrete mosfets, but there's a lot more to running a stepper motor elegantly. Depending on the speed it is running the control can switch from voltage to current. There are issues with inductive decay at different rates. A basic MCU just doesn't have all the resources to do this built in. The A3977 does already. I am using microsteping and acceleration/deceleration, variable speeds, variable loading, and more. Just managing the clock is really enough calcs for the ARM to do already, among it's other tasks. Running the motor itself is better left to something like the A3977.

If you are just going to run a motor crudely at a single constant speed than you can probably get away with just some mosfets and the ARM. But if you want smooth motor performance, microstepping, variable speeds, etc. in my opinion you need a proper motor controller. They do things you can't do with any MCU. Steppers can generate a lot of vibration and generate resonance at different rates with the mounting structure. Microstepping operates it as a sine wave which is much smoother. How a stepper behaves is very much a matter of how it is driven. The difference can be whether the motor sounds like a chain saw or sewing machine.

Chris.


Kevin,

>
> Is it realistic to implement something using only an ARM7
processor, or
> is it just not worth the effort? I'm not objectionable to using an
> external chip, but would have preferred a software approach if
> possible ... though I have no idea how feasible that would be (ergo
> this post).

Implementing motion controller on any LPC21xx will not be a problem,
ARM7 core running at 60 MHz has enough processing power for
even a very complex algorithms.

To get an idea have a look at the Fab@home project here:

http://www.fabathome.org/

source code is here:

http://sourceforge.net/projects/fabathome/

It happens to include motion controller implemented on
lpc2148 plus a PC based fronted which is using USB to
talk to it.

The only catch is to actually drive your motor you *will need*
an external driver either a chip or a stepper amplifier that
can provide power to your motor. Lpc2148 is a CMOS chip and can
output +/- 4 mA per pin which is not enough to drive any stepper
motor that I know.

Check the Electronics section to get an idea of what is needed
for even a fairly small stepper motors used by the Fab@home
3D printer.

http://www.fabathome.org/wiki/index.php?title
%40Home:Model_1_Electronics

>
> Kevin
>

Pawel
Robert Adsett wrote:
> At 04:01 PM 9/16/08 -0400, Charles R. Grenz wrote:
>> Kevin Townsend wrote:
>>> Is it realistic to implement something using only an ARM7 processor,
>>> or is it just not worth the effort? I'm not objectionable to using
>>> an external chip, but would have preferred a software approach if
>>> possible ... though I have no idea how feasible that would be (ergo
>>> this post).
>>>
>>> Kevin
>>
>> Hi Kevin,
>>
>> You will need to use an external driver and you will not have
>> enough time to perform all the necessary control directly from the
>> 2148. That's the short answer. What I was going to ask you are the
>> following:
>
> Will not enough time seems somewhat pessimistic (depends on how fast
> you are expecting to move the motors of course). Many a moon ago I
> did two axis microstepping on a Z80 and on a 5MHz 186. A 2148 with
> timing peripherals would run circles around those setups. Then again
> we were running slow enough for open loop to be sufficient.
>

I am sure it will be possible to do it in software.

I have driven 4 motors with 16-microstep resolution from an 8051 running
at 16MHz, while receiving DMX512 serial data at 250KBaud, so an Arm-7
will have no problem. I used 2 simple ULN2803 darlington drivers to
power the stepper motor coils. The microstepping was done by software
pwm of the drive outputs. This product was a range of disco lighting
scanners which required smooth fast movement.

What you lose with this method is torque. If you need maximum torque
from the motors you will need to use a proper stepper driver chip which
can drive high current into the motor coils.

--
Tim Mitchell
Check out this link.

http://www.embedded.com/columns/technicalinsights/56800129?
_requestid=437606

I've ported and tweaked that code for use on an LPC2103 and it works
quite well. I used an Allegro A3982 driver chip.

Jeff

--- In l..., "Kevin Townsend"
wrote:
>
> Charles:
>
> Thanks for the replies.
>
> > 1) What is the fastest steps per second you are going to run?
>
> The longest distance the motor will need to drive an object will
be
> around 1m, so I would guess that 200 steps per second is probably
> sufficient, or a maximum of 400, since the aim is smooth,
> controllable motion more than speed.
>
> > 2) Are you going to need microstepping?
>
> Probably not. 1.8 is more than likely precise enough.
>
> > 3) Are you going to run all 3 motors at the same time?
>
> There are ocassions where I will need to run all three, yes,
though
> if necessary it may be possible to restrict movements to two axis
> even if three would be preferrable.
>
> > 4) Are you going to need acceleration/deceleration?
>
> Yes, since I will need to ease into and out of the motion over a
> variable amount of time. (For 10 seconds of movement, the user
may
> rquire 2 seconds of ease in and 2 seconds of ease out, for
example.)
> This 'easing' in and out is essential to get decent results for
the
> intended application.
>
> > 5) What is the current per phase of the largest motor?
>
> I need to do some tests to determine which motors I will end up
> using, since I need to support a load of up to about 8 KGs. I
have
> ordered a few motors to try, but I can't say for the moment until
I
> do some tests.
>
> > 6) What is the operating voltage of the driver?
>
> Again, it depends on what motor I find that can most dependable
> support an appropriate load. In any case, I will need to keep
things
> 12V or under for the motors if its possible.
>
> PS: If you prefer, I don't mind emailing you about this. Just
let
> me know your preference.
>
> Kevin
>


Memfault Beyond the Launch