Light intensity indicator with 7-segment LED display

This is similar to the other light intensity indicator tutorial. In this tutorial, the 7-segment LED display will be used to display the intensity of the light received by the photo resistor, mapping the light intensity values from 1 to 9.

The simpler version of the light intensity indicator tutorial: LED Light intensity indicator



Well, the resistance of the photoresistor will change according to the amount of light it receives. To determine the change, the photoresistor will be connected to arduino’s analog pin to measure the value of the photoresistor, which I would be using pin A0 for this tutorial. Therefore, when the photoresistor receives more light, the value received by the arduino will be higher (since more light decreases the resistance in the photoresistor), and vice versa.

How do I get the reading from the photoresistor? Use the analogRead() function! Firstly, we would declare an integer variable, lightLevel, to store the reading from the photoresistor. Next, I will map the the photoresitor value from its highest & lowest value to 0 – 9, since I would only want to display the intensity with that range (0 to 9). I will also print the mapped value in the serial monitor for debugging purposes. Finally, the 7 segment display will display the respective number according to the lightLevel value.

For the 7 segment part, I hard-code the ouput of the 7 segment, hence the code appears to be very long.





  • Arduino Uno x 1
  • Jumper Wires
  • 7-Segment LED Display x 1
  • 330Ω resistors x 7
  • 10KΩ resistors x 1
  • LDR x 1




You may also like...