Reversible motor/shuttle + 2 limit swiches: Can I do it with just 3 wires?

I think this will be ok, but wanted to be sure before I start building.
Basically, I have one DC motor that drives a component back & forth by reversing polarity (typcal). Since the arduino is sending the motor commands, it already knows which direction the component is moving and just needs to know when to stop (at either end). To that end, the component makes a connection at either end and I'm hoping I can use that same wire to indicate a "stop state" the only concern I see is that since the motor flips polarity depending on direction, the feedback wire will also change its polarity so I guess I will end up wiring that same wire to two pins defined as inputs with one high and one low? I just worry that sending a + voltage to a pin waiting for - could cause trouble. The motvation here is to use only 3 wires.

Here's an attempt at a diagram.

Consider using two wires and connect the switches in series. Since you know the polarity the polarity that can be used to determine the polarity or you can use a bidirecional (AC version) opto coupler, then no worry about direction. It will also act as a safety if the motor gets connected backwards.

1 Like

Can't say that diagram makes much sense. :crazy_face:

The answer is that you connect in series with the motor, the two limit switches in parallel, each in series with a diode.
(Can't find the diagram for this!)
Or each in parallel with a diode, and the two in series.

If you wish to bring the connection between limit switches back to your control circuit, you can detect when the limit switch has stopped the motor.


You are asking for trouble, the switch sensor wiring should be kept away from the motor wiring to avoid noise-pickup anyway (motor wiring will be noisy and probably at a different voltage too), so you need two cables, each with two wires - skimp on this and you'll have all sorts of issues cleaning up the noise from the sense signal.

1 Like

Thanks! I think you're right, and the funny thing is that I've done this conventional approach before successfully but I was thinking about it differently because my "switches" aren't typical. (I couldn't think of a good way to illustrate that) Rather it is a steel part that collides with a wire loop. On that note I'll have to think of something different mechanically because there are no NC contacts as required by your design. I think that detail is what led me down the cockamamie path I tried to illustrate above. Having said that I still think it could work as shown it's just that the feedback wire flips polarity along with the motor. An optocoupler would probably be a good way to isolate it. (which I think I could just make as a pair of twisted LED's and a sensor, right?). That way I still get to use only 3 wires and the contacts as is.

*BTW- not to get too far off into the weeds but the reason for this somewhat awkward solution is that it's meant to drive a fairly slick mini deadbolt assembly that I designed- the whole thing is really tight on space but it works well and the form factor (a single, short cylinder) allows simple installation; just drill a 5/8" hole and push it in there. Plenty of space where the electronics live but almost none where the cylinder lives.

I liked the optocoupling suggestion cited earlier here- the whole thing is running at 5v, motors, logic, etc right now (which isn't ideal but at least it simplifies things for now). Getting away with 3 wires from this assembly would really help with the implementation even if I have to add some extra components at the control circuit.

What I was thinking, for my "ultimate project", is to use relays or transistors to turn on/off the driving current (which, for a reasonably sized motor, is at least 0.5A and even the toughest micro switches aren't really designed with that in mind). This way you can have a clean signal.

Because there are advantages for hard-wiring them like you show (e.g., completely preventing motor from trying to operate in a direction that it can't), which I like because when you have a harness of those, debugging (and testing) can often cause undesirable situations but the downside is of course that the signal will not be the best in the world, and cost, since there are two high power Schottky diodes.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.