4 Independent frequency controllable step signal generation from PIC for stepper motors

Started by AMIT KAPOOR June 27, 2009
Dear Friends ,

I am trying to make 4 axis stepper motor control , but i am stuck in the software part logic.

i will use L297 and L298 as stepper controller and driver.


For L297 i must givestep input and direction. Since my control is of 4 stepper motor, so how can i generate 4INDEPENDENTstep signalsfrom PIC (PIC18F4580 i have , but if it is possiblefrom other PIC ,please suggest)whose frequency can varyINDEPENDENTLY ( need not to vary duty cycle i guess) so that stepper speed can be controlled. i just want to know the different ways to do this.


Any helpwill be a big support for me to proceed.....


Thanks a lot,

I Hope to get many responses....

Amit...
--- In p..., AMIT KAPOOR wrote:
>
>
>
>
>
> Dear Friends ,
>
> I am trying to make 4 axis stepper motor control , but i am stuck in the software part logic.
>
> i will use L297 and L298 as stepper controller and driver.
>
>
> For L297 i must givestep input and direction. Since my control is of 4 stepper motor, so how can i generate 4INDEPENDENTstep signalsfrom PIC (PIC18F4580 i have , but if it is possiblefrom other PIC ,please suggest)whose frequency can varyINDEPENDENTLY ( need not to vary duty cycle i guess) so that stepper speed can be controlled. i just want to know the different ways to do this.
>
>
> Any helpwill be a big support for me to proceed.....
>
>
> Thanks a lot,
>
> I Hope to get many responses....
>
> Amit...
>

Work out your maximum step rate first. You may find that it is low enough that a program loop can generate the signals.

The nice way to generate the pulses is with the toggle feature of the CCP modules. I haven't found a PIC with more than 2 CCPs but they might exist.

What are you trying to do with the steppers?

Richard



to unsubscribe, go to http://www.yahoogroups.com and follow the instructions
Hello Richard,

I am making 4 axis linear guide simulator for welding carriage using stepper motor...travelling, height control, rotation and weaving(tovn fro motion)...problem is i want PIC to do other jobs also( buttons input control from control panel etc) but i dont know how to make PIC do the step generation role in background and be free for receiving inputs ....one way is to have slave PIC do the step generation job and master take the input and other jobs control....but i really want to know how to do everything with one pic ..i hope i am clear in my explanation.....please let me know the solutions...

any help or suggestions will be great...

Thanks,

Amit

--- On Sat, 6/27/09, rtstofer wrote:
From: rtstofer
Subject: [piclist] Re: 4 Independent frequency controllable step signal generation from PIC for stepper motors
To: p...
Date: Saturday, June 27, 2009, 9:32 AM

--- In piclist@yahoogroups .com, AMIT KAPOOR wrote:
>
> Dear Friends ,
>
> I am trying to make 4 axis stepper motor control , but i am stuck in the software part logic.
>
> i will use L297 and L298 as stepper controller and driver.
>
>
> For L297 i must givestep input and direction. Since my control is of 4 stepper motor, so how can i generate 4INDEPENDENT step signalsfrom PIC (PIC18F4580 i have , but if it is possiblefrom other PIC ,please suggest)whose frequency can varyINDEPENDENTLY ( need not to vary duty cycle i guess) so that stepper speed can be controlled. i just want to know the different ways to do this.
>
>
> Any helpwill be a big support for me to proceed.....
>
>
> Thanks a lot,
>
> I Hope to get many responses... .
>
> Amit...
>

Work out your maximum step rate first. You may find that it is low enough that a program loop can generate the signals.

The nice way to generate the pulses is with the toggle feature of the CCP modules. I haven't found a PIC with more than 2 CCPs but they might exist.

What are you trying to do with the steppers?

Richard
--- In p..., AMIT KAPOOR wrote:
>
>
>
>
>
>
> Hello Richard,
>
> I am making 4 axis linear guide simulator for welding carriage using stepper motor...travelling, height control, rotation and weaving(tovn fro motion)...problem is i want PIC to do other jobs also( buttons input control from control panel etc) but i dont know how to make PIC do the step generation role in background and be free for receiving inputs ....one way is to have slave PIC do the step generation job and master take the input and other jobs control....but i really want to know how to do everything with one pic ..i hope i am clear in my explanation.....please let me know the solutions...
>
> any help or suggestions will be great...
>
> Thanks,
>
> Amit

