Simple Lux Meter (Light Intensity Meter) Based on BH1750, Arduino and Oled Screen

by Wim3d in Circuits > Arduino

989 Views, 3 Favorites, 0 Comments

Simple Lux Meter (Light Intensity Meter) Based on BH1750, Arduino and Oled Screen

IMG_20210410_165321.jpg

In this short Instructable I show you how I made a light intensity meter based on a BH1750 sensor module.

This BH1750 has a I2C bus to communicate with the arduino pro mini I used. The Oled screen also used the I2C bus. I use a 3.3V arduino since I power it with a LiPo battery.

Supplies

Hardware and Schematic

Schematic_Light_sensor_2021-04-10.png
IMG_20210410_165319.jpg
IMG_20210410_164101.jpg
IMG_20210410_164114.jpg
IMG_20210410_164043.jpg
IMG_20210410_164048.jpg

The schematic and software are based on my simple RFID scanner.

The battery is connected to the 'RAW' pin of the arduino. The voltage is regulated to 3.3V via the on board regulator of the arduino. The voltage of the VCC pin of the arduino is 3.3V and this is used to power the Oled screen and the BH1750.

The voltage divider of 10K and 20K ohm resistors on A0 is used to measure the battery voltage, which is shown as a percentage when the light meter is switched on.

For this project I just soldered all components together with colored silicon wires. I used some capton tape as electrical isolation between teh components.

I made some appropriate holes in the ABS box and glued all connected components in the box. For most components I used hot glue, but for the TP4056 module, which may get hot during charging, I used super glue.

Comments on LiPo Charging Module

2021-04-11 10_45_07-tp4056 module - Google Zoeken.png
charge.png

In this small project I used a small and thin 400 mAh LiPo battery. To charge it properly, I changed the R2 resistor of the module from 1.2K to 3K ohm to reduce the maximum charge current from 1A to 400mA.

Software

The software is published on my Github and is quite simple.

It uses the BH1750 library for the light measurements and the U8g2 library for the Oled screen.

When the arduino is switched on, it measures the voltage 10 times and transformes the voltage to a percentage of 20 - 100%.

In the loop function, the light intensity is measures every second and displayed on the screen.

I find this small Oled screen very suitable for this small sensor since it fits all the desired text and the maximum value of "65535 Lx". The screen is 32 x 128 pixels, in the 8*8 library this results in 32/4 = 4 lines (0 - 3) and 128/8 = 16 columns (0 - 15). The font uses 2*4 squares of 8*8 pixels. This results in 1 line (32/4/8 = 1) and 8 characters (128/2/8 = 8). The 8 characters are sufficient for showing the maximum value of "65535_Lx".

In my code I use a little trick to align the text to the right, of course there are other ways to do this. I use the 10Log of the Lux-value to position the text. The indent depends on the amount of figures in the value. The number of figures in the value is derrived from the 10Log of the value (0 - 65535), which can have 1 - 5 figures.