Driving a motor with limit switches from one output pin?

AndyGadget

Senior Member
I think I've just come up with a bright idea for using a servo motor in a multi-rotation mode to drive a pulley / cord arrangement (think of old radio tuning) between two limit switches, from one pin of a Picaxe. I haven't tried it yet but can anyone see a flaw before I do?

Compared to a multi-turn winch servo this doesn't allow for continuous positioning, but it does allow for more travel and for the endstops to be on any type of mechanical assembly as they are not part of the servo.

1) Remove mechanical endstops of the servo.

Quick and dirty version :
2) Isolate the final drive gear from the feedback pot and set the pot at half travel.
(I use a blob of epoxy for this when I'm making a continuous rotation servo.)
3) Connect the slider connection of the pot to the commons of the limit microswitches (A and B).
4) Connect NO of A to +V. Connect NO of B to 0V.
(Slider is at half rail, set by half range pot. Overdriven by connection to +V or 0v when microswitch hit.)

Better version :
2) Totally remove the pot from the servo (or disconnect electrically and mechanically).
3) Connect centre connection (on PCB) to commons of microswitches A and B.
4) Connect suitable value pullup resistor to NC of A. Connect same value pulldown to NC of B.
(Slider is at half rail due to pullup and pulldown both connected.
One of these disconnects when endstop hit causing pullup/pulldown via other resistor.
This will operate in reverse direction to above.)

Operation :
In both cases when motor is away from endstops, voltage on slider will be half rail so setting servo to 0 will cause drive one way, servo 255 will drive the other way, as per a continuous rotation servo.
When the servo hits an endstop, slider will go to 0V or +V, satisfying the SERVO command so the motor stops and holds position
When the opposite command is received (255 or 0) this drives motor in reverse direction until other endstop is hit.

Unknowns are how servos (and Picaxe) respond to extremes of servo command (0 and 255) and to slider voltages outside normal operating range. This will no doubt vary from type to type. Limits may not be 0 and 255 - Easily found empirically.
 
Last edited:

IronJungle

Senior Member
Not sure I follow 100%, so my comment may be meaningless....

What will you do with the feedback input when neither of the limit switches are closed? The PICAXE will probably consider a 'no connect' as a low. You could used the ADC on the 08M. THe +5 limit would be 255, the 0V limit would be 0, the "no connect" value set with a resistor.
 

AndyGadget

Senior Member
In both cases, the feedback input (pot centre connection) on the servo PCB would be at half rail, in the first case due directly to the pot at fixed half-travel, and in the second case due to the pullup resistor to +V and the pulldown resistor to 0V both being connected. The value is not being 'read' and there is no positional feedback between endstops - SERVO 255 makes it run to one end, SERVO 0 to the other.
 
Last edited:

bluejets

Senior Member
Tried to visualise what you are trying to do. At best, in the first instance I can't see working and second, maybe,but as they consistently say here, put in a diagram. Picture is worth a thousand words.
 

erco

Senior Member
Sounds like a great project. Hard to anticipate every problem and/or workaround. Build it and see.
 

AndyGadget

Senior Member
Did a quick lash-up today with and old servo and a couple of microswitches with mixed and rather strange results.
Servo didn't like the 0 and 255 values, which makes sense when you consider the waveforms for the extremes.
My 'scope fizzles quite merrily in damp weather so didn't manage to look in detail.
I may spend more time on this when I get a chance.
 

bluejets

Senior Member
Did a quick lash-up today with and old servo and a couple of microswitches with mixed and rather strange results.
Servo didn't like the 0 and 255 values, which makes sense when you consider the waveforms for the extremes.
My 'scope fizzles quite merrily in damp weather so didn't manage to look in detail.
I may spend more time on this when I get a chance.
I think you will find servo signal required is written in most data sheets here as being 75 to 225 for an average servo to travel standard distance.

Maybe start with 100 to 200 and go from there.
 

AndyGadget

Senior Member
I think you will find servo signal required is written in most data sheets here as being 75 to 225 for an average servo to travel standard distance.

Maybe start with 100 to 200 and go from there.
As you say, those are the limits for an average servo and where it will be designed to work best. This setup is far from standard.
It would be possible to set ratiometric voltages corresponding to those endpoints with additional components but it would be a lot more complex and prone to drift.
If it doesn't work, fair enough. I had to try it.
 
Top