0

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?

asked Oct 31, 2018 at 13:09
3
  • use a CDS sensor; they are slow enough that 8khz is no problem. Commented Oct 31, 2018 at 16:49
  • why don't you detect the state of the switch that operates the LED?? Commented 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. Commented Nov 1, 2018 at 18:30

3 Answers 3

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.

answered Oct 31, 2018 at 13:18
1
  • 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. Commented Nov 1, 2018 at 18:28
2

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.

answered Oct 31, 2018 at 13:16
1

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.

answered Oct 31, 2018 at 21:38
1
  • 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. Commented Nov 1, 2018 at 18:35

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.