So we are testing out some of our limit switches and they are mysteriously triggering different actions in the robot. They were routed right next to the wires for the CIM’s for the drive and we suspected that that was cause for our problems. when we would drive slow and draw less current there wouldn’t be a problem but when we would jerk the drive to full throttle it would trigger the limit switch. We then moved the limit switch wire away from any other wires and it worked well for about 5min then the problem came back. Going to try to shield it with aluminum foil. Has anyone had this problem before, if so how did you fix it?
How are your switches wired?
They are wired to the EIO ports
Is your frame isolated from your electronics? The first place I start looking with odd electrical behavior is at unintentional or intermittent grounds.
If you have wired the limit switches directly into the DIO port with no additional components, that’s a big part of the problem. The internal pull-up resistors in the roboRIO are intentionally very weak (except for the I2C pins in the MXP port). Try putting 1k ohm resistors between the +5V and signal pins of the DIO port you’re using and switching from the signal pin to ground with your limit switches.
We had spurious counts on our sensors in 2014 due to routing near motor wires. We dealt with it then by writing de-bouncing code. Subsequently, we have moved to twisting all of our motor wire runs to reduce our loop area and running shielded twisted pair for all of our sensor wires. We talked to an expert in the area, and he recommended that you need to ground the shielding to the chassis in order to for the shielding to work properly, and you want to do this through a clamp around the outside of the shielding because of skin effects. We have been doing this since 2015 and haven’t seen a noise problem since. I don’t know how much of this is necessary or what parts are most effective, but we have found the little extra work is justified by the reduction of fiddle factor and peace of mind.
You hit the nail on the head about loop area – it becomes an antenna (both transmit and receive). I twist everything. Even what seems like pure DC that should not radiate (eg: battery cable) has noise currents that can radiate. Motor wires are very noisy and can be long – definitely twist those.
The E4T or E4P encoders have a single-ended outputs and the cable has four separate wires. If they were parallel zip wires (like the pcm cables) they would be cleaner. We twisted one output with ground and they other output with 5V, and route them away from motor wires.
Twisted wiring is pretty good from a radiation and susceptibility standpoint. Shielded cables (coax, shielded-twisted-pair…) can also help on sensor lines. The shield is normally connected to ground only at the receive end of the cable, and open at the other end. I would connect it to signal (battery) ground, not the chassis. If you connect ti to the chassis, be certain to not also connect the chassis to battery ground, as this is an FRC rule and inspectors will measure resistance from chassis to batt gnd.