Long wires causing Raspberry Pi to die?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I've been working on a simple project involving a Raspberry pi and some switches.
I would never thought I would have any problem for something as simple as a switch, but here I am.



The 2 wires from my switch are connected to the raspberry.
One is connected to gnd, the other is connected to a GPIO. The internal pullup resistor of the raspberry is used.



The length of the cable is around 7m.



The program is just a mater of reading the GPIO and sending commands according to state changes.



My problem is simple : everything works fine for some time, but eventually the switch ends up not "working" anymore (reading low state whether or not the switch is pushed).



I checked the switch, and of course it still opens and closes as expected, so the problem comes from somewhere else. What I did is I disconnected the switch, and measured the voltage between the two wires : I get 0V.



This is my first clue for thinking something bad happened to the raspberry. Because the internal pullup is used, I should have measured around 3.3V. And this is indeed what I measure if I replace the raspberry with a new one.



I thought this might be caused by EMI, causing voltage spikes ? I really have no experience dealing with this. So what I did is I replaced the raspberry, and I added an external pullup resistor with a lower value (the internal resistor is 30k, I used 1k as external resistor), guessing that this would reduce the noise. But the same thing happened after one day.



This time, when I measure the voltage at the GPIO, I have around 1.2V. According to the reading, using a simple voltage divider, this is equivalent to a resistor value of 600Ohms pulling down the signal inside the raspberry. Definitely not normal.



Then I tried to replace the wires with shielded audio cable, connecting the the shielding to ground. And half a day later, yet another raspberry was good for retirement.



