Digital inputs switching on their own in a very electrically noisy environment

Status
Not open for further replies.

fitek

Member
I have a Teensy 4.1 in a shielded environment, with a 25 foot cable run connected to many switches in a very electrically noisy environment (acoustically, too). Have previously used Teensy 2++ and one of the Teensy 3 models (I forget which) successfully at least a dozen times; not sure if that is a factor or if this environment is just different. I believe these were all 5v devices and the Teensy 4 is obviously 3.3v. I'm basically using every single digital pin available.

The buttons have a common ground and are wired to Teensy digital input pins with pull up turned on. Pressing a button closes the circuit. The cable shield is not connected to anything, my understanding was this would just funnel noise from the outside into the shielded enclosure.

I'm using the Debounce library with a 20ms debouce time. Teensy spits out serial data on the rising edge using the debouce library functionality. There is NO hardware filtering currently (because to date I never needed it!).

Problem:
The inputs are triggering without the buttons being pressed. I don't have the opportunity to get a scope on the lines either because I can't get into the facility, so working blind here. I took two years of computer engineering classes twenty years ago, so my memory is really foggy re possible solutions.

I'm trying to think of solutions and appreciate ideas. What came to mind was:
1) Go back to Teensy 2++ in the hope that somehow 5v makes the SNR better -OR- come up with some circuits so the signals are 12v or some other higher voltage
2) Add lots of RC filtering, since humans can't press buttons very fast anyway. This is a bit problematic because of the component count. I could just throw big caps (1000uF) across each input like a Cro-magnon electrical engineer, or do the math and figure out a combo of resistor-capacitor to get a 1st order filter with a more predictable cutoff frequency.
3) Clamp on ferrite beads
4) Differential signaling is probably too complicated.
 
You could try to use external pull-up:s . As the internal pull ups are very weak in your case.
You could try different values 10k 4k7 3k3 1k and see where the random clicks dissapear.
 
Normally shield should be grounded at one end.

Another option is to use current signalling, like MIDI.

Button closure send a 5mA current through an optoisolator, this should be much more resilient to electrical noise.

The optoisolator is in shielded environment and can convert 5mA to 3.3V
 
10nF is plenty for catching spike noise - that shield should be grounded at one end (the Teensy end) or it won't shield anything.
You want the noise to be conducted to ground along the outside of the shield, not capacitively coupled direct to the wires by
the shield. Capacitive coupling imposes a current, so a lower impedance circuit is more immune (hence lower value pullups).
 
I ended up using a combination of software and low pass filtering.

Since I had so many input lines to filter, I couldn't use very big caps. I tried three different combos of cap and resistor and was able to determine the cut off frequency needed to filter out the noise.

Added functionality to vary the software debounce on each line.

Turned out the interference was coming from one nearby piece of equipment.
 
Status
Not open for further replies.
Back
Top