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.

Control of a stepper motor? Need to index position

Status
Not open for further replies.

fastline

Member
I am working on a simple automation project. I will require some type of motor (likely stepper) to fairly precisely index positions, hold that position for a variable amount of time, then index again and continue that.

I have found simple geared steppers and control boards on ebay cheap but I have NO idea how they are being controlled. I am very familiar with CNC machines so I know sort of how the stepper works. I would reach for a servo motor just for more familiarity but that is likely WAY overkill for this and a stepper seems the right choice here. .5* index accuracy will work fine for this.

I do not require any rotational torque other than that to overcome friction. I am, however, a bit concerned about "skipped steps" that seems common in stepper tuning during accel or deceleration. I do not really want to hassle with encoder feedback.

I would also consider other indexing ideas rather than the stepper. That just came to mind.

EDIT: I should add that one hurdle and issue with this is I need something that will possibly be current limited so if something stalls the rotation, it will not destroy itself. Also, there is likelihood that something will stall the rotation and I need to figure out a way to get the motor back into correct position, add feedback so the motor will know it did not rotate enough due to obstruction, or add some type of "in position" signals at each index directly. I guess in that respect, I could just use a basic motor and have the power turn off when in position.
 
Last edited:
The systems I am familiar with use an optical beam break system, where if the system looses its index, the stepper drives the stage in one direction until it breaks the beam or runs into a mechanical stop. If it hits a stop, overcurrent is detected, and the stepper is reversed. When running through the beam break, both transitions (beam on-to-off and beam off-to-on) are averaged to calculate the index point.

This system can do stall detection intrinsically as described above. If the system is operating normally (i.e. it has no reason to think that it has lost its index), and it encounters a stall, it stops and waits for operator input.
 
Does this system seem to you like one of the easiest ways to index in rotation? I just want to make sure there is not a stupid simple way that I have not thought of. I was thinking about a simple DC gear motor with some type of switching at each index like optical, etc where the power to the motor would just stop at each index. Just not sure that is truly "easier" than the former. There is likely more adjustability with the stepper. I was also thinking of using a very cheap encoder for this which could also work. No sense in using a 1000 line encoder or anything. However, I have NO idea how to build a controller for that and I am trying to stay away from IC programming for all of this stuff.... Just want simple
 
I was doing some thinking on this and kind of wonder if using some type or other of positional feedback. I am not sure of the simplest way to send feedback to a micro controller. I think an encoder might be a hassle or maybe I can do it using less channels. My issue is that I need both stall protection and in position verification because if other functions try to initiate when it is not in position, things could go badly. If I simply have an "in position" market back to a controller, then I can allow other functions.
 
The system I described is simple to implement, especially if you are using a PIC. Use an opto-interrupter module for the beam break.
The stall detection is an output from most stepper driver ics.
 
So you are saying I need to use a dedicated stepper driver chip as well? I thought a PIC could run a dual wound stepper without issue? I have no idea how to detect an over current through...

I think I understand your opto interrupt but would you have a linky to what you propose? I was hoping to use a single device and not have to make a type of position wheel, add a light source, etc. This is kind of what an optical encoder does anyway doesn't it?
 
Last edited:
AH!! I like the interrupter and not sure if I have seen one like that. So I would indeed make a custom disc with notches?

Regarding the current monitor, you might have to explain that to me a bit. I had some type of inductive device in my head. I honestly am not sure how to even use that? How is it sensing current?
 
AH!! I like the interrupter and not sure if I have seen one like that. So I would indeed make a custom disc with notches?

The system I was describing was a stepper driven stage where the rotational output of the stepper drives a lead screw to position the stage. There is only one stage position where the opto interrupter is occluded, afaicr it was near the center of the stage travel. It takes up to thousands of steps of the motor to get to the index point.

Regarding the current monitor, you might have to explain that to me a bit. I had some type of inductive device in my head. I honestly am not sure how to even use that? How is it sensing current?

The current monitor can measure the mV drop across a few mΩ shunt resistor. Amps x mΩ = mV. The current monitor converts mV to 100s of uA, which is converted back to a voltage at the pic pin by a suitable ground-referenced resistor, hence "high-side-monitor". I would put the shunt resistor in series with the common lead on the stepping motor. Each time the Pic commands a new step, check the current to see if the motor stalled (stage hit a travel limit or another obstacle).
 