I think you are overestimating what can be done with a PIC - at least the mid-Range PICs.

There are a lot of PIC projects around that take a step/dir signal input and create the wave pattern for steppers. I don't think I have seen one that measured winding current.

Allegro makes stepper motor controllers like the SLA7078 3 Amp controller. These allow you to use higher motor voltages and the chip modulates the winding current. You get much better performance. See "Jones On Steppers" - Google for it.

http://www.allegromicro.com/en/Products/Design/an/2821003.pdf

Nevertheless, doing the linear interpolation required for a path that is not strictly perpendicular to one axis is going to be difficult, if not impossible, with a PIC. Controlling motion in 3 axes would probably be difficult on even a high end uC. Most CNC applications use a PC with an interrupt rate at least 25 kHz. Steps (or potential steps) are calculated at each interrupt. Doing nothing else, you have 200 instructions (800 cycles) to get it done.

Quoting the Mach3 manual:
Mach3 must be able to send very accurately timed signals to control the axes of the machine tool.
...
Furthermore, to do this at the high speeds possibly required (each axis may be given attention
up to 100,000 times per second), the driver needs to tune its own code.

End Of Quote

If I were building this, I would use a PC with Mach3 software, and, depending on stepper motor size, a HobbyCNC Pro stepper board. That would take care of my X,Y and Z motion.

http://www.hobbycnc.com/products/hobbycnc-pro-chopper-driver-board-kits/

The weave pattern is going to be difficult. It could be added in CAD, I suppose but I certainly don't know how. Maybe the weave rate is constant so long as the CNC machine moves at a constant velocity. Unfortunately, it doesn't because it accelerates and decelerates on every change in direction.

Weave is simple when welding parallel to an axis. Welding on a diagonal seems more difficult.

Maybe there could be an A axis for rotating the weld head parallel to the Y axis. Maybe that could be driven by a PIC but how would it know what the X and Y axes were doing. Maybe it would be good to have the PIC look at the X and Y steps and come up with some kind of weave algorithm. And, technically, the Z axis needs to be involved with the weave to keep the arc length constant.

Or, I would throw out everything I mentioned and build a very special purpose motion controller with an FPGA. I would have the speed necessary for controlling the steppers, I could come up with an algorithm for linking the Z and A axes to create the weave. I could modulate the weave depending on the vector velocity of the X-Y axes. But, man, is this a lot of work.

That's about the limit of my thoughts on this project. Fortunately, I don't have to build it...

Richard



to unsubscribe, go to http://www.yahoogroups.com and follow the instructions
Dear Richard,

Thank you very much...Your explanationis really helpful for me to proceed in right direction....

Thanks,

Amit

--- On Sat, 6/27/09, rtstofer wrote:
From: rtstofer
Subject: [piclist] Re: 4 Independent frequency controllable step signal generation from PIC for stepper motors
To: p...
Date: Saturday, June 27, 2009, 11:30 PM

--- In piclist@yahoogroups .com, AMIT KAPOOR wrote:
> Hello Richard,
>
> I am making 4 axis linear guide simulator for welding carriage using stepper motor...travelling, height control, rotation and weaving(tovn fro motion)...problem is i want PIC to do other jobs also( buttons input control from control panel etc) but i dont know how to make PIC do the step generation role in background and be free for receiving inputs ....one way is to have slave PIC do the step generation job and master take the input and other jobs control....but i really want to know how to do everything with one pic ..i hope i am clear in my explanation. ....please let me know the solutions...
>
> any help or suggestions will be great...
>
> Thanks,
>
> Amit

I think you are overestimating what can be done with a PIC - at least the mid-Range PICs.

There are a lot of PIC projects around that take a step/dir signal input and create the wave pattern for steppers. I don't think I have seen one that measured winding current.

Allegro makes stepper motor controllers like the SLA7078 3 Amp controller. These allow you to use higher motor voltages and the chip modulates the winding current. You get much better performance. See "Jones On Steppers" - Google for it.

http://www.allegrom icro.com/ en/Products/ Design/an/ 2821003.pdf

