Introduction: Light Sensing LED - PICAXE Version
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:
Step 1: 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.
Step 2: Parts & Tools
~ PICAXE 08M2 Microcontroller - Sparkfun.com
~ 330 Ohm Resistor - Sparkfun.com
~ Green or Red LED(I used a green LED) - Sparkfun.com
~ 10k Ohm Resistor - Sparkfun.com
~ 22k Ohm Resistor - Sparkfun.com
~ Audio Jack - Sparkfun.com
~ Soldering Iron - Sparkfun .com
~ Solder Wire - Sparkfun.com
~ PICAXE Programmer - Sparkfun.com
~ ProtoBoard - Sparkfun.com
~ BreadBoard - Sparkfun.com
~ PICAXE Programming Editor - Picaxe.com
~ Audio Cable 3.5mm - Sparkfun.com
~ A to miniB USB Cable - Sparkfun.com
Note - Use only green or red LED and not any other color as the LED's of these two colors are the most sensitive to light.
The total cost would be around 5.55 $ assuming that you have all the tools.
Step 3: Programming
First you will need to program your PICAXE microcontroller for this you need a programmer I bought one from sparkfun for $14 it is the cheapest USB programmer for PICAXE that I found and you will need to download the PICAXE programming editor.Configure you programming editor to 08M2 mode and select the suitable COM prot.For programming your PICAXE you need to make the download circuit it consists of three wires.One wire sends data from the computer to the serial input of the PICAXE, one wire transmits data from the serial output of the PICAXE to the computer, and the third wire provides a common ground.I have added a schematic for the download circuit.You also need to externally supply 4.5v power supply to the PICAXE while programming (My programmer needs a external supply yours may not need one).I made the circuit on a breadboard you can make it on a protoboard.I removed the power rails of my breadboard as they were not allowing the cable to go into the audio jack.
Here's the sensitive to dark code
if b0 < 10 then dark
Here's the sensitive to light code
if b0 > 10 then light
If the programming finishes properly a pop up window will appear saying success and will display the size of the sketch.If something goes wrong please feel free to ask.
Step 4: Built the Circuit
This might be the simplest circuit you might have ever seen it consists of a PICAXE microcontroller,a LED and a resistor.A single LED is used to take a reading and light up when it is dark.You can test the circuit on a breadboard then you can solder it on a protoboard.The circuit is pretty straight forward connect the +ve terminal of the LED (with a longer lead) to pin2 of the PICAXE microcontroller and connect the -ve terminal of the LED (with a shorter lead) to gnd. Dont forget to add a resistor between the +ve terminal of the LED and pin2 of the microcontroller.Connect the +ve and -ve terminals of the microcontroller to +5v and -5v respectively.I used a wall adaptor to power it you can use 3xAA batteries.I used no resistor for the LED as it has a inbuilt resistor.Look at the last image for the schematic!.
Step 5: Testing & Changing Sensitivity
There are two codes that I have provided one is the sensitive to dark code and the other is sensitive to light code.If you are using sensitive to dark code the LED should light up when you are in dark and should switch off when you are in a well lit room.If you use the sesitive to light code then the LED should light up when you are in a well lit room and should switch off when you are in dark.To change this sensitivity what I did was I simply replaced ' < ' with ' > ' and it worked.
Step 6: Soldering
Now that you have built the circuit on a breadboard and tested it lets make the circuit permanent and solder it.If you have no experience of soldering consult this guide.You should always use the lead free solder as leaded could be harmful.Maintain safety while ,soldering use gloves and safety glasses use proper stand to keep you soldering iron as it is very hot and can harm you.You can use hard core wire to make the connections.You need a very small piece protoboard as this circuit is very small.Use 8 pin DIP socket to keep your PICAXE microcontroller safe.This might be the worst soldering you have ever seen but don't mind as I am not at all good at soldering.
Step 7: All Done!
Hope this project inspires further experimentation. The PICAXE microcontrollers are extremly versatile and have a easy to learn programming language. This is just one of many simple projects which can be constructed using the PICAXE microcontrlles. Keep pondering!.Dont forget to follow mores comming up. .For any queries leave a comment below,PM me or contact me heres my E-mail ID email@example.com