PDA

View Full Version : LED Light Sensor - Need Help Please



Heckler
- 10th September 2011, 21:36
Hey Group,

I have been experimenting with the Idea of building a Solar Tracker.

I have read here and else where that you can use an LED as a light sensor.

I have had limited success. First trying to just connect one leg of the LED to an A/D converter input on my PIC 916F690, and the other leg of the LED to either +5 or Gnd. I have tried a lot of different configurations such as reversing the LED, connecting the other leg of the LED to either +5 or gnd, etc. etc.

I do not seem to get very good results. I can see some change with light intensity and using different LED's, but the dynamic range of light measuring does not seem to be very good. I only see a change of about 50 counts on an 8 bit (0-255) word.

Have any of you had any experience with this?? Could you share CODE/SCHEMATIC please.

I have searched this forum and elsewhere onthe web but the examples are somewhat vague and confusing.

Here is one GOOD example video on YouTube... http://youtu.be/NbuuGdpbMJE
But he does not share the schematic or code.

I'm not asking for someone to do the work for me... Just give me a few tips and a basic starting circut and/or sample code.


Thanks

HankMcSpank
- 10th September 2011, 22:23
The voltage range/swing here is gonna be miniscule, so you're gonna need an amp of some sorts, something like this prior to your ADC pin...

http://www.eleccircuit.com/using-led-as-a-light-sensor/

the output of that will be a varying DC level depending on the amount of light hitting the led, which you can then feed to a pic pin & use any old basic ADC reading type code from here.

Dave
- 10th September 2011, 22:30
Hey Heckler, try http://www.redrok.com.htm They have a lot of different circuits that people have designed.. In fact one of our tech's who just graduated with his degree used one of them for his final project.

Heckler
- 10th September 2011, 23:32
@Hank... I really want to keep the component count low and only need to do a comparative measurement between 2 or 4 different sensors. So I hope to be able to avoid using an amplifier, if possible.

@Dave... wow there is a lot on that website to take in... I'll look there for someting I can use. (your link seemed bad... I had to delete the .htm on the end)


Any others with ideas? please chime in.

ivanrosales
- 11th September 2011, 01:03
To use an LED as light sensor you can use PBP's RCTIME or if you want to use the analog approach try connecting the anode to the input pin and the cathode directly to vss, the following code gives me 0 at dark and ~450 in the light:


Inicio:
suma=0
for cont=1 to 10
adcin 3,dato
suma=suma+dato
pause 100
next cont
suma=suma/10
serout transmitir,0,[#suma,10]
goto inicio


(I'm using 5mm Ultra bright Blue LED)

Regards.

ivanrosales
- 11th September 2011, 01:19
Anyway a simple LDR is by far more reliable and is as cheap as an LED, you can connect the LDR in series with a 1K resistor and use it as a voltage divider.

Regards.

ozarkshermit
- 12th September 2011, 13:10
Dwight:

Have you seen my design? Pictures, schematics, description, and code are posted in the WIKI under Projects - Solar - My Small Solar Tracker. Two posts appear, the second one has a PDF of the schematic. I have been using this tracker a lot, it is reliable and very accurate.

Heckler
- 12th September 2011, 16:07
Thanks Ozark,

I may have seen the article but never did find the schematic... I went back to your original post after you mentioned it and found the .pdf. That is what I was looking for... how to hook up the led's and some sample code on reading the light values.

Is there a way to add the .pdf with the SCHEMATIC to the Wiki project page, you might also want to mention in the article where to find the schematic ?? I went back to the article and searched for the word "schematic" and could not see where to view the schematic. Then at the bottom of the page I found a link to the original thread and finally found the .pdf there.

How did you determine that it was necessary to add the capacitors in parallel to the LED's?

Thanks

@Ivanrosales... I know an LDR is probably a more standard way of measuring light... but I did not have one on hand and wanted to try using an LED as others have mentioned is possible. thanks for your help also

ozarkshermit
- 12th September 2011, 21:44
Dwight:

I have a lot to learn regarding posting schematics. Sorry for the confusion.

As far as adding the capacitors - I'm sure they are not needed, the signal from the LED's is very stable, no noise or "jitter". Since a high speed response was not required here, I thought "what the heck", I'll just add them anyway. I did not test the circuit without the capacitors, but it would probably work just fine without them.

The change in signal level from the LED's is very smooth, kind of neat to see how the value changes as the shadow moves across the LED.

Ken

Demon
- 18th September 2011, 14:54
Dwight:

Have you seen my design? Pictures, schematics, description, and code are posted in the WIKI under Projects - Solar - My Small Solar Tracker. Two posts appear, the second one has a PDF of the schematic. I have been using this tracker a lot, it is reliable and very accurate.


Ken, your Wiki has been cleaned up. There was a technical glitch, Lester had to intervene to get it straightened out. :)

Robert

Demon
- 22nd January 2012, 04:53
Moved from Schematics.

Robert