Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

Stepper / AVR Project

Stepper / AVR Project

2013-04-28 by Bernie

Hi,

I have implemented a project using an ATMega328 to drive a stepper motor. Once the motor has reached the position required, I don't need it to move any more for say, 10 minutes at a time.

The motor is taking current 100% of the time of course.

I'd like to turn the power to the motor off, then the next time I need to move the load, start it up again without having lost the position information.  Holding torque is not a concern.

I've tried this using the simple means of bringing the four outputs from the AVR low. When it comes to step the motor again, the first few pulses do not have any effect on the motor, so I lose steps and now don't know where the motor is - necessitating a reset cycle to bring it back to a limit switch.

On making that first step after its been switch off, I've tried every possible beginning step sequence but can't get the right result.

I'm coming to the conslusion that it can't be done. If you want to keep position intact, then don't turn off the outputs. If you do turn off the outputs you have to find its position again by sending it off to the limit switch.

There may be other approaches by using more sophisticated hardware but at the moment the question relates to using this simple means of control as it has the lowest component costs.

I'd be grateful if anyone here could comment. Apologies if its more a stepper question than an AVR question but I'm thinking that its relevant to many AVR users.

Regards

Bernie McIntosh

Re: [AVR-Chat] Stepper / AVR Project

2013-04-28 by David VanHorn

You need to.keep a var with the old output state just before you turned
them off. Then restore that before moving.
On Apr 28, 2013 10:50 AM, "Bernie" <berniemcintosh@yahoo.es> wrote:

> Hi,
>
> I have implemented a project using an ATMega328 to drive a stepper motor.
> Once the motor has reached the position required, I don't need it to move
> any more for say, 10 minutes at a time.
>
> The motor is taking current 100% of the time of course.
>
> I'd like to turn the power to the motor off, then the next time I need to
> move the load, start it up again without having lost the position
> information.  Holding torque is not a concern.
>
> I've tried this using the simple means of bringing the four outputs from
> the AVR low. When it comes to step the motor again, the first few pulses do
> not have any effect on the motor, so I lose steps and now don't know where
> the motor is - necessitating a reset cycle to bring it back to a limit
> switch.
>
> On making that first step after its been switch off, I've tried every
> possible beginning step sequence but can't get the right result.
>
> I'm coming to the conslusion that it can't be done. If you want to keep
> position intact, then don't turn off the outputs. If you do turn off the
> outputs you have to find its position again by sending it off to the limit
> switch.
>
> There may be other approaches by using more sophisticated hardware but at
> the moment the question relates to using this simple means of control as it
> has the lowest component costs.
>
> I'd be grateful if anyone here could comment. Apologies if its more a
> stepper question than an AVR question but I'm thinking that its relevant to
> many AVR users.
>
> Regards
>
> Bernie McIntosh
>
>
>
>
>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>


[Non-text portions of this message have been removed]

Re: [AVR-Chat] Stepper / AVR Project

2013-04-28 by David VanHorn

Now from a real keyboard:

As long as the motor hasn't moved, then re-energizing with the same states,
and accelerating from there will work.  If the motor could move, then you
will need some sort of position information from an encoder or some such.

If you are using the port to keep your output states, that's part of your
problem.
Use a ram variable, and copy that out to the port when you change states.
Then when you power down, the ram variable knows where you were, just
output that to the port again, and carry on from there.  Make sense?



On Sun, Apr 28, 2013 at 12:24 PM, David VanHorn <microbrix@gmail.com> wrote:

