To reverse a motor using relays, you do not use a "reversing relay" (DPDT). You use two SPDT relays, one connected to each motor terminal and each switching from ground to 12 V or whatever. Actuate one relay and the motor runs forward, actuate the other and it runs back. The limit switches are in series with the relay coils.
Of course this does not protect against relay failure. But the relays are only energised while the motor is running.
Thanks for the suggestion! I think I'll lose speed control if I use relays to actuate the motor if I understand you correctly.
I was looking at using a relay that was controlled by the microswitch, but I think the relay will be energized while the switch is closed. Most of the time, the actuator will be at the limit (at rest), so I don't think that will work well for battery.
So, my options so far:
Use a high current (10A DC) limit switch (fairly expensive and hard to find.. the ones I find on digikey are ~$20)
Use relays to control the direction of the motors (lose speed control and may need SSR)
Somehow shut off the motor via limit switch directly to the motor driver (not sure how to do that and still be able to move in the other direction)
Pure code
If anyone has suggestions on #3, I think that may be the better option of the 4. I would get software and hardware control... and sending a 0 to the motor driver speed should cause the motor to stop immediately. Again thank you!
OK, to do that you need some logic. You need to AND the enable with the status of one of the limit switches selected by the direction input.
A 74HC253 will do this perfectly (you use only half the logic).
It has two select lines, selecting between one of four inputs, so one select line is your motor enable, if it is not enabled, then two of the four inputs that may be selected are wired to the motor "off" state. If it is to be enabled, then the second select line connected to the direction input of the motor driver selects one of the two inputs which are connected to the limit switches (which have a pull-up or pull-down depending on which way you need to enable the motor driver). The output of the selector is then the actual enable for the motor driver.
So you have the limit switches working at logic level, drawing negligible current (depending on the pull-ups and they themselves may be switched by the enable depending on how the logic suits) but the pure logic chip is totally reliable as it cannot suffer from a code crash.
you are not using limit switches like the rest of the world uses them?
I, and many other people in the "rest of the world" use exactly your setup, with "hard" limit switches in the motor leads. Many linear actuators, such as these ones, come with that setup built in. It protects the motor, motor power supply and the rest of the system from damage in case the controller or driving MCU fails to read the "fluff" limit switches, or they themselves fail.
The motor controller itself can tell you if one of those limit switches has been tripped, because the motor current sense (CS) output will drop to zero.