I want to watch the LED of a piece of equipment. I can't open it (implies on loosing warranty). I'm seeking solutions to read this LED in a non-invasive way such as using LDR, Photodiode, etc. I've got no experience on this so any ideas and experience on this is welcome.
Gatis:
I want to watch the LED of a piece of equipment. I can't open it (implies on loosing warranty). I'm seeking solutions to read this LED in a non-invasive way such as using LDR, Photodiode, etc. I've got no experience on this so any ideas and experience on this is welcome.
I've use a small LDR to track the state of an LED. Use something opaque to keep ambient light from triggering your LDR.
Here is some code that self-tunes. It keeps track of the max and min LDR values and uses the mid-point as the limit for ON vs OFF.
void CheckRecordingLight(boolean &isRecording, unsigned long &lastRecordLightTime,int APIN_RECORDING,
unsigned int &minReading, unsigned int &maxReading, unsigned int faultFlag)
{
int reading = analogRead(APIN_RECORDING); // Read the LDR
if (reading < minReading)
minReading = reading; // New minimum
if (reading > maxReading)
maxReading = reading; // New maximum
unsigned int avgReading = (minReading + maxReading) / 2;
// Light is ON if reading is less than the midpoint (unless this is the first reading)
boolean recordLight = (reading < avgReading) && (minReading != maxReading);
if (recordLight)
{
lastRecordLightTime = millis();
isRecording = true;
}
// If the light has been off for more than two seconds
if (millis() - lastRecordLightTime > 2000)
{
isRecording = false;
}
}
Gatis:
I tried using the photodiode of a Photo Interrupter but it did not work with colored LEDs. In fact, it only works with IR-LEDs.
I find that surprising. Google image search for "photodiode wavelength" and you'll find graphs of their sensitivity to various wavelengths -- and they're pretty sensitive to a wide range.