I am trying to use an Uno to detect if an LED is on or not. Sounds simple, but I am tearing my hair out on this one, here is why.... This is a model railway application and I want to detect an LED being lit on the control panel showing how a route (points/turnouts) is set. The LED is lit by a point position indicator (www.blocksignalling.co.uk/index.php/points-position-indicator-ppi4-dc) which works perfectly but the LEDs are not permanently on when lit, even though they appear so, they are pulsed at around 8khz. I tried using opto isolators triggering an digital input on the Uno. They all happily detect 'no light' and the pin goes HIGH, but when the led is lit, the pin flucuates between 0 and 1 so not a true or stable LOW. I also made my own opto using a TCRT5000 with the leds pointing at eachother encased in shrinkwrap, using standard breadboard set-up which worked perfectly when powering the transmitter from the Uno, but same result when powered from the LED. Anyone out there got any ideas please?
Count HIGH values read for example in 2 ms. It should be zero if the LED is not lit and more then zero if it is lit.
Why not connect a low pass filter to the LED, and measure the DC level coming out? Will certainly be higher when on than when off. Resistor from anode to analog input pin, and capacitor to Gnd.
Use a photoresistor (also called LDR).
Connect the photoresistor between Vcc and an analog input and place it physically next to the LED you want to monitor.
In your arduino code simply monitox the analog input value. When the LED will be on the photoresistor will have a lower resistance andyou will read a higher analog voltage.