In this tutorial I am going to show you how to build a Light meter with a big Nokia 5110 LCD display using Arduino.
Building a Light Meter is a great learning experience. When you finish building this project you will have a better understanding of how light meters work and you are going to see in action how powerful the Arduino platform can be. With this project as a base and the experience gained, you will be able to easily build more complex projects in the future. You can use this project to monitor the lighting conditions of your work enviroment, of your plants and so on. Without any further delay, let's get started!
Step 1: Get All the PartsThe parts needed in order to build this project are these:
- Arduino Uno
- BH1750 ▶ http://educ8s.tv/part/BH1750
- Nokia 5110 LCD ▶ http://educ8s.tv/part/NOKIA5110
- Small Breadboard ▶ http://educ8s.tv/part/SmallBreadboard
- Wires ▶ http://educ8s.tv/part/Wires
The cost of the project is around $12.
Step 2: The BH1750 Light SensorThe BH1750 light intensity sensor is great and very easy sensor to use. This breakout board comes with a 16 bit AD converter built-in which can directly output a digital signal, there is no need for complicated calculations.
This board is better than an LDR which only outputs a voltage. With the BH1750 Light Sensor intensity can be directly measured by the luxmeter, without needing to make calculations. The data which is output by this sensor is directly output in Lux (Lx).
The sensor uses the I2C interface so it is very easy to use with Arduino. You only need to connect 2 wires.
Also the price of the sensor is very low, it is around 2$.
You can get it here: ▶ http://bit.ly/BH1750_Sensor
Step 3: Nokia 5110 LCDThe Nokia 5110 is my favorite display for my Arduino Projects.
The Nokia 5110 is a basic graphic LCD screen which was originally intended for as a cell phone screen. It uses the PCD8544 controller which is a low power CMOS LCD controller/driver. Because of this this display has an impressive power consumption. It uses only 0.4mA when it is on but the backlight is disable. It uses less than 0.06mA when in sleep mode! That's one of the reasons that make this display my favorite. The PCD8544 interfaces to microcontrollers through a serial bus interface. That makes the display very easy to use with Arduino.
You only need to connect 8 wires and use the following library: http://www.rinkydinkelectronics.com/library.php?i...
This impressive library is developed by Henning Karlsen who has put a huge amount of effort to help the Arduino community move forward with his libraries.
I have prepared a detailed tutorial on how to use the Nokia 5110 LCD display with Arduino. I have attached that video in this tutorial, it will provide may useful information about the display, so I encourage you to watch it carefully.
The cost of the display is around $4.
You can get it here: ▶ http://bit.ly/NOKIA5110
Step 4: Building the Light MeterLet's now connect all the parts together.
At first we connect the BH1750 Light sensor module. It only has 5 pins but we will connect 4 of them.
Connecting the Voltage Sensor
- Vcc Pin goes to Arduino's 5V
- GND Pin goes to Arduino's GND
- SCL Pin goes to Analog Pin 5 of the Arduino Uno
- SDA Pin goes to Analog Pin 4 of the Arduino Uno
- Address pin stay unconnected
The next step is to connect the Nokia 5110 LCD display.
Connecting the Nokia 5110 LCD Display
- RST goes to Digital Pin 12 of the Arduino
- CE goes to Digital Pin 11 of the Arduino
- DC goes to Digital Pin 10 of the Arduino
- DIN goes to Digital Pin 9 of the Arduino
- CLK goes to Digital Pin 8 of the Arduino
- VCC goes to Arduino 3.3V LIGHT goes to Arduino GND (backlight on)
- GND goes to Arduino GND
Now that we have connected all the parts together, all we have to do is to load the code. A Splash screen is displayed for a couple of seconds and then we can start measuring Light Intensity in Real Time!
Step 5: The Code of the ProjectThe code of the project consists of 3 files.
- splash.cui.c
- ui.c
- BH1750LightMeter.ino
Code - Splash Screen Image
In the first file splash.c, there are the binary values of the splash screen that is displayed on the Nokia 5110 LCD display when the project boots up. Please watch the attached video I have prepared in order to see how to load your custom graphics to your Arduino Project.
ui.c Code - The User Interface
In the file ui.c, there are the binary values of user interface that appears after the the project shows the splash screen. Please watch the attached video I have prepared in order to see how to load your custom graphics to your Arduino Project.
UVMeter.ino Code - Main Program
The main code of the project is very simple. We need to include the Nokia 5110 library. Next we declare some variables. We initialize the display and we display the splash screen for 3 seconds. After that, we print the ui icon once, and we read the value from the sensor 150 milisseconds. All the magic happens in the loop function:
void loop() {
int stringLength=0;
uint16_t lux = lightSensor.readLightLevel(); // Read the sensor
light = String(lux); //Convertion to String
stringLength = light.length(); //We need to know the String Length
lcd.clrScr();
lcd.drawBitmap(0, 0, ui, 84, 48);
printLight(stringLength); //Print the String on the Display
lcd.update();
delay(150);
}
I have attached the code to this tutorial. In order to download the latest version of the code you can visit the project's webpage: http://educ8s.tv/arduino-light-meter/
Step 6: Testing the ProjectNow that the code is loaded we can test the Light Meter indoors and outdoors. I test it in a sunny spring day here in Greece. The result if fantastic. We can accurately measure the light intensity with easy to build project.
As you can see in the attached photos, the Light Meter works fine. This project is a great demonstration of what open source hardware and software is capable of. Within a few minutes one can build such an impressive project! This project is ideal for beginners and as I said in the beginning, this project is a great learning experience. I would love to hear your opinion on this project. Do you find it useful? Are there any improvements that can be implemented to this project? Please post your comments or ideas in the comments section below!
Comments