Nevertheless, doing the linear interpolation required for a path that is not strictly perpendicular to one axis is going to be difficult, if not impossible, with a PIC. Controlling motion in 3 axes would probably be difficult on even a high end uC. Most CNC applications use a PC with an interrupt rate at least 25 kHz. Steps (or potential steps) are calculated at each interrupt. Doing nothing else, you have 200 instructions (800 cycles) to get it done.

Quoting the Mach3 manual:

Mach3 must be able to send very accurately timed signals to control the axes of the machine tool.
...
Furthermore, to do this at the high speeds possibly required (each axis may be given attention
up to 100,000 times per second), the driver needs to tune its own code.

End Of Quote

If I were building this, I would use a PC with Mach3 software, and, depending on stepper motor size, a HobbyCNC Pro stepper board. That would take care of my X,Y and Z motion.

http://www.hobbycnc .com/products/ hobbycnc- pro-chopper- driver-board- kits/

The weave pattern is going to be difficult. It could be added in CAD, I suppose but I certainly don't know how. Maybe the weave rate is constant so long as the CNC machine moves at a constant velocity. Unfortunately, it doesn't because it accelerates and decelerates on every change in direction.

Weave is simple when welding parallel to an axis. Welding on a diagonal seems more difficult.

Maybe there could be an A axis for rotating the weld head parallel to the Y axis. Maybe that could be driven by a PIC but how would it know what the X and Y axes were doing. Maybe it would be good to have the PIC look at the X and Y steps and come up with some kind of weave algorithm. And, technically, the Z axis needs to be involved with the weave to keep the arc length constant.

Or, I would throw out everything I mentioned and build a very special purpose motion controller with an FPGA. I would have the speed necessary for controlling the steppers, I could come up with an algorithm for linking the Z and A axes to create the weave. I could modulate the weave depending on the vector velocity of the X-Y axes. But, man, is this a lot of work.

That's about the limit of my thoughts on this project. Fortunately, I don't have to build it...

Richard
Yes, this is well beyond what should be attempted with a PIC.
Instead have a look at 'embedded' solutions, e.g a single board computer
like
the nano-itx or similar, running DOS and QBasic for your vector motion
calculations.
(You may still need to use an additional special motor control/driver
board to get the required
step speed).
AMIT KAPOOR skrev:
>
> Dear Richard,
>
> Thank you very much...Your explanation is really helpful for me to
> proceed in right direction....
>
> Thanks,
>
> Amit
> --- On *Sat, 6/27/09, rtstofer //* wrote:
> From: rtstofer
> Subject: [piclist] Re: 4 Independent frequency controllable step
> signal generation from PIC for stepper motors
> To: p...
> Date: Saturday, June 27, 2009, 11:30 PM
>
> --- In piclist@yahoogroups .com
> ,
> AMIT KAPOOR wrote:
> >
> >
> >
> >
> >
> >
> > Hello Richard,
> >
> > I am making 4 axis linear guide simulator for welding carriage
> using stepper motor ...travelling, height control, rotation and
> weaving(tovn fro motion)...problem is i want PIC to do other jobs
> also( buttons input control from control panel etc) but i dont
> know how to make PIC do the step generation role in background and
> be free for receiving inputs ....one way is to have slave PIC do
> the step generation job and master take the input and other jobs
> control....but i really want to know how to do everything with
> one pic ..i hope i am clear in my explanation. ....please let me
> know the solutions...
> >
> > any help or suggestions will be great...
> >
> > Thanks,
> >
> > Amit
>
> I think you are overestimating what can be done with a PIC - at
> least the mid-Range PICs.
>
> There are a lot of PIC projects around that take a step/dir signal
> input and create the wave pattern for steppers. I don't think I
> have seen one that measured winding current.
>
> Allegro makes stepper motor controllers like the SLA7078 3 Amp
> controller. These allow you to use higher motor voltages and the
> chip modulates the winding current. You get much better
> performance. See "Jones On Steppers" - Google for it.
>
> http://www.allegrom icro.com/ en/Products/ Design/an/ 2821003.pdf
> Nevertheless, doing the linear interpolation required for a path
> that is not strictly perpendicular to one axis is going to be
> difficult, if not impossible, with a PIC. Controlling motion in 3
> axes would probably be difficult on even a high end uC. Most CNC
> applications use a PC with an interrupt rate at least 25 kHz.
> Steps (or potential steps) are calculated at each interrupt. Doing
> nothing else, you have 200 instructions (800 cycles) to get it done.
>
> Quoting the Mach3 manual:
>
> Mach3 must be able to send very accurately timed signals to
> control the axes of the machine tool.
> ...
> Furthermore, to do this at the high speeds possibly required (each
> axis may be given attention
> up to 100,000 times per second), the driver needs to tune its own
> code.
>
> End Of Quote
>
> If I were building this, I would use a PC with Mach3 software,
> and, depending on stepper motor size, a HobbyCNC Pro stepper
> board. That would take care of my X,Y and Z motion.
>
> http://www.hobbycnc .com/products/ hobbycnc- pro-chopper-
> driver-board- kits/
> The weave pattern is going to be difficult. It could be added in
> CAD, I suppose but I certainly don't know how. Maybe the weave
> rate is constant so long as the CNC machine moves at a constant
> velocity. Unfortunately, it doesn't because it accelerates and
> decelerates on every change in direction.
>
> Weave is simple when welding parallel to an axis. Welding on a
> diagonal seems more difficult.
>
> Maybe there could be an A axis for rotating the weld head parallel
> to the Y axis. Maybe that could be driven by a PIC but how would
> it know what the X and Y axes were doing. Maybe it would be good
> to have the PIC look at the X and Y steps and come up with some
> kind of weave algorithm. And, technically, the Z axis needs to be
> involved with the weave to keep the arc length constant.
>
> Or, I would throw out everything I mentioned and build a very
> special purpose motion controller with an FPGA. I would have the
> speed necessary for controlling the steppers, I could come up with
> an algorithm for linking the Z and A axes to create the weave. I
> could modulate the weave depending on the vector velocity of the
> X-Y axes. But, man, is this a lot of work.
>
> That's about the limit of my thoughts on this project.
> Fortunately, I don't have to build it...
>
> Richard
>