> You need to.keep a var with the old output state just before you turned
> them off. Then restore that before moving.
> On Apr 28, 2013 10:50 AM, "Bernie" <berniemcintosh@yahoo.es> wrote:
>
>> Hi,
>>
>> I have implemented a project using an ATMega328 to drive a stepper motor.
>> Once the motor has reached the position required, I don't need it to move
>> any more for say, 10 minutes at a time.
>>
>> The motor is taking current 100% of the time of course.
>>
>> I'd like to turn the power to the motor off, then the next time I need to
>> move the load, start it up again without having lost the position
>> information.  Holding torque is not a concern.
>>
>> I've tried this using the simple means of bringing the four outputs from
>> the AVR low. When it comes to step the motor again, the first few pulses do
>> not have any effect on the motor, so I lose steps and now don't know where
>> the motor is - necessitating a reset cycle to bring it back to a limit
>> switch.
>>
>> On making that first step after its been switch off, I've tried every
>> possible beginning step sequence but can't get the right result.
>>
>> I'm coming to the conslusion that it can't be done. If you want to keep
>> position intact, then don't turn off the outputs. If you do turn off the
>> outputs you have to find its position again by sending it off to the limit
>> switch.
>>
>> There may be other approaches by using more sophisticated hardware but at
>> the moment the question relates to using this simple means of control as it
>> has the lowest component costs.
>>
>> I'd be grateful if anyone here could comment. Apologies if its more a
>> stepper question than an AVR question but I'm thinking that its relevant to
>> many AVR users.
>>
>> Regards
>>
>> Bernie McIntosh
>>
>>
>>
>>
>>
>>
>>
>>
>> ------------------------------------
>>
>> Yahoo! Groups Links
>>
>>
>>
>>


[Non-text portions of this message have been removed]

Re: Stepper / AVR Project

2013-05-01 by Bernie

Seems kinda obvious now, but I wasn't getting there on my own  [:">]

Thanks for taking the trouble to write. Will give it a go.

Cheers

Bernie





--- In AVR-Chat@yahoogroups.com, David VanHorn  wrote:
>
> Now from a real keyboard:
>
> As long as the motor hasn't moved, then re-energizing with the same
states,
> and accelerating from there will work.  If the motor could move, then
you
> will need some sort of position information from an encoder or some
such.
>
> If you are using the port to keep your output states, that's part of
your
> problem.
> Use a ram variable, and copy that out to the port when you change
states.
> Then when you power down, the ram variable knows where you were, just
> output that to the port again, and carry on from there.  Make sense?
>
>
>
> On Sun, Apr 28, 2013 at 12:24 PM, David VanHorn microbrix@... wrote:
>
> > You need to.keep a var with the old output state just before you
turned
> > them off. Then restore that before moving.
> > On Apr 28, 2013 10:50 AM, "Bernie" berniemcintosh@... wrote:
> >
> >> Hi,
> >>
> >> I have implemented a project using an ATMega328 to drive a stepper
motor.
> >> Once the motor has reached the position required, I don't need it
to move
> >> any more for say, 10 minutes at a time.
> >>
> >> The motor is taking current 100% of the time of course.
> >>
> >> I'd like to turn the power to the motor off, then the next time I
need to
> >> move the load, start it up again without having lost the position
> >> information.  Holding torque is not a concern.
> >>
> >> I've tried this using the simple means of bringing the four outputs
from
> >> the AVR low. When it comes to step the motor again, the first few
pulses do
> >> not have any effect on the motor, so I lose steps and now don't
know where
> >> the motor is - necessitating a reset cycle to bring it back to a
limit
> >> switch.
> >>
> >> On making that first step after its been switch off, I've tried
every
> >> possible beginning step sequence but can't get the right result.
> >>
> >> I'm coming to the conslusion that it can't be done. If you want to
keep
> >> position intact, then don't turn off the outputs. If you do turn
off the
> >> outputs you have to find its position again by sending it off to
the limit
> >> switch.
> >>
> >> There may be other approaches by using more sophisticated hardware
but at
> >> the moment the question relates to using this simple means of
control as it
> >> has the lowest component costs.
> >>
> >> I'd be grateful if anyone here could comment. Apologies if its more
a
> >> stepper question than an AVR question but I'm thinking that its
relevant to
> >> many AVR users.
> >>
> >> Regards
> >>
> >> Bernie McIntosh
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> ------------------------------------
> >>
> >> Yahoo! Groups Links
> >>
> >>
> >>
> >>
>
>
> [Non-text portions of this message have been removed]
>



[Non-text portions of this message have been removed]

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.