Sorry if this question seems stupid, probably it is...

I'm try to design some camera dollies that are moved by some stepper motors controlled with a microcontroller. Someone told me that it is better to use endstop sensors to detect when the end of the track is reached. Looking on the Internet, I've found that if I need to know the position is better to use an optical gyroscope (did I understand it right?), but why do I need this? Is it not enough to have a counter and count the steps? That way I just have to bring the dolly to the beginning each time I switch on the system and use a counter. Or is there a problem with that and is there a reason I need other security sensors?

And what if I use a servo instead?

  • \$\begingroup\$ A gyroscope sensor is generally a poor choice (in terms of accuracy vs cost) if there's an external frame of reference accessible for a relative measurement. \$\endgroup\$ – Chris Stratton Sep 21 '12 at 15:52

Not stupid in the least!

You count the steps from some point where the system initializes to, but how do you know where that starting point is unless you measure it? You know it pretty well if you are using some sort of ABSOLUTE ENCODER that measures the position from some real reference point, but a stepper motor system may not have any encoder, or it may just have a RELATIVE ENCODER, that tracks changes only from some initial point that could be anywhere. When such a system turns on, the count is ZERO, regardless of the initial condition, and only changes from that (possibly arbitrary) zero point can be tracked.

Many systems use a control strategy where the motor will move slowly in one direction until it hits some switch, at which point you know for certain that the motor is at the switch! You then tell the system to return to its operating range, and track the motion from there.

There's also safety. If overtravel will cause damage to the system or possibly hurt someone, you don't depend on the system to control it correctly in every case, but you put switches in to detect if an overtravel is occurring, and stop the system dead. You call these switches interlocks, and whether you use them or not depends on how expensive your components are, how difficult they are to replace, whether downtime is critical, or how likely someone is to get hurt.

I don't know what the optical gyroscope is, but maybe its a form of absolute encoder. Servo systems might have all the same inherent issues, depending on whether they use absolute or relative position encoders.

  • \$\begingroup\$ ok! where can i find informations about how make absolute encoder? \$\endgroup\$ – nkint Sep 20 '12 at 17:42
  • \$\begingroup\$ I wouldn't suggest trying to make an absolute encoder; if your device has a bounded range of motion, however, you might be able to use a pot or else a pot plus a relative encoder. The basic idea is that if the motor is energized at a certain phase, there are a finite number of positions it could be. If the pot is good enough to distinguish them, great. Otherwise, a relative encoder might help. Note that its resolution may be much coarser than the motor's step size, if its transitions all occur at a particular motor phase. \$\endgroup\$ – supercat Sep 20 '12 at 18:36

First question is do you plan to directly drive one of those wheels on the dolly or use a belt or screw to move the dolly? If you are directly driving one of the wheels I would suggest you try to avoid it as the wheel could loose traction and cause a vibration and/or jerking motion and loose its position. Since the rails look like they can flex loosing their Parallelism, one wheel can leave the rail surface causing the motor to spin freely loosing position and causing the dolly to stop moving. Mount the rails to a very sturdy wood or metal frame to prevent flexing.

You will always find limit switches (aka end stop sensor) on any kind of linear motion device. They serve two purposes. The first is obvious, stop the motor when the travelling apparatus (table, dolly, camera, etc.) reaches its limit to prevent mechanical or motor damage. this is called a "hard limit". The second use is to home the stage. Unless you are using absolute linear encoders, you have no way of telling where you are in the given travel length of the stage. So you program a procedure that runs the motor in one direction until it hits a limit switch and then calls that position home or zero. Then from there it counts up (or down) from that position to find out where you are in the travel length. You can also program whats called a "soft home" which is used if you want to call a particular position within the travel limit "home" the program and index up or down from there. You still need to reference a hard limit though, this keeps the stage within its mechanical limits.

Without a limit switch your camera could end up on the floor if no mechanical end stops are in place. If your using a micro-controller just make sure you step and use the limit switch input as an interrupt to halt the stepping code. Or an if statement inside a stepping loop to break the loop if triggered.

Encoders are not normally needed on stepper motors unless you expect to encounter a large dynamic load or heavy loads that can bind the driving mechanism causing the motor to skip steps. This is where you need an encoder to count the steps and verify that the motor has actually indexed itself. Your camera dolly is a constant load and if you size your motors accordingly, you don't need encoders.

A servo motor is MUCH more complex. You must have an encoder as there is no stepping in a servo, its pretty much a motor that is nudged forward until the encoder count satisfies the motion command (eg. turn motor clockwise 1000 counts.) If there is no encoder, you don't know where the motor is going, how fast, etc. Any micro-controller will be swamped with encoder counts and feed rate will be severely limited as you don't want to skip counts. It needs to be closed loop as it has to index motor and then check the counts. You don't need a servo.

  • \$\begingroup\$ Not that its the right solution here, but the pic 18f4431 and others in that series have encoder handlers on the silicon, so they'll be happy with however many counts come in -- no swamping! \$\endgroup\$ – Scott Seidman Sep 20 '12 at 21:54
  • \$\begingroup\$ very clear answer thanks. but when you say "you have no way of telling where you are in the given travel length of the stage".. why no way? if i count the steps and i know that, for example, 100 steps are 30 cm then i know where the dolly is. what am i missing? \$\endgroup\$ – nkint Sep 22 '12 at 11:36
  • \$\begingroup\$ Many floppy drives for Commodore or Apple computers in the 1970s and 1980s used stepper motors without any sort of limit switch; absolute positioning was established by sending enough step requests to reach the end stop from any position. \$\endgroup\$ – supercat Dec 12 '14 at 21:22

A stepper motor can, for most of the time, be operated in an open loop. This is where there is no sensor, and you're just keeping count of all the steps.

However, sometimes it will miss a step. In an open loop, you have no way of knowing when that happens. So, the cheapest solution possible is to use a simple mechanical endstop switch. A single switch and two wires will suffice.

You don't want to use a complicated solution such as an optical gyroscope(?) because of cost, reliability, and wasting your time.

  • \$\begingroup\$ sorry but how is it possible to miss a step? error in the motor engine? \$\endgroup\$ – nkint Sep 20 '12 at 17:43
  • 1
    \$\begingroup\$ Normally we would just send a step sequence to the motor and assume it did everything as we wanted. However, under heavy load, and also during high speeds, it can misstep. You can even demonstrate it by yourself! Take a small stepper motor, power it up using whatever sequence you like, and try to forcefully alter the rotor position. There's only a finite force holding the rotor in a given position. Next, send a step sequence to the motor, but gradually change the frequency. You'll notice that at some point it starts to lose synchronisation. Eventually it will stop rotating. \$\endgroup\$ – Jonny B Good Sep 20 '12 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.