--
*******************************************
VISIT MY HOME PAGE:

LAST UPDATED: 23/08/2003
*******************************************
Regards
Eirik Karlsen
Can
http://www.intellasys.net/index.php?option=com_content&task=view&id`&Itemidu
be used for this Job ?

Regards

Tem

----- Original Message -----
From: Eirik Karlsen
To: p...
Sent: Tuesday, June 30, 2009 5:18 AM
Subject: Re: [piclist] Re: 4 Independent frequency controllable step signal
generation from PIC for stepper motors

Yes, this is well beyond what should be attempted with a PIC.
Instead have a look at 'embedded' solutions, e.g a single board computer
like
the nano-itx or similar, running DOS and QBasic for your vector motion
calculations.
(You may still need to use an additional special motor control/driver board
to get the required
step speed).
AMIT KAPOOR skrev:

Dear Richard,

Thank you very much...Your explanation is really helpful for me to
proceed in right direction....

Thanks,

Amit
--- On Sat, 6/27/09, rtstofer wrote:
From: rtstofer
Subject: [piclist] Re: 4 Independent frequency controllable step
signal generation from PIC for stepper motors
To: p...
Date: Saturday, June 27, 2009, 11:30 PM
--- In piclist@yahoogroups .com, AMIT KAPOOR
wrote:
>
>
>
>
>
>
> Hello Richard,
>
> I am making 4 axis linear guide simulator for welding carriage
using stepper motor ...travelling, height control, rotation and weaving(tovn
fro motion)...problem is i want PIC to do other jobs also( buttons input
control from control panel etc) but i dont know how to make PIC do the step
generation role in background and be free for receiving inputs ....one way
is to have slave PIC do the step generation job and master take the input
and other jobs control....but i really want to know how to do everything
with one pic ..i hope i am clear in my explanation. ....please let me know
the solutions...
>
> any help or suggestions will be great...
>
> Thanks,
>
> Amit

I think you are overestimating what can be done with a PIC - at
least the mid-Range PICs.

There are a lot of PIC projects around that take a step/dir signal
input and create the wave pattern for steppers. I don't think I have seen
one that measured winding current.

Allegro makes stepper motor controllers like the SLA7078 3 Amp
controller. These allow you to use higher motor voltages and the chip
modulates the winding current. You get much better performance. See "Jones
On Steppers" - Google for it.

