enter image description here

the long wires acts as inductor which shutdown and sometimes damage my microcontroller(IC1), for the AC part ill be implementing an optoiso along with triac and snubber circuit (lemme know if you have a better idea) but the SW1 is the part where i'm stuck, usually in simulation they turn the wire into inductor to add the diode (with resistance or zener) parallel to it but in this case i'm kinda lost of to how to snub that switch in addition ill be adding a low path RC filter as suggested in the answers, thanks in advance

  • 2
    \$\begingroup\$ Can you mark on your diagram the sections of wire that are 100m? \$\endgroup\$
    – Jon
    Commented Jan 14, 2016 at 13:33
  • 1
    \$\begingroup\$ Are SW1 and BL1 close to each other? If so, why is the rest of the circuit so far away? \$\endgroup\$
    – Dave Tweed
    Commented Jan 14, 2016 at 13:39
  • 1
    \$\begingroup\$ Are you saying the circuit dies or just temporarily fails or rests. Be very clear in what you say are the symptoms of the problem. Also, are you running AC wires alongside dc control wires - some idea of how these wires are positioned relative to each other is important. \$\endgroup\$
    – Andy aka
    Commented Jan 14, 2016 at 14:24
  • 3
    \$\begingroup\$ Possible duplicate of switch on a long wire end causing microcontroller to shutdown \$\endgroup\$
    – rdtsc
    Commented Jan 14, 2016 at 15:43
  • 1
    \$\begingroup\$ @Jon both SW1 and BL1 are connected to this circuit throw a 100m wire everything else is in the pcb \$\endgroup\$ Commented Jan 15, 2016 at 0:18

2 Answers 2


The 100m wire from SW1 to pin 3 of IC1 acts as a long antenna that will pick up all sorts of electrical noise. Almost any electrical equipment nearby that switches current will induce a transient voltage into it, and the voltage can easily be 10's or 100's of volts. If you are unfortunate enough to have a thunderstorm nearby this can easily be 1000's of volts. Any voltage over about 6V can damage the IC, so you need to protect input to the IC. A simple RC low pass filter is surprisingly effective. I would use the following circuit. This will protect IC from damage, but will not effectively debounce the switch. You can do this in software.


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ i used that same RC circuit with the 10k resistor on the ground rather than on the 5v and values was 1nf/10k but it didn't work properly but ill try to use 10nf and 100k if i found no other way \$\endgroup\$ Commented Jan 15, 2016 at 0:13
  • \$\begingroup\$ i would still want to add a snubber to be sure nothing will go wrong but i'm kinda confused of to where to add the diode \$\endgroup\$ Commented Jan 15, 2016 at 11:42

I suggest to break up the problem in pieces as it looks like different (but perhaps related) problems.

Starting with BL1, you mention that it lights up very dimly. Let's debug this first, it might help with the IC burning out.


  1. When BL1 lights up dimly, it's when the relay contacts close. Right?
  2. With the relay contacts closed, can you measure and post a)the voltage drop accross the relay contacs, b) the Vout of V2 and b) the V accross BL1
  3. To be sure, also measure and post the voltage on BL1 when the relay contacts are open.
  4. Indicate with which type of instriment you measured.
  5. What happens with BL1 when you short the cable ends at the relay contacts?

This way we can analyze it further.

  • \$\begingroup\$ no it dimly lights up when the relay contacts are open, when it close it lights up fine which is why i imagine it's induced or kickback voltage that isn't suppose to be there \$\endgroup\$ Commented Jan 15, 2016 at 0:11
  • \$\begingroup\$ Then I suspect something is wrong with the connections of the wiring. Even if it were an induced current caused by having the signal cables run closely to the AC power cables in the building, you need a closed circuit loop to allow the current to flow. If the relay contacts are open, then something else is closing the circuit. I suggest that you double and triple check the wiring connections to make sure the cables are connected correctly. Also, do you have a scope to see the waveform at BL1? If its 1Hz then it comes from V2, if it's 50/60Hz then it comes somehow from the AC wiring. \$\endgroup\$
    – kxtronic
    Commented Jan 15, 2016 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.