# limit switches to control motor direction

I am trying to use two limit switches and two DPDT relays to control the direction of the motor. When the power is applied the motor should rotate one direction (direction for this question isn't important). Also, at this point (initialization) neither switch will be energized. The motor will rotate and move until it energizes the second limit switch (labeled Switch 2). At this point, the direction of the motor should reverse. The motor and hardware will then move towards switch one. Once the motor reaches switch one it should stop completely (not reverse direction again). Below is my basic wiring diagram.

I wired it up and when I supply power the motor rotates. However, whenever switch 2 is energized I can hear relay 2 energize and de-energizes quickly but no motor rotation.

Also, I am trying to implement a latching relay when the motor reverses direction. I do not know if my problem is occurring there.

Finally, I am having problems trying to figure out how to have the motor stop once switch 1 is energized.

Any help with my two problems (reversal of direction, and stop when switch 1 energized) would be greatly appreciated.

• Do your latching relays require a pulse to change states? What are you using for the pulses? Aug 22, 2014 at 3:05

Initial condition: no relays energized. One set of RY2's direct power one direction to the motor. Second condition: SW2 triggered, its NO contact energizes RY2, which reverses motor polarity and latches itself (you'll need a pair of diodes or another relay contact set to accomplish both reversal and latching). Third condition: SW2 released, RY2 is still latched, mechanism swings the opposite direction. Fourth condition: SW1 triggered, its NO contact energizes RY1. An NC contact set on RY1 breaks RY2's latching circuit, and the same NO contact latches RY1 on until power drops away. The second RY1 contact set's NC interrupts power to the motor.

EDIT: Here's what I have in mind:

• Something to consider, if there is no way for you to know if the relay is latched on t=0 (initial powerup (time=zero)) you can have unexpected action. Elevator doors work in the fashion you are describing. The motor rotates one way (closing the doors) unless the limit (safety) switch is hit. At this point, it reverses the motor to open the door back up. Depending on you application, knowing what relays are latched on startup may or may-not be an issue for you. Aug 22, 2014 at 2:55
• @EnemyOftheStateMachine, I was thinking electrically-latched relays instead of mechanically latched relays. I agree - mechanically latched relays could be really problematic here. Aug 22, 2014 at 3:03
• @TD, your comment is what I am looking for but having problems figuring out how to wire it. I am new to electronics. Can you provide a basic drawing that I can try to use to follow your steps. Also, the reason I am not too worried (at this moment in time) about the mechanism resting squarely on Switch one is because I plan on incorporating this design into my larger contraption. The larger contraption sends a pulse after a specific amount of time (calculated via a ratemeter). I plan to use that pulse (extend it if I have to) to move the mechanism off switch one to start each cycle. Aug 22, 2014 at 21:53
• @user2755399 - Schematic added. It should do everything you want it to do, including automatically resetting itself at the end of each cycle. Aug 23, 2014 at 0:40
• @TD, thank you. In the diagram it does not appear that you routed the power through the NC contact of switch one. Am I miss-reading the schematic or the first line of your comment? Aug 23, 2014 at 0:50

The dashed lines indicate mechanical connections, and the circuit works like this:

With power ( + and - ) connected and limit switches LS1 and LS2 disengaged, the only avenue available for current flow will be from the supply positive (+) to K1-1, then through K1-2, the motor, K1-5 and 4, and finally through K2-1 and 2 to the supply negative, (-).

That will cause the motor to rotate clockwise, and after a time it will engage LS1, closing LS1-C and NC, which will connect the supply positive to K1-11 and allow current to flow through the relay coil and into the supply negative through K2-1 and 2.

When that happens, the magnetic field generated by K1's coil will cause K1-7 and 8 to close, in parallel with LS1, which will latch K1 even if LS1 is later opened.

K1's coil being energized will also cause its other two sets of contacts to switch, with the result being that the supply connections to the motor will be reversed, plugging it and then causing it to rotate anti-clockwise.

That will cause LS1 to open, but since K1-7 and 8 will keep K1's coil energized after LS1 opens, K1 will be latched and the motor will continue to run.

Some time later the motor will cause LS2 to be closed, and when it does it'll energize K2, which will cause K2-2 and 3 to close, latching K2.

When K2 and 3 are closed, however, K2-1 and 2 will open, breaking the connection between supply negative and the motor and between supply negative and K1, so the motor will stop and K1 will be de-energized until power is disconnected, LS2 returned to its open state, and power reconnected, starting the cycle anew.

• That last will require manual intervention before the next "reboot" cycle, true? To get off the LS2 limit switch? Aug 22, 2014 at 17:14
• TDHofstetter: True. Aug 22, 2014 at 17:22
• @EM, thank you for the comment. I am new to electronics and am having problems following your diagram. I am having difficulty with some of your labels such as K1C (closed contact for relay 1?), as well as where are the NO contacts for each relay (dotted lines maybe). I am trying to follow the diagram with your comments but still have difficulty. Can you draw the image as you would for a beginner? Thanks and once again I apologize my new lack of experience. Aug 22, 2014 at 21:57
• @user...: Done. Aug 23, 2014 at 10:51
• @EM, Thanks for the update. I have two DPDT relays. The diagram appears to use a TPDT. Can it be done with only two DPDTs? Aug 24, 2014 at 13:28