http://www.allegrom icro.com/ en/Products/ Design/an/ 2821003.pdf

Nevertheless, doing the linear interpolation required for a path
that is not strictly perpendicular to one axis is going to be difficult, if
not impossible, with a PIC. Controlling motion in 3 axes would probably be
difficult on even a high end uC. Most CNC applications use a PC with an
interrupt rate at least 25 kHz. Steps (or potential steps) are calculated at
each interrupt. Doing nothing else, you have 200 instructions (800 cycles)
to get it done.

Quoting the Mach3 manual:

Mach3 must be able to send very accurately timed signals to
control the axes of the machine tool.
...
Furthermore, to do this at the high speeds possibly required (each
axis may be given attention
up to 100,000 times per second), the driver needs to tune its own
code.

End Of Quote

If I were building this, I would use a PC with Mach3 software,
and, depending on stepper motor size, a HobbyCNC Pro stepper board. That
would take care of my X,Y and Z motion.

http://www.hobbycnc .com/products/ hobbycnc- pro-chopper-
driver-board- kits/

The weave pattern is going to be difficult. It could be added in
CAD, I suppose but I certainly don't know how. Maybe the weave rate is
constant so long as the CNC machine moves at a constant velocity.
Unfortunately, it doesn't because it accelerates and decelerates on every
change in direction.

Weave is simple when welding parallel to an axis. Welding on a
diagonal seems more difficult.

Maybe there could be an A axis for rotating the weld head parallel
to the Y axis. Maybe that could be driven by a PIC but how would it know
what the X and Y axes were doing. Maybe it would be good to have the PIC
look at the X and Y steps and come up with some kind of weave algorithm.
And, technically, the Z axis needs to be involved with the weave to keep the
arc length constant.

Or, I would throw out everything I mentioned and build a very
special purpose motion controller with an FPGA. I would have the speed
necessary for controlling the steppers, I could come up with an algorithm
for linking the Z and A axes to create the weave. I could modulate the weave
depending on the vector velocity of the X-Y axes. But, man, is this a lot of
work.

That's about the limit of my thoughts on this project.
Fortunately, I don't have to build it...

Richard

--
*******************************************
VISIT MY HOME PAGE:

