Electronics > Projects, Designs, and Technical Stuff
Detect wire break on LDR - long cable
(1/1)
mrburnzie:
Hello everyone!
I have a part of a project where I have an LDR, which I read through an ADC with a voltage divider configuration.
LDR is connected to +5V and ADC, 4k7 to ADC and GND. Simple stuff.
I have to detect the full range of the LDR, meaning from total dark to full light.
Everything works, but I need a feature where I have to detect if the LDR is disconnected.
By disconnected I mean disconnected from the +5V rail and the ADC rail, independently.
The extra problem is that the LDR is connected with 2m, 3mm thick copper cable (4m because it is on both legs of the LDR, so back and forth it's 2x 2m).
I have a 100nF cap on the ADC which is helping with the distortions.
I had no luck, because when I'm detecting full darkness (Rd is 20M) I detect it as an open circuit.
I have seen a lot of examples on the internet, but I need assurance on what should I try?
Extra:
http://www.farnell.com/datasheets/77395.pdf the datasheet of the LDR used
Would a photodiode make the job easier? Something like a SFH203FA?
Using an ATmega32u4
macboy:
Place a low leakage diode (1N4148?) across the LDR, reverse biased (so it normally does not conduct). Connect the LDR to a GPIO pin instead of to +5V, and place a high value (100 K to 1 MOhm) resistor to ground.
To detect a break in the connection, set the ADC pin to digital and output high/one (5 V). Set the LDR output pin to digital input and read the value. If the connection is good, the diode and/or LDR will conduct, so the voltage will be at about 4.4 V which will measure as a high/one. If it is disconnected, the pin is pulled low by the resistor to ground, and it will read as a low/zero. It is not possible to detect the exact location of the break.
mrburnzie:
I just ran a simulation on the configuration, and it should work!
Thanks! Will get back to you with real life testing ;) kudos! :clap:
Navigation
[0] Message Index
Go to full version