led output as an input

hi

i need to take what is the output for a led on a comemrcially purchased board, disconnect the led and feed that into an arduino pin, so that i can put a state indicator on an LCD and thus monitor the state of varios boards at the same time through the LCD.
no output on either board will go over 5v

my question is two fold,
1 can i use digital read to get the state of each input. and then use an if statement show the indicator based on the digital input being over 50 for example,

2, what should i do to protect the arduino input pins against over voltage?

thanks in advance for any help

Why remove the LED at all?
Simply make up a simple optocoupler, then you don't need to worry about over-voltage protection.

Not quite making sense to me here.

If "no output on either board will go over 5v" then how can "digital input being over 50 " occur?

If "no output on either board will go over 5v" then how can "digital input being over 50 " occur?

I think that should have been "analogRead() value being over 50".

spruce_m00se:
hi

i need to take what is the output for a led on a comemrcially purchased board, disconnect the led and feed that into an arduino pin, so that i can put a state indicator on an LCD and thus monitor the state of varios boards at the same time through the LCD.
no output on either board will go over 5v

Unless you share a common power source between the Arduino and the commercial board, I doubt this would work, since the current would need to flow in both boards.

As AWOL suggested what you want is called an opto-coupler or opto-isolator. One way is to take the LED out of the board and connect the LED power and ground to an opto-coupler on one side, and the Arduino pin and ground on the other. Here is a tutorial: http://arduino-info.wikispaces.com/Popular-ICs.

The other way is to make your own opto-isolator as AWOL suggests. An opto-isolator basically has a LED inside of the chip, and a light sensor. Since you have a light already, you would just need to attach a photo sensor to the led, and then cover it up with tape so the only light that the photo sensor sees is the LED.

my question is two fold,
1 can i use digital read to get the state of each input. and then use an if statement show the indicator based on the digital input being over 50 for example,

A digital input only returns 0 or 1. It does not return a voltage like 50. You could use an analog input if you needed that.

With digital inputs, you need to decide whether to add a resistor to your circuit for the normal pull down inputs, or switch to use pull up switches (which flips the sense of the digital input, it would return 1 if there is no connection).

It occurs to me that you may need to sample the light several times, since the commercial board may be turning it on/off quickly to get a desired brightness.

2, what should i do to protect the arduino input pins against over voltage?

Opto-isolator.

PaulS:

If "no output on either board will go over 5v" then how can "digital input being over 50 " occur?

I think that should have been "analogRead() value being over 50".

Thanks for that,

"Unless you share a common power source between the Arduino and the commercial board, I doubt this would work, since the current would need to flow in both boards."

I was planning to conenct the grounds of each seperate board to the arduino ground,
is that a bad plan ?

Yes, only the grounds need to be connected. "Common power source" implies both (all?) boards use the same 5V source, that is not needed.
The analog reading of 50, that's ~.24V, is that what you see with a meter? Seems pretty low for an LED, I would have expected more like 1.7 to 2V from one side of the LED to the other.

I was just using the 50 as a rough example,
i dont need to really know what level the Analogue read is, I just need to know that the voltage is above the OFF voltage, and 50 seemed to be a reasonable margin of error for if there is a little voltage present when the LED should be off,

i was going to use an
if (led>50)
lcd.print ("led on")

that kind of thing ,

Ok. Maybe put a meter on & confirm.
May get different reading if LED cathode goes to Gnd, vs cathode going to a resistor to Gnd for example.
Or if the cathode was switched hi/lo vs the anode being switched hi/lo.

On the board with the leds that you want to monitor, connect your voltmeter to the ground and measure with the other lead of your voltmeter the voltage over the led when the led is on and of.
Assuming you will see a really low voltage when the led is off and a well over 2V voltaged when the led is on...
Connect the ground of the Arduino to the ground of the "to be monitored" board.
Set your input pin to input (default at stratup)
Use digital read ... chances are really high it will work.
If it would not work chances are high that the Arduino will always read a high (even when the led is off). If that is the case... connect a 10k resistor between the input pin and the ground on the Arduino (it shoud make it so that you read a lowwhan the led is off).

Jan Huygh