How to detect broken wire

Very generic question, maybe answered already somewhere, but I did not find any topics.

So, can I use 5V output directly as input for any analog pin or digital pin? The target is to detect if the wire breaks (=input voltage disappears).

Yes.

If you have a voltage divider(two resistors) feeding your analog input (say 10k to +5V and 10k to Gnd) your analogRead() will return 0 for LOW, 1023 for HIGH and about 512 for 'diconnected'. Any value not near those would indicate a problem like a poor connection.

1 Like

I'd like to see a circuit diagram which arrived at those conclusions.

Here is a link to the Wikipedia page that explains what a voltage divider is.

John gave an example using two 10K resistors which if you follow the calculations gives V out of 2.5 volts, this voltage is connected to an analog input. Analog read returns a value between 0 and 1023 which is proportional to an input voltage of 0 to 5 therefore the input of 2.5 volts will return a value of ~512.

The original poster wants to monitor a 5 volt wire so if this 5 volt wire is connected to the analog input along with the output from the voltage divider the voltage rises from 2.5 volts to 5 volts and the analog read then returns 1023, this value signals that all is well with the wire. If the wire should break then the analog value will go to 512 or if the wire being monitored is grounded then analog would show 0. So not only does it show a wire fault it also indicates what the problem might be.

Fair enough...I had assumed the Op would be providing the 5V from his "wire".....

Your instance assumes the Op's wire is between the V divider and analog input.
Guess they are pretty much covered but with different outcomes.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.