Go Down

Topic: led output as an input (Read 885 times) previous topic - next topic

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

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

AWOL

Why remove the LED at all?
Simply make up a simple optocoupler, then you don't need to worry about over-voltage protection.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

CrossRoads

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?
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

PaulS

Quote
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".

MichaelMeissner

#4
Aug 09, 2012, 04:22 pm Last Edit: Aug 09, 2012, 04:25 pm by MichaelMeissner Reason: 1

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.

Quote

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.

Quote

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

Opto-isolator.

spruce_m00se


Quote
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,

spruce_m00se



"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 ?



CrossRoads

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.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

spruce_m00se

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 ,

CrossRoads

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.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

jan_huygh

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

Go Up