Use an LED as a sensor

Posted on Tuesday, February 4th, 2014 in LEDs, sensors by DP


Michael Beyhs shows us how to use an LED as a sensor:

How the code works:

  • Configure all analog inputs to outputs and pull low to turn on all red LEDs.
  • Turn one analog input pin into an actual Input and read the amount of light that is reflected into it.
  • Turn that input back into an output and continue on to next.
  • After all inputs have been read adjust the PWM of the blue LEDs according to the amount of light that was measured.
  • loop forever…

Via Hacked Gadgets.

This entry was posted on Tuesday, February 4th, 2014 at 7:00 pm and is filed under LEDs, sensors. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

4 Responses to “Use an LED as a sensor”

  1. Carl Hage says:

    The usual (more sensitive) method of using an LED as a light sensor is to charge a diode with a reverse bias, then measure the time it takes to discharge. If the LED is used as an emitter and sensor, then 2 ports are needed to be able to forward bias as an emitter and reverse as a sensor. Search “led light sensor” or “forrest mims led sensor”.

  2. steves says:

    Besides light, what is it sensing?

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Recent Comments

  • Drone: The LM7171 used in this very simple design can be simulated in LTspice with reasonable results at 10MHz using the non-encrypted PSPICE model from TI...
  • Jon Jackson: I would be interested in 1 or 2 of your circuit boards. Jon
  • Max: An actual Saturday "detector" built with the same hardware would use the precisely timed slightly varying length of the day (and some built-in astronomy data)...
  • KH: In the old days, these things remained on paper forever as whimsical scrawls. Today, they are brandished about on blogs for the entire world to...
  • KH: So he doesn't really know what he's doing. Yawn. It's sensor-controlled. It's not an oscillator. A leaf covers the window, you're toast. TLV3702? Overkill. The...