element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • Product Groups
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Personal Blogs
  • Members
  • More
Personal Blogs
Legacy Personal Blogs Experimenting With Using an LED as a Light Sensor
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: jc2048
  • Date Created: 2 Apr 2020 9:04 PM Date Created
  • Views 2366 views
  • Likes 16 likes
  • Comments 14 comments
  • lt1009
  • light sensor
  • op177
  • photodiode
  • experimenting
  • op amp
  • analogue design
  • led
  • transimpedance amplifier
  • uno
  • jc2048
  • arduino
Related
Recommended

Experimenting With Using an LED as a Light Sensor

jc2048
jc2048
2 Apr 2020

Does an LED work as a light sensor? Short answer is yes. That's fairly well known, but I've never tried it myself, so here goes.

 

I'm going to use a couple of old high-brightness red LEDs. I don't know much about them other than that they are definitely high in brightness, have a narrow viewing angle, and the package is 'crystal clear'.

 

My light source is an Arduino flashing one of the LEDs five hundred times a second [if Jan Cumps can do a 'blinky', so can I!]. I've got a 330R resistor for the current limiting, so the current will be around 10mA.

 

For the receiver I repurposed an old experiment, so not ideal but it will do for the blog. The board had an OP177 op amp on it. I've reworked it to be a simple transimpedance amplifier. It won't be particularly fast, but with a bit of luck it will be able to keep up with the Arduino.

 

The output of the reverse-biased LED will be a few uA at most [the current is proportional to the light and is what we are trying to detect].

 

Here's the circuit

 

image

 

and here it is on the bench

 

 

image

 

Most of the photo-current through the LED also flows through the 10M resistor. The op amp will adjust its output so that the connection between the LED and the resistor remains at 2.5V, to match the other input. So the voltage across the resistor will be 10V for each uA of current flow. With a more sophisticated circuit we could get that output voltage referenced to ground, either by working with dual-rail supplies or by following the transimpedance amplifier with a differential amplifier. In this case I'm going to cheat and clip the earth of the scope to the 2.5V being produced by the voltage reference. That's effectively the same potential as the LED/resistor node. I can do that because the bench supply output that's powering the board isn't tied to any outside voltage. [The reason for not attaching it to the node itself is because that would cause the op amp to oscillate (I tried it: it does).]

 

Here's what the oscilloscope sees:

 

 

image

 

The yellow trace is the op-amp output [relative to the 2.5V reference] and the blue trace shows the Arduino pin that's driving the LED. The output from the LED is only just up at the 1uA mark, and that's with a lot of light pouring in to it, but it does work (the op amp output is limiting at the top). I was worried that the 'dark' current (the basic leakage current of the diode) might be quite high, but you can see from this that it's actually fairly good and doesn't have any impact on the results.

 

The ramping of the output up and down comes from the charging of the capacitor across the feedback resistor.

 

Next, I tried increasing the distance between the LEDs by about a centimetre, like this

 

image

 

and that produced this trace

 

image

 

now the amplitude is lower (there's quite a lot of overshoot, but I'm going to ignore that).

 

OK, so what happens if I change the red LED on the UNO side for a green one, like this?

 

 

image

 

Does it still work?

 

 

image

 

And the answer is yes. The level is much lower, but then the green LED is dimmer anyway.

 

Having just invented the optocoupler, I'm going to stop there. As far as I can see, there isn't any real use of this - if you need an optocoupler, buy an optocoupler; don't try and make one out of a pair of LEDs - but it's quite fun to play with.

 

There's a further blog on the topc here: More on Using an LED as a Light Sensor

 

If you found this interesting and would like to see other blogs I've written, a list can be found here: jc2048 Blog Index

  • Sign in to reply

Top Comments

  • Andrew J
    Andrew J over 3 years ago +5
    I Did not know that! Don’t pack it away just yet, turn it around. Attach a momentary switch on what is currently the output side and have the Arduino detect it. See if you can create an opto-coupler morse…
  • jw0752
    jw0752 over 3 years ago +4
    Hi Jon, Actually I think that this was quite an important experiment. Finding out and experimenting with the fringe properties of components can lead to a better understanding and who knows there may even…
  • Fred27
    Fred27 over 3 years ago +4
    Great stuff, Jon. I knew this was possible and mentioned it recently on Dubbie's recent Laser Activated Display. I've never tried it myself though.
  • dubbie
    dubbie over 3 years ago in reply to jc2048

    Jon,

     

    Regretfully my multimeter is not as good as this, it is just  al ow cost hand-held one. The lowest current scale is 200 uA so may or may not be able to measure differences as small as 0.1 uA. I'll have to look for some MOhm resistors in my old stuff. I did have some very old carbon based resistors from when I was a lad tucked away at the back of a cupboard - it's time I dug them out anyway as I'm trying to declutter my garage anyway.

     

    Dubbie

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 3 years ago

    Very good experiment.

    It is one of those projects where you know intuitively that it will work, but it is always fun to verify theory with testing.

     

    DAB

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • jc2048
    jc2048 over 3 years ago in reply to dubbie

    If you have a reasonable bench meter, you can measure the current directly. The LED doesn't seem to be as efficient as a silicon photodiode would be. Here I'm measuring an LED [5V reverse bias - the additional 2k2 resistor is just for safety so that I don't accidently blow the meter fuse when fumbling around] that's pointing out of a window [grey, overcast conditions] and the resulting current is only about a tenth of a uA.

     

    image

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • jc2048
    jc2048 over 3 years ago in reply to Fred27

    Thanks Fred. It was your comment that triggered off this blog [I've gotten really bogged down on a couple of others and thought if I did a quick, easy one it would motivate me to get and finish the others].

     

    Here's a link to Dubbie's blog: LEDGrid Display # 2 : The Laser Activated Display

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • jc2048
    jc2048 over 3 years ago in reply to Andrew J

    For interfacing to a processor, there's a much simpler way than using an op amp as a transimpedance amplifier. If you drive an LED and then remove the drive voltage (tristate the output driving it), you'll be left with a voltage somewhat lower than the forward voltage hanging around. That voltage is being held on the capacitance that exists between the two sides of the junction. The voltage will change as the photocurrent discharges it, so if your processor pin can be switched to be a high-impedance analog input you could measure it and then see how much it has moved a little while later [you wouldn't be able to do this with all processors: Microchip PICs, for instance, don't have a high-impedance buffer ahead of the A/D sampling circuitry, but the small Atmel parts do]. I don't know for sure, but I would imagine that how it's done on a Micro:bit, where the LEDs are used as the light sensor.

     

    Edit: I was wrong. The A/D on the 328 processor on the UNO and NANO needs to be driven from a lowish resistance source too, so you wouldn't be able to do it with those parts either.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2023 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube