EMI on digital pins

I am being plagued by EMI on my pump circuit. at first i thought it was because of a DC brushed motor I bought off ebay. i shielded the pump added a filter and a flyback diode but every time the pump started other used pins showed abnormal results. I ditched the pump for an inductance pump which has not arrived. But while dry testing I found that every time my onboard relay for my heater clicked an unrelated pin showed false 0. my relays are driven with NPN transistors to 5VDC and I have flyback diodes to protect the transistors. I’m using the onboard pullup resistors to relate my pins to 3.3v when my contacts are open. when closed they are grounded as is the normal. My pump circuit is using a pulldown because the contact is connected to 3.3v. When I tested my hardware last year I never had trouble with EMI. Last year I was also using a pullup and a ground signal to trigger my pump. but my heater relay i mentioned before is giving me errors and its using pullup. Also while troubleshooting my DC pump I connected it to a battery to completely isolate it from the imp and it still threw errors. my cheapo cordless DC drill (brushed) does not effect the circuit as far as I can tell it has no shielding of filters. I’m sorry for this raw thought format, I’m at my wit’s end, please help me!

I suspect this is “ground bounce”, where the current flow is causing a differential big enough for a high impedance input to pick up the noise.

If your inputs are not fast moving, then I’d suggest putting a small capacitor on them (1nF? 10nF?) to ground. This should get rid of the spurious transitions.

I will try that thank you. on my bench a backup PCB and imp were not effected by the noise but i just finish swapping out the boards to find the same trouble. I am discouraged and have resorted to drinking; at this point i really don’t want to loose the 3 years i have invested in this project and the 2 of which i have been using imp. is there an easy way to test a pullup/down resistor?

What value pull-ups are you using, and what is connected? (long wire? Could wire be picking up noise by passing anything high current? Etc)

The value of the capacitor you need for noise suppression on the input will be related to the pull-up value. If power isn’t an issue i would suggest using a strong pull-up (eg 1k) which means 3.3mA being burnt in the pull-up when the contact is closed. With this strong pull-up you could easily use a 100nF cap.

Ok my new AC pump arrived today I hooked it up to find the same false triggers. So I am getting ready to solder the caps to the pins. As for wires and length. The high current pump wire (2A) does not run parallel to any triggers. My triggers are magnetic float switches. The lengths are less than 8" they are grounded I’m using imp’s pull-ups to tie my pin to 3.3v to stop it from floating.

FWIW, I’ve installed in numerous large commercial EMI environments and have yet to see similar issues. This may be due to my code typically only polling inputs once per minute, but… Are you sure your power supply to the imp (and relays) is adequate and you’re not seeing a voltage transient when the relays energize?

I’m using a recycled 3A 12VDC. I have an onboard 1.5A 3.3V regulator for the imp and a 1.5A 5V regulator for the relays driven by npn transistors. But I’m seeing plausibility in your theory because my wife just shared my 120V outlet to charge her phone and it triggered

Right on Hugo! I found my old scope cleaned it up and watched a YouTube video on how to use it and you were exactly right on the ground bounce. I added a few 10nF caps and voila! I switched back to my DC pump and no more errors. Thank you for all your help! Tomorrow I plan to get back to the code and figure out why my pump timer broke during last week’s maintance.

Excellent! :slight_smile: