I have a sensor that turns an LED on/off accordingly. Can I take this input directly to arduino? Like connect two wires across LED - one wire to GND and other to digital pin?
Yes.
As long as you can garentee there is no other way for current to flow to the led circuit.
a1604:
I have a sensor that turns an LED on/off accordingly. Can I take this input directly to arduino? Like connect two wires across LED - one wire to GND and other to digital pin?
can you plz tell me that sensor name
Can I take this input directly to arduino? Like connect two wires across LED - one wire to GND and other to digital pin?
As long as there is no common ground between the two circuits, and as long as the polarity is correct, it should work.
I'd probably add a series resistor and "protection diodes" across the Arduino input to be safe. If there is a common ground, it's possible to damage the sensor circuit and/or the Arduino if you have not carefully measured the voltages and analyzed the current paths. And depending on the sensor circuit, its possible to have everything work and then a "blown" LED could send more than 5V into the Arduino, damaging it.
Firstly measure the voltages with a multimeter, see if the voltages are correct for
an Arduino pin. You need a minimum of 3.0V to read as HIGH and a maximum of
1.5V to read as low. Voltages below 0V or above 5V will destroy the arduino (unless
you add protection resistor such as 10k in series with the pin).
You need to establish a common reference (which might already be ground in
both circuits and might already be commoned via power source). If you can't
simply common the grounds for each circuit its more problematical.
Worth reading about opto-couplers.
As other have said measure the voltage across the led so you can determine polarity and voltage level. Standard red leds have Vf of like 1.5vdc so it would be better to wire it to a analog input pin in your sketch as that would be too low to read as a digital signal.
Lefty
skullbucks:
can you plz tell me that sensor name
He is called George.