At the start of this season, I had read all about how normally closed is better than normally open. The basic reason why is that if the limit switch is disconnected, it is treated like the limit switch is being pressed down, switch stops movement in the direction towards the limit switch. This is a great use case for normally closed. We used normally closed on most of the limit switches on our robot with a few exceptions.
Downsides to normally closed
- If the limit switch fails, that mechanism isn’t moving at all, unless you program a manual override (sometimes this is a good thing, as it’s almost guaranteed to not try and go past a hard stop)
- If you use the limit switch being pressed down to reset encoder counts, having the limit switch unplugged will reset the position to 0 (or your maximum encoder counts).
We ran into the second downside yesterday at GRC. For our hatch stow, we have a reverse limit switch and an encoder on the hatch stow mechanism. Whenever the limit switch is pressed, we reset the encoder counts to 0. We don’t have a forward limit switch. We decided that an encoder would work just fine. And while we tested the robot, it worked perfectly. That motor always seemed to smoke when we used our hatch mechanism during the match and we never figured out why until yesterday.
During the operation of the robot the reverse limit switch would sometimes be open for a single instant even when the limit switch was not being pressed (this limit switch uses normally closed). When the limit switch was open, the program registered this as the limit switch being pressed down. It reset the encoder counts to 0 and our code to drive the motor out to 9000 encoder counts decided that it needed to go 9000 more encoder counts to reach its desired position. This means that the motor was trying to drive past a hard stop (in the forward direction), the very thing we wanted to avoid!
TDLR; Don’t use normally closed limit switches to reset your encoder counts