LAST UPDATED: 23/08/2003
*******************************************
Regards
Eirik Karlsen
Can't tell... I've never used or even seen such a brute of a MCU before.
Another question is; suppose you have a capable MCU at hand...can you
even program such high level vector motion routines in 'machine code' ?
What initially may seem doable, or even simple, may soon turn out to
be very complicated once you have to deal with all the details. On the
other hand a simple welding robot would be much simpler to get working than
a high speed high precision 3-axis cnc mill.
Temtu skrev:
> Can
> http://www.intellasys.net/index.php?option=com_content&task=view&id`&Itemidu
> be
> used for this Job ?
>
> Regards
>
> Tem
>
> ----- Original Message -----
> *From:* Eirik Karlsen
> *To:* p...
> *Sent:* Tuesday, June 30, 2009 5:18 AM
> *Subject:* Re: [piclist] Re: 4 Independent frequency controllable step
> signal generation from PIC for stepper motors
>
> Yes, this is well beyond what should be attempted with a PIC.
> Instead have a look at 'embedded' solutions, e.g a single board
> computer like
> the nano-itx or similar, running DOS and QBasic for your vector motion
> calculations.
> (You may still need to use an additional special motor control/driver
> board to get the required
> step speed).
> AMIT KAPOOR skrev:
>
>>
>> Dear Richard,
>>
>> Thank you very much...Your explanation is really helpful for me to
>> proceed in right direction....
>>
>> Thanks,
>>
>> Amit
>> --- On *Sat, 6/27/09, rtstofer //* wrote:
>> From: rtstofer
>> Subject: [piclist] Re: 4 Independent frequency controllable step
>> signal generation from PIC for stepper motors
>> To: p...
>> Date: Saturday, June 27, 2009, 11:30 PM
>>
>> --- In piclist@yahoogroups .com
>> ,
>> AMIT KAPOOR wrote:
>> >
>> >
>> >
>> >
>> >
>> >
>> > Hello Richard,
>> >
>> > I am making 4 axis linear guide simulator for welding carriage
>> using stepper motor ...travelling, height control, rotation and
>> weaving(tovn fro motion)...problem is i want PIC to do other
>> jobs also( buttons input control from control panel etc) but i
>> dont know how to make PIC do the step generation role in
>> background and be free for receiving inputs ....one way is to
>> have slave PIC do the step generation job and master take the
>> input and other jobs control....but i really want to know how to
>> do everything with one pic ..i hope i am clear in my explanation.
>> ....please let me know the solutions...
>> >
>> > any help or suggestions will be great...
>> >
>> > Thanks,
>> >
>> > Amit
>>
>> I think you are overestimating what can be done with a PIC - at
>> least the mid-Range PICs.
>>
>> There are a lot of PIC projects around that take a step/dir
>> signal input and create the wave pattern for steppers. I don't
>> think I have seen one that measured winding current.
>>
>> Allegro makes stepper motor controllers like the SLA7078 3 Amp
>> controller. These allow you to use higher motor voltages and the
>> chip modulates the winding current. You get much better
>> performance. See "Jones On Steppers" - Google for it.
>>
>> http://www.allegrom icro.com/ en/Products/ Design/an/ 2821003.pdf
>>
>>
>> Nevertheless, doing the linear interpolation required for a path
>> that is not strictly perpendicular to one axis is going to be
>> difficult, if not impossible, with a PIC. Controlling motion in 3
>> axes would probably be difficult on even a high end uC. Most CNC
>> applications use a PC with an interrupt rate at least 25 kHz.
>> Steps (or potential steps) are calculated at each interrupt.
>> Doing nothing else, you have 200 instructions (800 cycles) to get
>> it done.
>>
>> Quoting the Mach3 manual:
>>
>> Mach3 must be able to send very accurately timed signals to
>> control the axes of the machine tool.
>> ...
>> Furthermore, to do this at the high speeds possibly required
>> (each axis may be given attention
>> up to 100,000 times per second), the driver needs to tune its own
>> code.
>>
>> End Of Quote
>>
>> If I were building this, I would use a PC with Mach3 software,
>> and, depending on stepper motor size, a HobbyCNC Pro stepper
>> board. That would take care of my X,Y and Z motion.
>>
>> http://www.hobbycnc .com/products/ hobbycnc- pro-chopper-
>> driver-board- kits/
>>
>>
>> The weave pattern is going to be difficult. It could be added in
>> CAD, I suppose but I certainly don't know how. Maybe the weave
>> rate is constant so long as the CNC machine moves at a constant
>> velocity. Unfortunately, it doesn't because it accelerates and
>> decelerates on every change in direction.
>>
>> Weave is simple when welding parallel to an axis. Welding on a
>> diagonal seems more difficult.
>>
>> Maybe there could be an A axis for rotating the weld head
>> parallel to the Y axis. Maybe that could be driven by a PIC but
>> how would it know what the X and Y axes were doing. Maybe it
>> would be good to have the PIC look at the X and Y steps and come
>> up with some kind of weave algorithm. And, technically, the Z
>> axis needs to be involved with the weave to keep the arc length
>> constant.
>>
>> Or, I would throw out everything I mentioned and build a very
>> special purpose motion controller with an FPGA. I would have the
>> speed necessary for controlling the steppers, I could come up
>> with an algorithm for linking the Z and A axes to create the
>> weave. I could modulate the weave depending on the vector
>> velocity of the X-Y axes. But, man, is this a lot of work.
>>
>> That's about the limit of my thoughts on this project.
>> Fortunately, I don't have to build it...
>>
>> Richard
>>
>> --
> *******************************************
> VISIT MY HOME PAGE:
>
> LAST UPDATED: 23/08/2003
> *******************************************
> Regards
> Eirik Karlsen
>
>

--
*******************************************
VISIT MY HOME PAGE:

LAST UPDATED: 23/08/2003
*******************************************
Regards
Eirik Karlsen
--- In p..., "Temtu" wrote:
>
> Can
> http://www.intellasys.net/index.php?option=com_content&task=view&id`&Itemidu
> be used for this Job ?
>
> Regards
>
> Tem

I think I am a little too old to start messing with Forth again. Many years ago (say 1980 or so) I saw Forth used for disk drive device testing and became attracted to the way new tests could be based on lower level tests, just by saying so in an interactive manner. Very clever.

But I don't think I care to go there again.

Richard