Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Setting stepper motor to 'home' position.

Status
Not open for further replies.

MrNobody

New Member
Hi..
I am driving a stepper motor directly from a microcontroller. The microcontroller I am using has a built in stepper motor controller which enables me to do so.. attached to the motor is a needle like device which rotates, similar to the speedometer of the car.

In this project, while the stepper motor is running, the supply power to the mirocontroller can be cut off anytime meaning that without warning, the stepper motor will be left hanging when the power is cut off..
When the microcontroller is powered on again, the stepper motor need to return to the 'home' position because the home position is the reference point.

At the moment, the temporary solution that I am using is to turn the stepper motor in the reversed direction for a certain period until it is certain that the needle has reached the home position.. Because the position of the stepper motor is not know after the microcon is powered up, often than not, the needle of the stepper motor move past the home position and that is not desirable.

Is there any idea on how to move the needle of the stepper motor back to home without overshooting the home position..?
Thanks in advance..
 
hi,
Is the stepper motor half or full step and whats the angular movement per step.
I assume that you are programming the MCU, what type is it?
 
MrNobody said:
Is there any idea on how to move the needle of the stepper motor back to home without overshooting the home position..?
Thanks in advance..

There's no way to do it, without extra hardware - either physical or electronic.

One (crude method) is to have a mechanical end stop - and your program simply hammers the motor against the endstop more times than it will ever need to - the Commodore C64 disk drive did this, hammered the head against the endstop 256 times (for a maximum 40 or 80 track disk).

A slightly less crude method would be to have a limit switch, and step it back until the limit switch is activated.

But basically you can't do it just with the stepper motor, you need to add 'something' to let you know it's position.
 
A crude way, which only works 99% of times, is to record the number of steps send to the motor in memory of the microcontroller.

Once a power off condition is detected, this number of steps away from HOME is written to non-volatile memory before the power is completely gone. On the next power up, the microcontroller can then use this data to move the motor back to home position.

This is assuming the motor doesn't skip steps, sufficient power remaining after detecting power off situation and there is non-volatile memory like EEPROM available.

Can't beat the simple and fail safe limit switch approach.
 
Sensing the passage of the needle between two fotosensors? When in between, it's home.

Ajusting could be delicate but not impossible. It works.
 
Thanks guys for your replies

ericgibbs:
using it in full step mode with 1 degree per step. Will be using Fujitsu MB90594 microcontroller

eblc1388:
i like ur idea.. what is the chances of it not skipping steps..? Its hard to say right, when the motor moves for few hours going back and forth.. Come to think of it, the only way the motor will skip some steps is when the load is heavy right..? actually, the load that is attached to the motor is a light plastic needle..

Nigel Goodwin:
yeah.. limiting switch is another possibility but it involves tampering with the hardware tho.. hmm...

Anyway.. wondering, is there any way to maybe, measure the back emf and from the back emf, determine the position of the motor..? The motor will not go more than 360 degrees, maybe the maximum is up to 270 degrees. I mean, each position of the motor will experience different amount of back emf rite..?

just throwing some ideas.
 
MrNobody said:
Thanks guys for your replies

ericgibbs:
using it in full step mode with 1 degree per step. Will be using Fujitsu MB90594 microcontroller

eblc1388:
i like ur idea.. what is the chances of it not skipping steps..? Its hard to say right, when the motor moves for few hours going back and forth.. Come to think of it, the only way the motor will skip some steps is when the load is heavy right..? actually, the load that is attached to the motor is a light plastic needle..

Nigel Goodwin:
yeah.. limiting switch is another possibility but it involves tampering with the hardware tho.. hmm...

Anyway.. wondering, is there any way to maybe, measure the back emf and from the back emf, determine the position of the motor..? The motor will not go more than 360 degrees, maybe the maximum is up to 270 degrees. I mean, each position of the motor will experience different amount of back emf rite..?

