Picture of Light Sensing LED - PICAXE Version
A while ago I posted light sensing LED which used the arduino board now it is the same project but using a PICAXE microcontroller.This is the simplest circuit you might have ever seen it only uses a PICAXE microcontroller,a resistor and a LED.A LED not only lights up when power is applied but also produces a tiny voltage when exposed to light.Based on this principle we are going to make our "light sensing LED".A single LED is used to take a reading and light up when it is dark.This is a fun to do project which requires minimal parts.

This instructable will explain how to create your own light sensing LED,making some changes,programming the microcontroller,makingit on a breadboard and soldering the circuit.

A short video of it in action:

Remove these adsRemove these ads by Signing Up

Step 1: How Can The LED Sense Light?

Picture of How Can The LED Sense Light?
An LED can be used for light detection as well as emission.LED is a simple diode which has been adopted to emit light.Therefore if it is inserted into the circuit the same way as the photodiode it will serve the same function of sensing light

The LEDs will be sensitive to the light which has the wavelength equal to it or lesser than it.

When light falls on the LED a small voltage is produced this voltage produced can be fed to a microcontroller which can read it and follow the further instructions.
AndyGadget3 years ago
There is only part of a program here.
What about the 'readadc' to get the b0 value and the code to tie those snippets together?
Bot1398 (author)  AndyGadget3 years ago
Sorry forgot to include that! btw how did you like the instructable?
That's better.
I'd have written the program as:

    readadc 2,b0
    if b0 < 10 then
        high 2
        pause 1000
    end if

but either way works.

How about putting in spaces after full stops in your text?  It would make it a lot easier to read.  Also, you mention the schematic in your text but I can't see it there.  It's a very simple circuit but that would make things a lot clearer.  All in all though, a good start.

There is another way of doing this which is more sensitive.  The LED junction is first 'charged' and then the state of an input pin checked after a time.  The discharge rate is related to the light level so can be used as a dark / light switch. 

P.S. It's not a good idea to display your e-mail address like that unless you want all sorts of spam turning up in your mailbox.

Bot1398 (author)  AndyGadget3 years ago
(removed by author or community request)
I think you've got the chip in upside-down in your title picture!
Speed should not be a problem. If you're running this without the programming resistors, make sure that the chip pin 2 is tied to 0V otherwise you can get strange things happening. 
Bot1398 (author)  AndyGadget3 years ago
(removed by author or community request)
Which of the programs gives you the short interval blink? The 'pause 1000' should give you a 1 second blink (at 4MHz) when triggered.  Another thing you could try is a 0.1uF capacitor across the supply, as close as possible to the chip's power pins.  (This is good design practice for any digital circuit.)

Normally, using the capacitor across the supply would be "good practice" but the loads here are non inductive (no coils or windings) and they are very wimpy - so any spikes must be pretty minimal. My similar project worked fine without any supply capacitor...

I also found a need to "tie Leg 2 to 0V (using a 10k ohm resistor).

Bot1398 (author)  AndyGadget3 years ago
I have added the schematic and I not received any spam from anyone actually I have not received any email from anyone


I had trouble duplicating your interesting project. I tried to derive a schematic by going back and forth between your images but kept finding, for me at least, contradictions. By making some changes to your schematic and code, I was finally able to get the assembled parts to work as a "dark detector." If you search for "PicAxe LED dark detector" in Instructables, you will see the details of what I did. You will notice that I didn't attempt any kind of fancy "Fritzing" but simply drew my schematic in pencil and then took a picture of it. More than a few people with electronics experience will relate better to a simple schematic rather than some kind of pictorial Fritzing that isn't clear enough to identify the parts...

Dave Kruschke

PicAxe dark detector 1.JPG
mpep1 year ago
"Sketch"???? I thought you were in the PICAXE world? :-)

Good wee instructable. Thanks.
chailiyh2 years ago
you can do it with a LM339 too.
but you will need much more res.
justbennett3 years ago
Thanks for posting this. This concept is included in some other instructables, I think, but I like that this one focuses on one concept. This could be incorporated into more complicated projects in interesting ways. I like the picaxe too (cheap AND easy), and I hope to see more projects on here soon. I'm working on a couple myself.
I do not know if it will make any difference but the 08M2 can have its speed adjusted from 4MHz to 32MHz with

setfreq M32