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?

  • use a CDS sensor; they are slow enough that 8khz is no problem.
    – dandavis
    Oct 31, 2018 at 16:49
  • why don't you detect the state of the switch that operates the LED??
    – jsotola
    Oct 31, 2018 at 17:02
  • Yes, the point motor (solenoid) is triggered by the switch, but though a capacitance discharge unit (CDU) which fires a momentary high current that would damage the Uno. The PPI detects this high value and lights the corresponding low voltage LED.
    – PaulH
    Nov 1, 2018 at 18:30

3 Answers 3


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.

  • Good thought, the one thing I can rely on is the HIGH value stays there when it should be, so counting a fixed number of responses and if all HIGH then assume HIGH, anything else, assume LOW. Thank you.
    – PaulH
    Nov 1, 2018 at 18:28

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.

  • good thought, I would need to add another LED in series to the one in the control panel as that doesn't show any light under the panel.
    – PaulH
    Nov 1, 2018 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.