A stepper rotates fully, there's no limit - and as I've already explained, there's no way to do it without some extra hardware
 
Nigel Goodwin:
i understand that stepper motor rotates fully.. what I mean by rotating not more than 270 degrees is that, before it reach 270 degrees, it is reversed and before it reaches 0, it rotates forward again.. kinda like the speedometer on the car.. it never actually rotates a full 360 degrees..
 
MrNobody said:
Thanks guys for your replies

ericgibbs:
using it in full step mode with 1 degree per step. Will be using Fujitsu MB90594 microcontroller

Anyway.. wondering, is there any way to maybe, measure the back emf and from the back emf, determine the position of the motor..? The motor will not go more than 360 degrees, maybe the maximum is up to 270 degrees. I mean, each position of the motor will experience different amount of back emf rite..?

just throwing some ideas.

If the same 'loading' is on the motor shaft throughout the 270deg movement, why would you expect a different back emf from individual steps??

Perhaps if you could tell us about the actual application, rather than comparing it to a speedo, which normally returns to the zero/start position.

We maybe able to suggest external ways of determining the shaft position.

EDIT: Its the version without the 340deg end stops
https://www.electro-tech-online.com/custompdfs/2007/09/357.pdf
 
Last edited:
ok.. to be exact, it is a speedometer..
the bipolar stepper motor has 4 terminals..
in using microstepping mode, its angle per step is 0.083 degrees
and in full stepping mode, the angle will be 1 degree per step.

for simplicity sake, i'll jst use it in full stepping mode for now..

when the stepper motor reach the home position, the pointer/rotor will be at stationary position and because of that, the current at that period of time will be higher than the other times. since while driving the stepper motor, there are times where one of the coils is not used to drive the motor, that coil can quickly be used to get the back emf/current of the stepper motor. This current can then be compared to a reference current and if the current is higher than usual, then it can safely be said that the pointer has reached the home position..

thats the concept i have at the moment..
 
hi,
So you saying measure the end stop stall current of the motor?

As suggested already, it would be easy just to try it.
 
ericgibbs said:
hi,
So you saying measure the end stop stall current of the motor?

As suggested already, it would be easy just to try it.

I've seen that method used commercially by Texas Instruments in their silent 700 series of thermal dot matrix printers made in the early 70s. At start up they would move the stepper driven print head several steps in one direction to be sure they were away from the mechanical hard stop and then step the other direction towards the mechanical stop. When it detected stall current being drawn by the stepper driver circuit it would stop stepping and initialize it's print head position counter to 'zero'. The stepper motor had a slotted optical disc that the printer used to increment or decrement the print head position counter. This was all done with discrete 7400 TTL logic as it was before micros became available for embedded functions like this.

Lefty
 
Finally.. after days of experimenting, it works.. The motor is able to stop at the home position.
A few changes that I made are, I am now driving in microstep using PWM and I am measuring the backemf instead of current..

First, I hook the motor to the oscilloscope and get the waveform of the back emf at different steps. During certain steps, there are significant difference in the back emf of the motor while it is moving compared to while it is stopped; but in other steps, there is no difference..
What I found is that at one particular step, the pulse width of the back emf while moving is thinner, about 100us but when it stops (reaching the home position), the width increases to about 175us to 200us. So, what I did was just to measure the width of the back emf and if it is more than certain point, i just stop the motor.

Tested it lots of times (maybe around 50) and it stopped every single time when it reached the home position.
 
[MODNOTE]Please stop reviving old threads....[/MODNOTE]
 
Last edited by a moderator:
when the stepper motor reach the home position, the pointer/rotor will be at stationary position and because of that, the current at that period of time will be higher than the other times.
Not sure about that. Current rises and falls at each step, and without end stops there seems to be nothing to distinguish one step from another. Besides, even if there was a distinction, if the speed stays constant for a certain time wouldn't that be interpreted as a false home position?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top