Dark Detecting Nightlight
by AH Electronics in Circuits > Electronics
11340 Views, 153 Favorites, 0 Comments
Dark Detecting Nightlight
Hello everyone!
Today I am going to show how to make a dark detecting nightlight. It is a basic light that lights whenever it detects no light, so when you turn off the lights in your room, it will light up by itself and give out a mild beautiful glow. If you are a beginner to electronics it is an extremely easy circuit to build.
DO NOT BE SCARED OF THE NUMBER OF STEPS!! I divided up the tutorial into many small steps so that it is easier to make and under stand. So here's the breakdown of the steps:
A) Introduction and a video of how to make it (I highly recommend watching my video on how to make it in step 1 )
B)How to make the circuit on a breadboard: 1)Materials. 2)Assembly. 3) How well it works.
C)How to make the circuit on a perfboard: 1)Materials 2)Assembly 3)Soldering and tips 4)Project encloser 5)How well it works.
D)How does it work?
E)Troubleshooting tips and improvements.
It is a very inexpensive yet fascinating circuit, and hope you would learn something from it! I am extremely sorry for any mistakes! Lets get to it!!
Today I am going to show how to make a dark detecting nightlight. It is a basic light that lights whenever it detects no light, so when you turn off the lights in your room, it will light up by itself and give out a mild beautiful glow. If you are a beginner to electronics it is an extremely easy circuit to build.
DO NOT BE SCARED OF THE NUMBER OF STEPS!! I divided up the tutorial into many small steps so that it is easier to make and under stand. So here's the breakdown of the steps:
A) Introduction and a video of how to make it (I highly recommend watching my video on how to make it in step 1 )
B)How to make the circuit on a breadboard: 1)Materials. 2)Assembly. 3) How well it works.
C)How to make the circuit on a perfboard: 1)Materials 2)Assembly 3)Soldering and tips 4)Project encloser 5)How well it works.
D)How does it work?
E)Troubleshooting tips and improvements.
It is a very inexpensive yet fascinating circuit, and hope you would learn something from it! I am extremely sorry for any mistakes! Lets get to it!!
A: Watch the Video to Learn How to Make It!!
The process of the build is better visualized through the video, as it is always easier to show something being made in a video than in a picture. So I recommend watching the video to learn how to make it.
B: How to Make the Circuit on Breadboard: Materials List.
So to make the circuit on a bread board you need to gather the following materials:
1)A solder-less breadboard.
2)Jumper wires. (If you don't have pre-made ones, then just take a piece of solid core wire and strip the ends and use it.
3)NPN Transistor- I used 2N3904, but any NPN transistor would work. But some good examples are BC337, 2N2222, BC547.
4)A 470 Ω resistor,
5)A 22K Ω (22000 Ω) resistor.
6)A L.E.D (Colorful LED s looks better. I chose a color changing LED.)
7)Light Dependent Resistor (L.D.R)
8)1.5 volt coin cell Battery ×3 and a battery holder.
1)A solder-less breadboard.
2)Jumper wires. (If you don't have pre-made ones, then just take a piece of solid core wire and strip the ends and use it.
3)NPN Transistor- I used 2N3904, but any NPN transistor would work. But some good examples are BC337, 2N2222, BC547.
4)A 470 Ω resistor,
5)A 22K Ω (22000 Ω) resistor.
6)A L.E.D (Colorful LED s looks better. I chose a color changing LED.)
7)Light Dependent Resistor (L.D.R)
8)1.5 volt coin cell Battery ×3 and a battery holder.
B: Basics of Breadboard.
The picture shows the connection of breadboard holes. The yellow lines represent the holes that are connected. So if you insert a wire to a hole in the yellow line, it will automatically be connected to all the holes in the yellow line. So the horizontal rows are connected to each other, and the two vertical rails on each side of the breadboard are the power bus rows, and they are connected together. The power bus rows are most commonly used for plugging in the power or voltage source and ground.
I do not own this picture, so credit goes to who created this picture. (Sorry I couldn't find the name.)
I do not own this picture, so credit goes to who created this picture. (Sorry I couldn't find the name.)
B: So How Do I Find Out the Polarity of the Components??
So the main electrical components we are going to be using are the LED, LDR, Resistors, Transistor and the Batteries.
The LED is a polar component, and would not work if placed incorrectly. The longer lead of the LED is the positive lead, and the shorter lead is the negative. Also the head of the LED has a flat side near the negative lead.
The Resistors are non polar, and does not matter how you plug them in. They will work either way.
The LDR is just another form of resistor, so it doesn't have any polarity. So you can plug it in either way.
The transistor is polar, and in fact, it has three leads, which could be confusing. But when you have the flat side of the resistor facing you, the lead on the left is the emitter, the lead in middle is the base, the lead on the right is the collector. But always be sure to look at the datasheet to find out layout, because sometimes it could be different.
The batteries should have a sign on it saying + or -, use that information.
Credit goes to whoever created the pictures.
The LED is a polar component, and would not work if placed incorrectly. The longer lead of the LED is the positive lead, and the shorter lead is the negative. Also the head of the LED has a flat side near the negative lead.
The Resistors are non polar, and does not matter how you plug them in. They will work either way.
The LDR is just another form of resistor, so it doesn't have any polarity. So you can plug it in either way.
The transistor is polar, and in fact, it has three leads, which could be confusing. But when you have the flat side of the resistor facing you, the lead on the left is the emitter, the lead in middle is the base, the lead on the right is the collector. But always be sure to look at the datasheet to find out layout, because sometimes it could be different.
The batteries should have a sign on it saying + or -, use that information.
Credit goes to whoever created the pictures.
B: Assembly Diagram of the Circuit on Breadboard.
So here is a simple diagram of the circuit and a schematic of the circuit made on an app called Fritzing Beta which is free to use.
Use the schematic to refer to the polarity of the circuit.
If you have any confusion on how to plug in the L.E.D here's a few tips. Remember the L.E.D has one long lead and one small lead. The smaller lead of the L.E.D is the negative side. Also one side of the L.E.D's head is flat. The lead on the L.E.D on the flat side is the negative lead. The negative lead of the L.E.D goes to the negative end of the battery.
Use the schematic to refer to the polarity of the circuit.
If you have any confusion on how to plug in the L.E.D here's a few tips. Remember the L.E.D has one long lead and one small lead. The smaller lead of the L.E.D is the negative side. Also one side of the L.E.D's head is flat. The lead on the L.E.D on the flat side is the negative lead. The negative lead of the L.E.D goes to the negative end of the battery.
B: Lets Assemble the Circuit on Breadboard!!
Follow the diagram and the circuit schematic to make the circuit on breadboard. It is really difficult to explain how to do it by using words, so I recommend you to watch the video in step 2 where you can see the placement of the components. But here is a picture of the all the components placed on the breadboard. Now plug in the battery to the wires on the power rails, and put some shade on the L.D.R! The L.E.D lights up! Yay! It works.
But its not really permanent is it? We can not carry around a breadboard with this circuit all the time, because breadboards aren't really meant to make permanent circuits. Lets move on to the next step to make it permanent!!
But its not really permanent is it? We can not carry around a breadboard with this circuit all the time, because breadboards aren't really meant to make permanent circuits. Lets move on to the next step to make it permanent!!
C: Lets Make It Permanent!! Perfboard!!
So now that we have built it and tested it on breadboard, we are now going to make it on a perfboard, to make it permanent. To make it on a perfboard, you will need the following things:
*(You do not need a breadboard now)*
1)NPN Transistor- I used 2N3904, but any NPN transistor would work.( BC 337, 2N2222 etc)
2)A 470 Ω resistor, and a 22K Ω resistor.
3)A L.E.D
4)3- 1.5 volt coin cell Battery and holder.
5)A perfboard or vero board.
6)Light Dependent Resistor (L.D.R)
7)Two wires of about 1 foot.
8) A tic tac container for housing the circuit.
The tools you will need are:
1)A soldering iron.
2)Needle nose pliers or cutters.
3)Scissor.
4)Solder, soldering stand.
5)Hot glue gun.
6) Xacto knife (Optional)
*(You do not need a breadboard now)*
1)NPN Transistor- I used 2N3904, but any NPN transistor would work.( BC 337, 2N2222 etc)
2)A 470 Ω resistor, and a 22K Ω resistor.
3)A L.E.D
4)3- 1.5 volt coin cell Battery and holder.
5)A perfboard or vero board.
6)Light Dependent Resistor (L.D.R)
7)Two wires of about 1 foot.
8) A tic tac container for housing the circuit.
The tools you will need are:
1)A soldering iron.
2)Needle nose pliers or cutters.
3)Scissor.
4)Solder, soldering stand.
5)Hot glue gun.
6) Xacto knife (Optional)
C: Shaping the Perfboard
So we will be housing our circuit inside a tic tac container. But my perfboard is way too big for it! So I took a marker and took an outline of the tic tac container on the perfboard. Then I cut a piece of the perfboard smaller than the outline. If you have a hacksaw, it would come in handy to cut the board, but as I was working on my studying table, I knew using hacksaw wouldn't make my parents happy. So I just used a xacto knife to score the perfboard about 50 times, and then snapped the perfboard into a smaller piece.
C: Plug in the Components!!
Start off by plugging in the transistor, and the resistors.
Do not plug in the LED, RESISTOR or attach the Batteries yet.
Sadly the picture doesn't show the second resistor plugged in, as I forgot to take a picture of it after plugging in both resistors.
Do not plug in the LED, RESISTOR or attach the Batteries yet.
Sadly the picture doesn't show the second resistor plugged in, as I forgot to take a picture of it after plugging in both resistors.
C: Make Extensions for LED,LDR and Battery
As we might need to bend or adjust the placement of the LED,LDR and battery, we are not going to plug them in directly to the perfboard. Instead we are going to make extensions using wires or 'Jumper Wires'.
Cut 6 wires of about 1 inch length and strip insulation from the ends. Making them of different colors could be helpful. Now using a soldering iron tin the wires.
How to tin the wire? : To tin the wires means to apply a layer of solder to the wires' ends. This helps in soldering them to the board. To tin the wires, first take the wire and using a helping hand, hold it in place. Then touch the end of your soldering iron on to the end for 3 seconds. Now take the solder and touch it to the junction of the iron and the wire. You will see the solder melting and running up the wire. If the end of your wire is covered by a thin layer of silvery shiny solder then it is correctly tinned.
Cut 6 wires of about 1 inch length and strip insulation from the ends. Making them of different colors could be helpful. Now using a soldering iron tin the wires.
How to tin the wire? : To tin the wires means to apply a layer of solder to the wires' ends. This helps in soldering them to the board. To tin the wires, first take the wire and using a helping hand, hold it in place. Then touch the end of your soldering iron on to the end for 3 seconds. Now take the solder and touch it to the junction of the iron and the wire. You will see the solder melting and running up the wire. If the end of your wire is covered by a thin layer of silvery shiny solder then it is correctly tinned.
C: Lets Finish the Circuit Board!!
So now following the schematic, plug in the wires to act as extensions for LED, LDR, and Battery. attach the LED,LDR, and Battery holder to the wires by twisting the leads, until you solder them.
Solder everything together.
Take a scissor or wire cutters, and cut of excess leads from the circuit.
How to solder?
Take the soldering iron, and touch the tip to the components' lead and the metal pads of the perfboard at the same time for 3 seconds. Then run the solder to the junction until it makes a shiny concave joint of solder. If its not shiny, or if it is a large blob of solder, then you should use soldering wick to get rid of the excess solder, and try soldering it again. There are many useful tutorials on instructables on how to solder, use them to your benefit.
Solder everything together.
Take a scissor or wire cutters, and cut of excess leads from the circuit.
How to solder?
Take the soldering iron, and touch the tip to the components' lead and the metal pads of the perfboard at the same time for 3 seconds. Then run the solder to the junction until it makes a shiny concave joint of solder. If its not shiny, or if it is a large blob of solder, then you should use soldering wick to get rid of the excess solder, and try soldering it again. There are many useful tutorials on instructables on how to solder, use them to your benefit.
C: Lets Make It Look Nice
Now take the tic tac container and get rid of the label slowly. If you try to hurry, it will ruin your life with sticky adhesive on the container.
Now make a hole on top of the cap of the container, big enough to fit the LDR snugly.
Now put the circuit inside the container, and make the LDR's head stick out through the hole in the cap.
Use hot glue to fix everything in place. Adjust the leads of the LED to the fix it in place. Also use hot glue to insulate parts of the circuit, so that it doesn't short circuit.
Now time to test!!
Now make a hole on top of the cap of the container, big enough to fit the LDR snugly.
Now put the circuit inside the container, and make the LDR's head stick out through the hole in the cap.
Use hot glue to fix everything in place. Adjust the leads of the LED to the fix it in place. Also use hot glue to insulate parts of the circuit, so that it doesn't short circuit.
Now time to test!!
C:Lets Test It!!
So now plug in the batteries, and make it dark, cause the nightlight is ready to activate in the dark room!
It will light up brightly in a completely dark room, but it might light up dimly in a mildly dark room based on the light levels.
Yass, its working. Wondering why it works so easily? Look into the next steps.
It will light up brightly in a completely dark room, but it might light up dimly in a mildly dark room based on the light levels.
Yass, its working. Wondering why it works so easily? Look into the next steps.
D: So How Does This Work?
Lets start with the individual components.
The transistor can used as an amplifier or a switch. A normal NPN (Negative Positive Negative) transistor allows current to flow through the collector and emitter pin only when there is a small voltage is applied to the base of the transistor.
The LDR acts like a resistor. When there is no light, the resistance of the LDR is extremely high, , but when there is bright light applied to the LDR, the resistance of the LDR becomes extremely low.
I will be talking in terms of conventional current, assuming that the electricity is flowing from positive to negative side. (Electricity flows from negative to positive in terms of accepted science.) So according to the schematic, the current could flow from the positive side of the battery to the 22K resistor and the collector. Current can not flow the collector, as there is no current at the base yet, so current only flows through the 22K resistor now. Current flows through the 22K resistor and has two ways to choose, it could go the base of the transistor or the LDR. Assume there is bright light in the room. So the resistance of the LDR is extremely low. As the transistor's resistance is higher than LDR right now, the current chooses the easier path and goes through the LDR to the negative side of the battery. So the LED doesn't light up, as current isn't flowing through it.
But when there is no light, the resistance of the LDR rises substantially, and so the current chooses to go to transitor base rather than the LDR, and the current in the base of the transistor allows current to pass through the Collector and emitter and the LED to the negative side of the battery. The LED lights up!!
This is an extremely general explanation of how the circuit works. I am not an electrical engineer, or physics teacher, so I am bound to have limited knowledge about the circuit, so I request you to help me fix any mistakes I have.
The transistor can used as an amplifier or a switch. A normal NPN (Negative Positive Negative) transistor allows current to flow through the collector and emitter pin only when there is a small voltage is applied to the base of the transistor.
The LDR acts like a resistor. When there is no light, the resistance of the LDR is extremely high, , but when there is bright light applied to the LDR, the resistance of the LDR becomes extremely low.
I will be talking in terms of conventional current, assuming that the electricity is flowing from positive to negative side. (Electricity flows from negative to positive in terms of accepted science.) So according to the schematic, the current could flow from the positive side of the battery to the 22K resistor and the collector. Current can not flow the collector, as there is no current at the base yet, so current only flows through the 22K resistor now. Current flows through the 22K resistor and has two ways to choose, it could go the base of the transistor or the LDR. Assume there is bright light in the room. So the resistance of the LDR is extremely low. As the transistor's resistance is higher than LDR right now, the current chooses the easier path and goes through the LDR to the negative side of the battery. So the LED doesn't light up, as current isn't flowing through it.
But when there is no light, the resistance of the LDR rises substantially, and so the current chooses to go to transitor base rather than the LDR, and the current in the base of the transistor allows current to pass through the Collector and emitter and the LED to the negative side of the battery. The LED lights up!!
This is an extremely general explanation of how the circuit works. I am not an electrical engineer, or physics teacher, so I am bound to have limited knowledge about the circuit, so I request you to help me fix any mistakes I have.
E: Troubleshooting and Tips for Improvements!
So is your circuit not working? That happened to me too! So here are a few things that might happen to you, and the solutions:
1) Well, my light isn't lighting up dude. Its fake, fake, FAKEE.
Solution: Well, I see a lot of people saying that, but no I do not have time to make fake circuits. So the problem in general is really broad, but here are a few solutions. Firstly check to see the circuit layout, make sure you haven't missed the components. Secondly check to see if your battery is working or not, using a multimeter.
2) My circuit doesn't turn off in bright light!!!
I had the same problem. To solve this you need to change the resistance of the 22k ohm resistor. take the multimeter and check the resistance is the LDR in bright light. Now switch the 22k resistor with a resistor with a higher resistance than the value we just measured. It should work!
3) It's really dim
Add new batteries, or decrease the resistance of the 470 ohm resistor.
Improvements: You could make tons of improvements with this circuit. You could make one that would light up your bedroom with adjustable brightness by adding potentiometer. You could use a switch to make sure it doesn't run out of batteries by constantly staying on all the time. You could also use this layout and switch the LDR with different types of sensors to sense different conditions and light up the LED. The possibilities are many, as long as your creative mind supports it.
1) Well, my light isn't lighting up dude. Its fake, fake, FAKEE.
Solution: Well, I see a lot of people saying that, but no I do not have time to make fake circuits. So the problem in general is really broad, but here are a few solutions. Firstly check to see the circuit layout, make sure you haven't missed the components. Secondly check to see if your battery is working or not, using a multimeter.
2) My circuit doesn't turn off in bright light!!!
I had the same problem. To solve this you need to change the resistance of the 22k ohm resistor. take the multimeter and check the resistance is the LDR in bright light. Now switch the 22k resistor with a resistor with a higher resistance than the value we just measured. It should work!
3) It's really dim
Add new batteries, or decrease the resistance of the 470 ohm resistor.
Improvements: You could make tons of improvements with this circuit. You could make one that would light up your bedroom with adjustable brightness by adding potentiometer. You could use a switch to make sure it doesn't run out of batteries by constantly staying on all the time. You could also use this layout and switch the LDR with different types of sensors to sense different conditions and light up the LED. The possibilities are many, as long as your creative mind supports it.
Conclusion
So I hope you guys would have fun making this and using this. It is a great little project to learn about electronics in general and to apply your soldering skills. You should be careful while handling soldering iron and dangerous equipments. If I made any mistakes, or if you want me to fix something let me know in the comments. Have fun, and subscribe for future projects. Be sure to visit my YouTube channel and like, share and subscribe as it would keep me motivated to make more electronics. Have a great day!