Dear friends in this video we build a simple light meter. This is a very simple circuit with which we can measure the light intensity falling on a sensor. We are using a photoresistor this one here, an Arduino for controlling the whole circuit and a display a Nokia 5110 display. In the display we can see the light intensity measurement in percent and a bar graph. A live bar graph. So, if I put my finger on the sensor you can see that the light intensity falls. It is a very simple circuit, don’t be fooled by the wires. We only need a photoresistor and a resistor. An Arduino and a display in order to display the results. So it is a very easy circuit and very useful in order to detect darkness or presence of light. We can power down our equipment when is night or power it up when it is day. So let’s see how easy it is to connect it to an Arduino. All we need is a photoresistor and a standard resistor. The photoresistors are light controlled variable resistors. These are also know as Light Dependent Resistors LDRs. In terms of operation a photoresistor is usually very resistive, in MΩ, when placed in the dark however when it is illuminated it’s resistance decreases significantly. We’re going
to use this photoresistor and a standard resistor about 100KΩ. Any resistor from 10ΚΩ to 100 ΚΩ is fine. Then we take the breadboard and connect the photoresistor and the resistor here. First I put in the photoresistor and then the resistor. Ok this is the 100 ΚΩ resistor. Now, let’s put a red wire here and connect it to the positive and a black wire from here and connect it to the negative. Now, we are ready the signal we are going to receive from the photoresistor is this pin here. We place a green wire and this goes to an analog pin on our Arduino. So, let’s connect the Arduino as well. Arduino Mega is here. We take a red wire from 5V and we connect it to 5v of the breadboard We take ground from Arduino and we connect it to Ground of the breadboard and signal to an analog pin of our choice. I have chosen pin 13. This is a simple circuit which reads the value from a photoresistor. Now we have to connect the display in order to display the results. I’m not going to show you
how to connect the Nokia 5110 display now because it takes some time but you can watch our previous video in which we describe the connection of the display with the Arduino in detail. OK I now have connected the display as well. Let’s power it up and see if it is working. okay we are ready, as you can see it’s very easy, the light meter is working fine. Now lets see the software side on this project. So
let’s look at the code of this project first of all we have to include the Nokia 5110 Graph.h library that we discussed in the previous video.
Please check this video in order to see how to use this library in order to drive the 5110 display. So first of all we declare the LCD, the pins of the LCD, some variables here and the most important variable is the LDR pin 13, we declare in which pin the photoresistor is connected. We have connected it to pin 13 so this is it. Then the Setup function we initialize the LCD screen and set the font.Next in the loop function which is iterated for ever, with about 100ms delay, first of all we clear the screen and update the screen and we read the light intensity. The light intensity is an int variable and it has a avalue around from 0 to 1,023. I have calibrated the sensor I saw that when the photoresistors is placed under direct sunlight the value that it reads is about 20. And when it is absolute darkness it is around 1010. So, what I have done, is that I don’t want these values that don’t mean anything I
converted them to percent so when we have absolute
darkness I map it to 0%. And when I have full sunlight the the photoresistor will read a value of around 20 I map it to a value of 100% In this line we make the convertion. From analogRead to percent. The I add the percent sign here and convert these string to a character array because the lcd.print command can only display caracher arrays. not strings not integers not floats. I take the light intensity from here I convert it to percent, then I convert it to a character array, and I print it on the screen. Then we have the printBar and fillBar functions. Those are the functions that are responsible for drawing the bar graph in the display. It is very simple, the first one draws an empty rectangle and then the fillBar it converts the percent value into pixels and draws four lines in order to fill the bar graph. That’t the code, it’s to use and understand, so If you want download it from the link that you can find in the link in the description of the video. So that’s our simple light meter, as you can see It is very to intergrate in your project, it is very low cost A photoresistor cost around 2$ for 50 units It is very very cheap and of course you also need a very cheap resistor. The display has also very low cost its about 2$ and of course you need an Arduino. As we said before with a very low cost, around 0.05$ you can add light detection capability in your project. Thank you very much for watching the video. Please subscribe to our channel if you want to watch our next videos and projects and press like if you liked the video. thank you very much for watching our
video please subscribe to our time if you want to watch our next to be
there was and projects and press like if you liked this video thank you!