LED as a light detector

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply
User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

LED as a light detector

Post by JohnCrow »

I had remembered hearing about using an ordinary LED as a simple light detector.
I've just got round to trying some simple tests to see if it worked.

Connect an LED across the DCV on a digital multimeter and shine a light on it. (No resistor needed)

I used my halogen desk lamp. (the bulb is 12V and quite bright) and put the led just under the lamp.
I got the following results.

Unbranded rally specials
Red LED =1.3 V
Orange LED = 1.3 V
Yellow LED = 1.5 V

Infrared LED = 0.9V

Good quality high brightness LEDs from Rapid Electronics
Clear Yellow = 1.5 V
Clear Blue = 1.5 V
UV LED = No response in visible or green laser light

But I found the clear ones also responded to being placed next to a 5mW green laser and gave about 1.9 V. The infrared gave about 0.8V under green laser light.

Obviously they will not be able to supply any current but its an interesting idea.
I would expect they will respond best to light of the same wavelength they are designed to emit.
Two LEDs of the same colour connected with a non-transparent tube sush as heat shrink could possibly be used as a makeshift opto-coupler.

Next I will have to see if I can use a microcontroller to detect the output.
1 in 10 people understand binary, the other one doesn't !

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LED as a light detector

Post by medelec35 »

Hi John,
This is very interesting information indeed!
I did not know that LEDs react to light in this way.
Thanks for sharing this, I also have a play!

Martin
Martin

Spanish_dude
Posts: 594
Joined: Thu Sep 17, 2009 7:52 am
Location: Belgium
Has thanked: 63 times
Been thanked: 102 times
Contact:

Re: LED as a light detector

Post by Spanish_dude »

I think you only need to reverse the polarity of the LED and you have a light sensor.
Try this : resistor tied to Vcc, kathode tied to the other end and the anode to GND.
Measure the voltage across the LED, shine some light and voilà.

I read about this somewhere a while back.

Nicolas

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: LED as a light detector

Post by Benj »

Hello,

Nice project there John.

I have read about lighting technology that runs LEDs on a fairly low frequency PWM. On the space portion of the PWM cycle the LED is sampled and this allows the ambient light levels to be taken into account. This allows lighting to only come on when it's starting to get dark and switch off if another light source comes into the scene or a big light is switched on etc. Might make a good project simply trying to re-create this automatic circuit for a single LED.

I wonder if you could use a RGB led to collect different ambient colour values and then adjust the LED output accordingly to give colour matched light?

It also means that the conspiracy nuts can still rationally claim that the TV is watching us :wink:

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: LED as a light detector

Post by dazz »

Heres a quick fcd i did to use an led as a light sensor, connections are in the comments in the fcd, just a simple way to use an led to switch on another at a preset level (been having a homer simpson moment light on, light off, light on. )
led as a light sensor.fcf
(10.5 KiB) Downloaded 506 times
Im working on one that just uses one led and samples during the off periods but im stuck as i need to switch port bit from an output to an input, but i cant get it to work (deleted the fcd for that as i had a hissy fit :lol:)
although when i was playing around i did manage to get it to act like a switch (a hillbilly cap switch ;) )

Wil post another fcd if i ever get the second one working
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: LED as a light detector

Post by dazz »

Well i finally kinda figured it out with a pic i spent most of today trying to get it to work wit an 18f26k80 but could not get the lcd to work, so swopped it for a P18F27J53 which woked first go, the attached flowchart(im not very good with flowcode :lol: ) is not the prettiest solution but it works and needs fine tuning,it's a fun circuit as you use one led with the anode connected to an adc channel and the cathode to a different pin and by repeatedly switching the adc from an input to an output ,with the corresponding action on the other pin, the led switches between a sensor and a light. there is a delay in the chart this needs experimenting with as it allows less flicker depending on the led you use, its almost flicker free if viewed front on but you can see the flicker from the side as its just a test to prove the concept it will flicker when its at the threshold point of switchin on when it gets dark(you choose this point instructions are in the chart), i've added an lcd to show the adc readings so you can choose the point that the led switches on, much smoother transitions could be achieved using pwm output and measuring on the low point but thats beyond my abilities at the moment.

The next thing to work on with this is to get it to talk to another one and send basic data, so feel free to chip in with ideas how i can do this as i aint got a clue :oops:

Regards
Dazz
led as a light sensomr.fcf
(16.5 KiB) Downloaded 534 times
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

Spanish_dude
Posts: 594
Joined: Thu Sep 17, 2009 7:52 am
Location: Belgium
Has thanked: 63 times
Been thanked: 102 times
Contact:

Re: LED as a light detector

Post by Spanish_dude »


User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: LED as a light detector

Post by JohnCrow »

Thanks Nicolas

I like it :)
1 in 10 people understand binary, the other one doesn't !

Spanish_dude
Posts: 594
Joined: Thu Sep 17, 2009 7:52 am
Location: Belgium
Has thanked: 63 times
Been thanked: 102 times
Contact:

Re: LED as a light detector

Post by Spanish_dude »

(Didn't see this before)
dazz wrote:The next thing to work on with this is to get it to talk to another one and send basic data, so feel free to chip in with ideas how i can do this as i aint got a clue :oops:
You could probably try a software I²C with a clock frequency adapted to the sample rate of the ADC so you could use a pin interrupt based ADC.
Anyways you'll need to have the LEDs right next to each other to have a good data transfer so it's probably just a fun thing to try but still useless :mrgreen: .

Nicolas

Spanish_dude
Posts: 594
Joined: Thu Sep 17, 2009 7:52 am
Location: Belgium
Has thanked: 63 times
Been thanked: 102 times
Contact:

Re: LED as a light detector

Post by Spanish_dude »

Just tried this today with my scope and a bright green LED and I'm getting negative voltage (From 0V to -1V approx).
Kathode to + of probe and anode to - of the probe.

Not sure if you guys had the same thing.
Anyways I don't think I can use neg voltage with the PIC's ADC.

Maybe I'm just doing it wrong ?

EDIT:
Yep, wrong way ... :/

Tried with resistor + LED backwards but that didn't do anything :P .
Also, my probe doesn't work well anymore, I need a new one.

bmbrown
Posts: 10
Joined: Thu Aug 09, 2012 3:28 pm
Been thanked: 1 time
Contact:

Re: LED as a light detector

Post by bmbrown »

read your light detector idea using led's

my understanding is that voltage is joules of energy per coulomb of charge so if you read a voltage it can only be done by actually drawing electrons across the contacts and hence across that potential difference you read even if it is in picoamps there is a current..so to make a detector simply requires a massive bootstrap amp such as a cmos opamp with a gain of 100,000 or more that can feed its output to an input pin of an mcu

Post Reply