Unless you are counting steps (and have limits preset), I see no way of detecting end of travel of your blind, which means you can drive it beyond it's stop position in either open or close mode.
 
 
		Unless you are counting steps (and have limits preset), I see no way of detecting end of travel of your blind, which means you can drive it beyond it's stop position in either open or close mode.
 
 
		I tried this code but the motor also seems to rotate without stop.
I thought it's possible to count the motor step (limit the step). Is there anyway to achieve this?
I've thinking again, how about use the inside sensor, double the sensor to set the stop position. When the blind is open and the 2nd sensor which is located in the room detect the light, it will stop the motor. This is meant the 1st sensor use to start the motor and 2nd sensor use to stop the motor.
Same thing goes to close operation. if the outside = 0 and the inside = 0 the blind will close.
to summary this,
open operation:
1st sensor = 1 (motor start) then 2nd sensor = 1 (motor stop)
close operation:
1st sensor = 0 (motor start) then 2nd sensor = 0 (motor stop)
My question is, how can i use any label that prevent the motor spinning like the stop/pause function?
 
 
		I forgot to say i needs to be a word size variable, as a byte it can never reach 500
If you do not have a preset limit like Melanie mentioned you can make the stepper stop, but it may not always stop in the exact same place. If there is some drag on the mechanism for example.I thought it's possible to count the motor step (limit the step). Is there anyway to achieve this?
You could use a light sensor, but what if there is enough light to start but not stop. Or attach a couple of micro limit switched that a hit on full open or full close. There are many ways to make some sort of encoder. If the blind are only rotating 90 degrees a pot fixed to a blade may work.
Dave
Always wear safety glasses while programming.
 
 
		<b>Open Loop Solution</b>
How powerful is that stepper motor? You know what happens to a stepper motor when it stalls? At worst it demagnetizes, at best, nothing.
Stepper motors have no commutator, no brushes, no sparks, no increase in current (to speak of), very unlike a brushed motor which gets very Ticked Off when it stalls. So here is a thought, rig up a counter and count the steps between the ends of travel, and drive your motor that many steps + a few extra.
Last edited by Archangel; - 5th November 2008 at 06:14.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
 
 
		A common trick is to logically AND the limit switches with one of the phases.
That way the stepper will always stop in the same place, and the position sensitivity of the limit switch (or opto) is decreased by at least 4.
This is easy to do in software.
Charles Linquist
Bookmarks