Yahoo Groups archive

AVR-Chat

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

Thread

help requested......code for bipolar stepper motor implementation.

help requested......code for bipolar stepper motor implementation.

2005-02-06 by sricharan999

Hello,

    Iam a student of electronics & communication engineering. Iam 
working on a project titled Infrared Tracking system using AVR 
ATMega32 Ucontroller on STK 500 starter kit.

      The objective of our project is to track a mobile object 
continuously and to display its position on a television. A beacon, 
placed on the object to be tracked, continuously emits infrared 
signals in all directions. The signals coming from the beacon are 
detected by 2 IR receivers mounted on 2 stepper motors, which rotate 
independently and are in separate locations. The direction each 
receiver is pointing towards, allows the CPU to determine the 
position of the beacon via triangulation. The position of the tracked 
object is then displayed on the TV, where the center point is the 
middle point of the 2 receivers.

     Iam stuck at coding the stepper motor drive. I need some help on 
implementing a bipolar stepper motor and writing its code to program 
the microcontroller. The stepper motor has to generate a sweeping 
pattern to find the location of the object...Iam in need of help from 
some experienced avr programmers. Also suggest me some links for 
bipolar stepper motor codes...

Thanks a lot in advance...
Cherry.

Re: [AVR-Chat] help requested......code for bipolar stepper motor implementation.

2005-02-06 by Stefan Trethan

>     Iam stuck at coding the stepper motor drive. I need some help on
> implementing a bipolar stepper motor and writing its code to program
> the microcontroller. The stepper motor has to generate a sweeping
> pattern to find the location of the object...Iam in need of help from
> some experienced avr programmers. Also suggest me some links for
> bipolar stepper motor codes...
> Thanks a lot in advance...
> Cherry.


Look for "control of stepping motors" by douglas jones, you can easily  
find it with google.
It has all you will need.

The IR detectors are no heavy load, so you can use the simplest and  
smallest circuit (because you don't need any design that allows high power  
or faster speed). You will have H-bridges to drive the motor, but the  
document by Douglas Jones will tell you all you need to know about it.

Of course you will need some more or less clever software to do the  
sweeping and looking, but i think that is your task. A simple solution  
could be to just continously rotate the sensor, and determine where the  
signal was strongest. Better methods might be once the position is know  
the sensor tracks the source, only sweeping a smaller angle. Another hint  
would be that you might want a absolute position sensor for your motor  
(zero position). i mention it because it is important for hardware design  
and should be known early. A light barrier switch works well for that.

I don't think you need to find any existing stepper motor control codes,  
you will be faster making your own, it is just output of a fixed pattern,  
no more.


ST

Re: [AVR-Chat] help requested......code for bipolar stepper motor implementation.

2005-02-06 by Dave VanHorn

First, what electronics are you using to drive the stepper?
You'll need some sort of stepper chip to handle the current, unless you use 
open collector drivers, and a unipolar stepper.

With bipolar, you may need as little as two output bits on the AVR.

You need to drive them in quadrature, according to an acceleration and 
deceleration table, which means you'll need a timer involved to tell you 
when to make your next step.

The simplest way is to write a table into rom containing the acceleration 
time values that you'll load into your timer.

Then, assuming you're not moving already, you pick your direction, output 
the bits, and output the timer value to the timer.
When the timer int happens, you change to the next stepper state, and load 
the next accel value into the timer.

You keep doing this till you're halfway "there", then decelerate along the 
same table, so that when you arrive at the destination you're on step 0 
again.

This is not necessarily the fastest approach, but it's simple.

During moving, if you hit the end of the accel table, then you just stay at 
that max speed, until you're N steps from your destination, where N is the 
length of the accel table.

When you arrive, then if there's no load fighting you, you can turn off the 
motor current.

Re: [AVR-Chat] help requested......code for bipolar stepper motor implementation.

2005-02-06 by Stefan Trethan

On Sun, 06 Feb 2005 12:30:34 -0500, Dave VanHorn <dvanhorn@dvanhorn.org>  
wrote:

>
> This is not necessarily the fastest approach, but it's simple.

> During moving, if you hit the end of the accel table, then you just stay  
> at
> that max speed, until you're N steps from your destination, where N is  
> the
> length of the accel table.
> When you arrive, then if there's no load fighting you, you can turn off  
> the
> motor current.

Well, i would say the simplest approach is to stay at a low speed for now,  
without acceleration table.
The IR receivers are probably low enough a load to drive at a fixed speed  
if the motor isn't too small. You can always add such nice features later.

ST

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.