I have now placed a ceramic capacitor between gnd and the GPIO (100nF), and for now it seems to be ok (it's only been 12h) but I have to say I have no confidence because I'm not sure what is the reason for this problem.



On the same system, I have another switch with a much shorter wire (1m) and I never had any issue with this one. This is why I guess my wires are acting as antennas, but I don't know for sure (especially since shielded wires did not help).



Any idea about what could happen would be appreciated.
Thank you










share|improve this question

















  • 5




    I would try putting a bidirectional transient voltage suppressor (TVS) on the input. The long wire could be picking up transients that are then coupled into the PI input. The TVS will also act to clamp static discharges.
    – crj11
    46 mins ago














up vote
1
down vote

favorite












I've been working on a simple project involving a Raspberry pi and some switches.
I would never thought I would have any problem for something as simple as a switch, but here I am.



The 2 wires from my switch are connected to the raspberry.
One is connected to gnd, the other is connected to a GPIO. The internal pullup resistor of the raspberry is used.



The length of the cable is around 7m.



The program is just a mater of reading the GPIO and sending commands according to state changes.



My problem is simple : everything works fine for some time, but eventually the switch ends up not "working" anymore (reading low state whether or not the switch is pushed).



I checked the switch, and of course it still opens and closes as expected, so the problem comes from somewhere else. What I did is I disconnected the switch, and measured the voltage between the two wires : I get 0V.



This is my first clue for thinking something bad happened to the raspberry. Because the internal pullup is used, I should have measured around 3.3V. And this is indeed what I measure if I replace the raspberry with a new one.



I thought this might be caused by EMI, causing voltage spikes ? I really have no experience dealing with this. So what I did is I replaced the raspberry, and I added an external pullup resistor with a lower value (the internal resistor is 30k, I used 1k as external resistor), guessing that this would reduce the noise. But the same thing happened after one day.



This time, when I measure the voltage at the GPIO, I have around 1.2V. According to the reading, using a simple voltage divider, this is equivalent to a resistor value of 600Ohms pulling down the signal inside the raspberry. Definitely not normal.



Then I tried to replace the wires with shielded audio cable, connecting the the shielding to ground. And half a day later, yet another raspberry was good for retirement.



I have now placed a ceramic capacitor between gnd and the GPIO (100nF), and for now it seems to be ok (it's only been 12h) but I have to say I have no confidence because I'm not sure what is the reason for this problem.



On the same system, I have another switch with a much shorter wire (1m) and I never had any issue with this one. This is why I guess my wires are acting as antennas, but I don't know for sure (especially since shielded wires did not help).



Any idea about what could happen would be appreciated.
Thank you










share|improve this question

















  • 5




    I would try putting a bidirectional transient voltage suppressor (TVS) on the input. The long wire could be picking up transients that are then coupled into the PI input. The TVS will also act to clamp static discharges.
    – crj11
    46 mins ago












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I've been working on a simple project involving a Raspberry pi and some switches.
I would never thought I would have any problem for something as simple as a switch, but here I am.



The 2 wires from my switch are connected to the raspberry.
One is connected to gnd, the other is connected to a GPIO. The internal pullup resistor of the raspberry is used.



The length of the cable is around 7m.



The program is just a mater of reading the GPIO and sending commands according to state changes.



My problem is simple : everything works fine for some time, but eventually the switch ends up not "working" anymore (reading low state whether or not the switch is pushed).



I checked the switch, and of course it still opens and closes as expected, so the problem comes from somewhere else. What I did is I disconnected the switch, and measured the voltage between the two wires : I get 0V.



This is my first clue for thinking something bad happened to the raspberry. Because the internal pullup is used, I should have measured around 3.3V. And this is indeed what I measure if I replace the raspberry with a new one.



I thought this might be caused by EMI, causing voltage spikes ? I really have no experience dealing with this. So what I did is I replaced the raspberry, and I added an external pullup resistor with a lower value (the internal resistor is 30k, I used 1k as external resistor), guessing that this would reduce the noise. But the same thing happened after one day.



This time, when I measure the voltage at the GPIO, I have around 1.2V. According to the reading, using a simple voltage divider, this is equivalent to a resistor value of 600Ohms pulling down the signal inside the raspberry. Definitely not normal.



Then I tried to replace the wires with shielded audio cable, connecting the the shielding to ground. And half a day later, yet another raspberry was good for retirement.



I have now placed a ceramic capacitor between gnd and the GPIO (100nF), and for now it seems to be ok (it's only been 12h) but I have to say I have no confidence because I'm not sure what is the reason for this problem.



On the same system, I have another switch with a much shorter wire (1m) and I never had any issue with this one. This is why I guess my wires are acting as antennas, but I don't know for sure (especially since shielded wires did not help).



Any idea about what could happen would be appreciated.
Thank you










share|improve this question













I've been working on a simple project involving a Raspberry pi and some switches.
I would never thought I would have any problem for something as simple as a switch, but here I am.



The 2 wires from my switch are connected to the raspberry.
One is connected to gnd, the other is connected to a GPIO. The internal pullup resistor of the raspberry is used.



The length of the cable is around 7m.



The program is just a mater of reading the GPIO and sending commands according to state changes.



My problem is simple : everything works fine for some time, but eventually the switch ends up not "working" anymore (reading low state whether or not the switch is pushed).



I checked the switch, and of course it still opens and closes as expected, so the problem comes from somewhere else. What I did is I disconnected the switch, and measured the voltage between the two wires : I get 0V.



This is my first clue for thinking something bad happened to the raspberry. Because the internal pullup is used, I should have measured around 3.3V. And this is indeed what I measure if I replace the raspberry with a new one.



I thought this might be caused by EMI, causing voltage spikes ? I really have no experience dealing with this. So what I did is I replaced the raspberry, and I added an external pullup resistor with a lower value (the internal resistor is 30k, I used 1k as external resistor), guessing that this would reduce the noise. But the same thing happened after one day.



This time, when I measure the voltage at the GPIO, I have around 1.2V. According to the reading, using a simple voltage divider, this is equivalent to a resistor value of 600Ohms pulling down the signal inside the raspberry. Definitely not normal.



Then I tried to replace the wires with shielded audio cable, connecting the the shielding to ground. And half a day later, yet another raspberry was good for retirement.



I have now placed a ceramic capacitor between gnd and the GPIO (100nF), and for now it seems to be ok (it's only been 12h) but I have to say I have no confidence because I'm not sure what is the reason for this problem.



On the same system, I have another switch with a much shorter wire (1m) and I never had any issue with this one. This is why I guess my wires are acting as antennas, but I don't know for sure (especially since shielded wires did not help).



Any idea about what could happen would be appreciated.
Thank you







raspberry-pi noise interference shielding over-voltage-protection






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 56 mins ago









Fardenco

164




164







  • 5




    I would try putting a bidirectional transient voltage suppressor (TVS) on the input. The long wire could be picking up transients that are then coupled into the PI input. The TVS will also act to clamp static discharges.
    – crj11
    46 mins ago












  • 5




    I would try putting a bidirectional transient voltage suppressor (TVS) on the input. The long wire could be picking up transients that are then coupled into the PI input. The TVS will also act to clamp static discharges.
    – crj11
    46 mins ago







5




5




I would try putting a bidirectional transient voltage suppressor (TVS) on the input. The long wire could be picking up transients that are then coupled into the PI input. The TVS will also act to clamp static discharges.
– crj11
46 mins ago




I would try putting a bidirectional transient voltage suppressor (TVS) on the input. The long wire could be picking up transients that are then coupled into the PI input. The TVS will also act to clamp static discharges.
– crj11
46 mins ago










1 Answer
1






active

oldest

votes

















up vote
4
down vote













The wire has inductance and, the longer the wire is the more inductance it has. An inductance likes to maintain the current flowing through itself so, when your switch opens, the small stored energy in the cables magnetic field tries to maintain current flow and produces a sizable voltage (aka back-emf) in doing so. This can easily exceed the maximum voltage rating of your IO pin and pop goes the chip.



The capacitor provides a path to maintain current flow when the switch opens and normally will restrict any voltage spike (back emf) considerably. I have faith in it working but if it doesn't then it could be pick-up from AC power lines or some rogue RF transmitter nearby. In this case use a capacitor and a zener diode rated at a little below your power rail voltage.






share|improve this answer




















  • Thank you for your answer. I will try to see this voltage spike using an oscilloscope and confirm that the capacitor eliminates it. I'll come back after one week if the system is still alive to validate your answer !
    – Fardenco
    21 mins ago










Your Answer




StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
);
);
, "mathjax-editing");

StackExchange.ifUsing("editor", function ()
return StackExchange.using("schematics", function ()
StackExchange.schematics.init();
);
, "cicuitlab");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "135"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f399515%2flong-wires-causing-raspberry-pi-to-die%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
4
down vote













The wire has inductance and, the longer the wire is the more inductance it has. An inductance likes to maintain the current flowing through itself so, when your switch opens, the small stored energy in the cables magnetic field tries to maintain current flow and produces a sizable voltage (aka back-emf) in doing so. This can easily exceed the maximum voltage rating of your IO pin and pop goes the chip.



The capacitor provides a path to maintain current flow when the switch opens and normally will restrict any voltage spike (back emf) considerably. I have faith in it working but if it doesn't then it could be pick-up from AC power lines or some rogue RF transmitter nearby. In this case use a capacitor and a zener diode rated at a little below your power rail voltage.






share|improve this answer




















  • Thank you for your answer. I will try to see this voltage spike using an oscilloscope and confirm that the capacitor eliminates it. I'll come back after one week if the system is still alive to validate your answer !
    – Fardenco
    21 mins ago














up vote
4
down vote













The wire has inductance and, the longer the wire is the more inductance it has. An inductance likes to maintain the current flowing through itself so, when your switch opens, the small stored energy in the cables magnetic field tries to maintain current flow and produces a sizable voltage (aka back-emf) in doing so. This can easily exceed the maximum voltage rating of your IO pin and pop goes the chip.



The capacitor provides a path to maintain current flow when the switch opens and normally will restrict any voltage spike (back emf) considerably. I have faith in it working but if it doesn't then it could be pick-up from AC power lines or some rogue RF transmitter nearby. In this case use a capacitor and a zener diode rated at a little below your power rail voltage.






share|improve this answer




















  • Thank you for your answer. I will try to see this voltage spike using an oscilloscope and confirm that the capacitor eliminates it. I'll come back after one week if the system is still alive to validate your answer !
    – Fardenco
    21 mins ago












up vote
4
down vote










up vote
4
down vote









The wire has inductance and, the longer the wire is the more inductance it has. An inductance likes to maintain the current flowing through itself so, when your switch opens, the small stored energy in the cables magnetic field tries to maintain current flow and produces a sizable voltage (aka back-emf) in doing so. This can easily exceed the maximum voltage rating of your IO pin and pop goes the chip.



The capacitor provides a path to maintain current flow when the switch opens and normally will restrict any voltage spike (back emf) considerably. I have faith in it working but if it doesn't then it could be pick-up from AC power lines or some rogue RF transmitter nearby. In this case use a capacitor and a zener diode rated at a little below your power rail voltage.






share|improve this answer












The wire has inductance and, the longer the wire is the more inductance it has. An inductance likes to maintain the current flowing through itself so, when your switch opens, the small stored energy in the cables magnetic field tries to maintain current flow and produces a sizable voltage (aka back-emf) in doing so. This can easily exceed the maximum voltage rating of your IO pin and pop goes the chip.



The capacitor provides a path to maintain current flow when the switch opens and normally will restrict any voltage spike (back emf) considerably. I have faith in it working but if it doesn't then it could be pick-up from AC power lines or some rogue RF transmitter nearby. In this case use a capacitor and a zener diode rated at a little below your power rail voltage.







share|improve this answer












share|improve this answer



share|improve this answer










answered 45 mins ago









Andy aka

231k10171395




231k10171395











  • Thank you for your answer. I will try to see this voltage spike using an oscilloscope and confirm that the capacitor eliminates it. I'll come back after one week if the system is still alive to validate your answer !
    – Fardenco
    21 mins ago
















  • Thank you for your answer. I will try to see this voltage spike using an oscilloscope and confirm that the capacitor eliminates it. I'll come back after one week if the system is still alive to validate your answer !
    – Fardenco
    21 mins ago















Thank you for your answer. I will try to see this voltage spike using an oscilloscope and confirm that the capacitor eliminates it. I'll come back after one week if the system is still alive to validate your answer !
– Fardenco
21 mins ago




Thank you for your answer. I will try to see this voltage spike using an oscilloscope and confirm that the capacitor eliminates it. I'll come back after one week if the system is still alive to validate your answer !
– Fardenco
21 mins ago

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f399515%2flong-wires-causing-raspberry-pi-to-die%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

Long meetings (6-7 hours a day): Being “babysat” by supervisor

What does second last employer means? [closed]

One-line joke