protection from noise in a long wire - Page 1
Forum section: electronics / beginners

author: fisz
author_rank: Contributor
timestamp: January 16, 2021, 11:51:12 pm
content: I have a simple circuit: a pushbutton connected to a microcontroller with a pull up resistor.I want to add another pushbutton pararell to the first one, like this:However, I need to use a wire that is ~10m long, and it is acting like an antenna. My question is: what is the simple solution to limit any noise affecting the microcontroller?I can't replace the cable and I can't attach anything at the second pushbutton's end of the cable (it's installed with almost no access), so I can't upgrade to RS-485 or any similar serial connection.Will a low pass filter be enough? Or maybe I need some protection diode? I'd love to learn more, but I don't even know what I am looking for.

author: viperidae
author_rank: Frequent Contributor
timestamp: January 17, 2021, 12:13:03 am
content: How much current can you afford while the button is being held down?A lower value pull up should help.A capacitor between the input and ground will act as a low pass filter.

author: ledtester
author_rank: Super Contributor
timestamp: January 17, 2021, 01:06:57 am
content: I'm wondering if something simple like this would work:The switch would close the connectors at the left end of the circuit.The output is taken at the collector of the NPN. It will be inverted, but that's easily handled in a microcontroller. The collector resistor shouldn't be too large - I would think that lower provides more noise immunity if needed.And here's a PNP version if one end of your switch must be connected to your GND:

author: Gyro
author_rank: Super Contributor
timestamp: January 17, 2021, 10:40:03 am
content: Quote from: ledtester on January 17, 2021, 01:06:57 amI think it would still need a Base-Emitter resistor and probably capacitor to avoid noise pickup.

author: fisz
author_rank: Contributor
timestamp: January 17, 2021, 02:24:33 pm
content: I've always thought that a bigger value pull-up (like 10k) won't do any harm, but what you're telling me is that lower value pull-up is better? Am I thinking correctly, bigger pull-up makes the circuit more sensitive to noise? Well, that actually makes sense...

author: Paul Rose
author_rank: Regular Contributor
timestamp: January 17, 2021, 02:34:33 pm
content: Quote from: fisz on January 17, 2021, 02:24:33 pmCorrect.The lower the pull-up resister, the "harder" it is to pull down, and you want to prevent "false" pull down due to noise.Just pay attention to how much current will flow when the switch is closed ( 5v divided by pullup R), and make sure it isn't crazy. 1K would give you 5 milliamps.Edit:You could also wind a few turns of the whole cable through a ferrite toroid (or use a few clamp on ferrite) to suppress common mode noise. This works even better if pair of wires in the cable is twisted ( because it makes it more likely that noise pickup is actually common mode),

author: Terry Bites
author_rank: Super Contributor
timestamp: January 17, 2021, 06:19:24 pm
content: https://palomar-engineers.com/wp-content/uploads/20150125_103738.jpgwind a few turns of your switch pair on torroid and a small capacitor across the input.Instead of the torroid savlage the clip-on lump off an old VGA cable.If you've got a lot of spare wire wind the switch pair into a coil say 100mm in diameter -10 turns. Still, always put a small cap across the switch.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 18, 2021, 12:51:13 am
content: No need for a CMC, just a resistor or ferrite bead will do. Put that in series, towards the switch. Then put a filter cap on the inside, say 1nF or more. Add clamp diodes or zener/TVS for ESD protection. Finally, one more series resistor, say 100 ohms, to the logic pin. Optionally, add a schmitt trigger inverter/buffer between switch and MCU, to ensure it doesn't see any indeterminate signal levels (this is probably not necessary, check MCU datasheet to see if it has schmitt trigger inputs on port pins already).The RC or LC filtering, dampens resonances on the cable and filters noise away from the circuit. This is necessary both to get a stable signal, and to prevent rectification by diodes (which, given enough RF noise, will cause an indeterminate voltage level). The diodes are added to absorb large bursts of noise, such as ESD. The outer resistor basically doesn't count, for ESD purposes -- a direct hit will put 5kV+ on the wire, jumping the resistor effortlessly -- this will be clamped by the protection device to maybe 10s of volts, which is still a lot for the MCU pin (and there's lots of amperes behind it as well), so a series resistor finishes things up nicely.Tim

author: fisz
author_rank: Contributor
timestamp: December 07, 2021, 12:23:01 pm
content: Quote from: T3sl4co1l on January 18, 2021, 12:51:13 amSorry for bringing up such an old topic, but I'm afraid I don't follow what you said. Maybe you could provide a schematic?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: December 07, 2021, 04:25:57 pm
content: Sure, something like this:Uh, with a pullup in there somewhere, or internal from the MCU pin is fine too.Tim

author: Etesla
author_rank: Regular Contributor
timestamp: December 09, 2021, 03:56:43 am
content: Am I the only one thinking the thing is just 10 cm away and you can probably get away with no modifications at all R = 10k or something, maybe put a 10nF ish cap across the switch at most? Maybe debounce the switch in software if you have the option too and are actually worried about it?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: December 09, 2021, 04:36:16 am
content: 10m in the OP, it's a pretty reasonable antenna.If it's not as far, that may indeed be important! I wouldn't mind just a capacitor for 10cm, as long as it's inside the same enclosure. It should still have ESD stuff if it's touchable.Tim

author: EEEnthusiast
author_rank: Frequent Contributor
timestamp: December 09, 2021, 05:44:04 am
content: Use a coaxial cable, if cost is not a big concern. you could pull up some 75ohms cable for real cheap.

author: SoundTech-LG
author_rank: Frequent Contributor
timestamp: December 09, 2021, 07:11:19 pm
content: Quote from: EEEnthusiast on December 09, 2021, 05:44:04 amExcept... the OP already stated in his 1st post..."I can't replace the cable and I can't attach anything at the second pushbutton's end of the cable (it's installed with almost no access), so I can't upgrade to RS-485 or any similar serial connection."

author: tanveerriaz
author_rank: Contributor
timestamp: December 10, 2021, 04:08:27 am
content: try use 5V reed relay