DIY Day and night light sensor


Hello, my friends,

if you take the Subway and go throw the tunnel the light will be turned on, when the tunnel ended and you will see the sunlight again, the light will be turned off again.

Did you think the driver do that? no, he didn’t

I will tell you what happens applied example, in smart homes, subway or street lights, etc…

There are electronics circuits responsible for sensing the light to save energy and give the light bulb chance to live longer, you can do this project if you are a beginner in electronics or electronics lover, if you are a professional in Embedded systems you have to do it without Arduino or UC to save memory for more Complicated task or to make your kids love electronics.


This component is very important for this project its light dependence resistor so the resistance will change according to the light applied on it, the more light applied the less resistance you get

If this is the first time that you hear resistance, I will explain it in datils later, but simply:

If you play football imagine yourself as a volt, and the electrons will be the ball (current), resistance will be rough of the ground and the air resistance the goal nets will be the device which is supplied by the current.

When you hit the ball, the stronger ball will reach a goal faster if you hit two balls at the same time you will give high energy, that can conquer resistance.

What will happen if an elephant hit a lot of huge ball into the goal?

May be net will be destroyed, in our case, the resistance will be too low so the current reach of the device is high.

What will happen if an ant hits one small ball into the goal?

No change will happen to the ball so the current will be too low and will not reach the net the resistance will be high.

Required for this project:

Transistor: (BC547) or any (NPN) transistor
We use the transistor as a switch by simple voltage divider circuit


12volt adapter or 5-volt adapter

If you use a 12 V adapter you should use a 5v regulator as lm7805
And breadboard
تنزيل (1)
After making the circuit on a breadboard you can make it on PCB or make it on PCB dot board

We will use simple simulator & powerful one called “Circuit Wizard”
تنزيل (2)
Relay module: (optional)
Make sure the relay is an active-high module or we will change the simple connection

Construct the following circuit:
the theory of work:
when the sun raises or light is applied on the circuit the resistance will get lower so the most of current will go to GND the transistor will be turned off, when it gets dark the resistance will get higher so the current will go to the transistor turn it on then the led will light the current will go throw the led to a collector than to emitter
if you want to control 220 volts blub you will add the 220-volt relay module and take the wire from the Out of the transistor to the input signal of the module
now we will connect the relay module

if its active low module:

when you give the input signal low means 0v GND you listen to the sound of the relay close
if its active high module:

when you give the input signal high means 5v Vcc you listen to the sound of the relay close

you can replace the lamp with any 220v device
link circuit :slight_smile:
Processing: ldr2.cwt…

feel free to ask me any question:


Facebook: Eng. Darwish Ali

1 Like