Introduction: LED Night Light (Dark Sensor)

About: I am an engineer and a maker who loves technology challenges.

Many children are afraid of darkness. I was one of them. For children to fall asleep more easily one can install so called night light into wall socket. Those have series disadvantage: you must remove night light if you want to use that socket. What if you could make small portable, battery powered night light that will work autonomously? In this instructable I will show how to make just that.

Same principle as shown in this instructable is implemented on street lights on remote places. Principle in this instructable is called dark sensor. Will show you, how you can make one and how it works!

Step 1: Parts and Tools

You will need:

- LDR resistor

- LM358 integrated circuit

- 47k potentiometer and 10k resistors

- 2 white LEDs with 100 ohm resistor

- 9V block battery with connector

- piece of PCB

Tools:

- Breadboard, wires tweezers and pliers

- Soldering iron, soldering wire

- Flat head screw driver

- Multimeter

Step 2: Schematics

Operational amplifier LM358 is in the center of circuit, which works as comparator. Comparator compares voltages on both inputs and if input on non-inverting port (+) is higher, output is set to maximum value (Vcc), but if input on inverting port (-) is higher, output is set to minimum value (GND or 0V in our case).

On inverting port we connect voltage divider for setting reference value and it is build with potentiometer and resistor. On non-inverting port we connect voltage divider for measuring light intensity. This voltage divider is build from LDR and resistor.

On output we connect resistor and two white LEDs in series. Resistor is for current limiting.

How does this circuit work?

In the picture of LDR in previous step, you can see LDR's characteristics - with light intensity, LDRs resistance is dropping. Circuit has two voltage dividers:

1) MEASURING DIVIDER: build with 10k ohm resistor and LDR; if light intensity is high, resistance is low, therefore dividers voltage output is low, and if light intensity is low, resistance is high, therefore voltage output is high;

2) REFERENCE DIVIDER: build with 10k ohm resistor and potentiometer; we set this potentiometer at value where we want our night light to turn on, this is set empirically.

Outputs of those two dividers are then processed by operational amplifier set as comparator (comparator is also called 1-bit ADC becouse of its action described above). If measuring divider's value drops below our reference value (high light intensity), LED will turne off. If measuring divider's value is higher than our reference value (low light intensity), LED will turn on.

Step 3: Assembly on Breadboard

Circuit on breadboard is build with help of schematics in previous step. I also made short video so you can see how it works. In video I am covering LDR to create low light intensity conditions.

Step 4: PCB

PCB is made on prototyping board. First we solderedon on all the elements. After that we made all connections. There are many techniques for making connections. I am using one in the pictures. It demands more patience and more time but end result is nicer.

After I finished all connections I made a short video. Again, I am replicating low light intensity conditions.

Step 5: Conclusion

Finished PCB works as planned. This circuit is build from small number of elements and it is easy for make. But it can be very useful in many situations (camping, emergency light, etc.). Also it is very simple to make this circuit work with electricity from power grid.