With a photoresistor you can acquire the amount of light in your ambient.

You could use this value for several different purposes, for example you can turn on the lights when the sun sets at evening or you can turn them off when the sun rises at morning.

This simple sketch show how to retrieve this value

BOM (Bill of material)
1 Arduino
1 Photoresistor
1 10kohm resistor

 

Photoresistor

 

Connect the photoresistor and the resistor to your arduino board as follows:


Untitled Sketch_schem

Connect your arduino board to your PC and burn the following sketch:

 

connect to the Arduino board through the Serial Monitor on the Arduino IDE, on the serial line you should see something like the following few lines:

257
251
241
234
233
230
227
245
913
936
941
942
943
943

At first my photoresistor was covered with a cartoon box 😉 then I removed the box and immediately the value rised. You can try moving the box slowly and you’ll see a slow variation in the values printed on the serial line.

Gg1