Last edited:
Thanks for the reply. If I understand you correctly on the interrupter, you are just using the device to home itself on once per rev? I will have to think more about this but my concern with the stepper was a lack of feedback so if, for some reason the motor does not rotate to the proper angle, my other functions will take off doing their thing not knowing that. Now, I guess if I have precise current monitoring, that should protect from an overload but I am trying to think of any other failure modes. It would be easy enough to run a "homing" routine in the event of overload to get things back on track and go from there.

Leave it to me to beat a project down by thinking of how many ways it can fail. Probably the aerospace in me.....lol
 
...If I understand you correctly on the interrupter, you are just using the device to home itself on once per rev? ...l

No, once per hundreds of motor shaft revolutions which is tens of thousands of motor steps. It takes thousands of steps to move the stage from one limit to the other. The PIC can count steps. When the stage is moved to the index point (which is approx. half way between limits), the counter is zeroed. After zeroing, the PIC knows that it is ok to move the stage from -5000 steps to +5000 steps (signed quantity) without bumping into either limit. As long as a step is never missed, the system always knows where it is (unless power is lost). During power up, the system must slew the stage to find the index point. During a graceful power-down, the system can slew the stage to the index point so that it knows where it is the next bootup.
 
If you have to know the absolute angular position then a shaft-encoder would seem the logical choice and avoids (or simplifies) having to 'get back on track'. They're out there, but maybe a tad expensive depending on the resolution required, if you're keen to avoid making a home-brew one.
 
The OP said:

... I do not really want to hassle with encoder feedback.

I would also consider other indexing ideas rather than the stepper. ...

If willing to use a shaft angle encoder to read absolute position, then a DC motor is more appropriate than a stepper. If wanting to use a stepper, then build the stepper controller so it doesn't miss steps, and rely on the motor's intrinsic step accuracy.
 
If wanting to use a stepper, then build the stepper controller so it doesn't miss steps, and rely on the motor's intrinsic step accuracy.
There's the rub. If no positional feedback is used and the mechanism somehow gets 'knocked off track' then there are the problems of (a) recognising that it is off track and (b) returning to a home position then re-trying to get to a target position.
 
There's the rub. If no positional feedback is used and the mechanism somehow gets 'knocked off track' then there are the problems of (a) recognising that it is off track and (b) returning to a home position then re-trying to get to a target position.

Hundreds of thousands of modern CNC machines do just fine with that technique.
 
Quite so. If they don't have positional feedback I'm puzzled as to how do they solve recognition problem (a)?
 
Being in the CNC business, I will say that nearly ALL CNC machines other than hobby types, operate with encoder feedback servos. Control commands a position and if for some reason the motor loses power, the control will know it did not make it and send a "axis not in position" alarm.

To further the accuracy since lead screws can change in length due to heat, some machines use linear glass scales on each axis to verify distance moved.


Regarding the encoder feedback, I am certainly open to an encoder but I really don't want to expand the complexity of thsi project much over it. I am hoping a lower resolution encoder will allow me to just input the analog data right back to the PIC. I do agree with above that a stepper motor could fail, lose power, etc and as long as no over current is detected, the PIC may not know there is a problem. I think having "in position" feedback could be a smart move. Especially since it might reduce complexity with stepper controlling. All I need to do is send DC power to a motor and turn that motor off when in position is detected. I would assume I would not even need all the channels of an encoder.

I am only familiar with optical encoders but I guess there are some other types out there. I know we found them cheap befoe but of course poor resolution which has no place for CNC applications. Maybe perfect for this though.

As before, I am open to ideas. I do like that little interrupter and for $2.50, I could just make a ring with all my positions on it and would stop at each index on the ring. Obviously this is basically an encoder though.
 
Last edited:
Put one index on the stage, and another on the shaft of the stepper. That way, it can be discerned that the stepper has lost its way in just one revolution of the shaft.
 
Thanks for the reply and I think we might be homing in on this. Mike has mentioned the interrupter which is really not a bad idea. Only issue is that particular design may require a special part being made. HOWEVER, the rating device being turned by the motor IS a disc of sorts and because it must be machined anyway, I can easily add holes, pockets, etc at each of the index angles. Obviously I could attach nearly thing to this rotating device but that is just another part to make. I had the idea in mind to drill holes and add Neo magnets at each angle. I could use just one sensor and make the sensor angle adjustable to dial it in if needed.

I am curious if a hall sensor or something similar could work here? The only concern I have with the hall sensor is they seem to be VERY picky about distance from each other and the rotating device will have a small amount of deflection in it. An LED or IR shooting up to look at something on the rotating device maybe could work? I also remember with hall sensors, they work with flux which could get a little tricky.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top