I have read about LED in Wikipedia, and it says that LED can be used for both light emission and sensing. Is it possible to achieve this and how?

  • 5
    \$\begingroup\$ An LED can act as a photodiode, but not necessarily a particularly good one. \$\endgroup\$
    – Shamtam
    Jun 14, 2017 at 15:25
  • 1
    \$\begingroup\$ If I Recall Correctly, L Forrest Mimms had a patent fight with Bell back in the '60s or '70s about his idea for this exact technique. I believe that he won that battle. \$\endgroup\$ Jun 14, 2017 at 15:27
  • \$\begingroup\$ Yes you can use an LED for light sensing. Try this link as a starting point. \$\endgroup\$
    – Steve G
    Jun 14, 2017 at 15:29
  • \$\begingroup\$ There are endless circuits for using an LED both as a emitter and receiver. I'd start here with a simple Arduino schema .....this works fairly well. You can slow this down by adding capacitance across the LED. This can also be done using an LED array (touch sensitive array). \$\endgroup\$ Jun 14, 2017 at 15:56
  • 2
    \$\begingroup\$ If you have an oscilloscope, just put your probe across the terminals of the LED and shine some light on the LED with a remote control. You can even read codes, that way. \$\endgroup\$ Jun 14, 2017 at 16:15

2 Answers 2


Try this circuit:


simulate this circuit – Schematic created using CircuitLab

The transistor (non critical, any general purpose NPN will likely work) amplifies the weak photocurrent from the LED used as a photodiode. Make sure you get the polarity right on the LED or you will damage the LED and the transistor. Connect a 1K in series with the LED if you are not sure (the LED should not light!). A couple hundred nA from the LED/PD should drive the input low (assuming there is no additional loading from the input eg. pullup).

The LED will produce a current from wavelengths that are similar or less than the emission spectrum, so a green LED will respond to blue (or green) light but not respond to red light.

If you wanted an analog voltage to feed to an ADC to measure the light, you can use a high value resistor (eg. 20M\$\Omega\$) and an op-amp voltage follower buffer (eg. MCP6001). The resistor value may be higher or lower depending on the desired sensitivity and the particular LED you happen to find- commercial photodiodes with guaranteed specs can be quite cheap if you tire of characterizing parts yourself (or they can be very expensive if you need high performance - eg. 300ps response time, 50pA dark current and ~1A/W sensitivity)

  • \$\begingroup\$ "The LED will produce a current from wavelengths that are similar or less than the emission spectrum, so a green LED will respond to blue (or green) light but not respond to red light." Blue light is more energetic, so I would expect a green led to react to green and red light. Why is this not the case? \$\endgroup\$ Jun 14, 2017 at 23:28
  • \$\begingroup\$ It's a quantum thing. Energy hv can be absorbed/emitted only if you have an energy level hv eV higher/lower from where you stand. If that new level is not present, present but not allowed for a given transition, or present and allowed but occupied, you can't absorb/emit radiation of that frequency (energy). Think resonance: certain structures vibrate at very specific frequencies. Use the wrong frequency and there will be no effect. \$\endgroup\$ Jun 15, 2017 at 3:43
  • \$\begingroup\$ @someonewithpc because red light isn't energetic enough \$\endgroup\$ Jun 15, 2017 at 9:22
  • \$\begingroup\$ Nevermind, I just noticed I miss read it. \$\endgroup\$ Jun 15, 2017 at 12:02

Yes, a LED can be used as a sensor. It gives output current proportional to light intensity, similar to a solar cell. But because its area is very small, current is also very small.
You can measure photocurrent with a digital voltmeter. Most meters have input resistance of 10 MEGohms, and you will be measuring current through this resistance. So if your voltmeter displays "0.1V", then photocurrent is 10 nA.

Your stock RPI has no voltmeter function. Arduino is able to measure analog voltage, but it likely has smaller internal resistance than a standard voltmeter. You can either use an op-amp buffer circuit, or use an op-amp transimpedance amplifier that converts input current to output voltage.


simulate this circuit – Schematic created using CircuitLab

Supply connections to the op-amp are not shown in Circuit-Lab. Connect the negative supply to "Vss", and the positive supply to +3.6V or to +5V. The second circuit is better than the first. The LED in the first circuit self-limits to something less than a few volts, whereas the second circuit is limited by the DC supply voltage. Note that a single-supply op-amp is required whose common-mode input range includes the negative supply rail (Vss in this case)...not every op-amp has this feature.

  • 1
    \$\begingroup\$ Oi, what was I thinking? Yes, "-" should be connected to output. \$\endgroup\$
    – glen_geek
    Jun 15, 2017 at 19:11

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.