Mini Arduino Lux Meter




I needed a Lux meter for testing flashlights. There are some good lux meters available in the $15-25 range, but shipping always takes a long time and I needed it now. That's when I realized that I had an unused BH1750 light meter module laying around, which I bought some time ago but never used it. So I grabbed an Arduino, a Nokia 5110 LCD, wired everything up on a breadboard and had a functioning lux meter within a few hours. To make it a bit more fancy, I added some graphing functionality and made the LCD backlight switch on/off depending on the light level.

Finally I decided to make this a small handheld, battery-powered unit and to write an Instructable about it. So, let's get into it!

Step 1: Parts List

For this project we will need the following parts:

Arduino Pro Mini 3.3V and an USB <> Serial converter (a.k.a. FTDI) for programming. Arduino Nano could be used as well, but has a slightly larger footprint.

Nokia 5110/3310 LCD module. Note that there seem to be two versions of this module, one with a blue and one with a red PCB. I used the blue version. They should be functionally identical, but their pinouts are different, so if you use the red type, you will need to adjust your wiring or change the pins in the code.

BH1750 Light Meter Module

TP4056 LiIon charger module - I recommend the version with battery protection circuit, just to be sure.

Lithium battery - I used an old 800mAh battery from some Samsung phone.

1 slide switch (SPST) - ideally a 90° type such as this one and a push button.

A prototype PCB, I used a 5x7cm double sided type.

Optional, if you want the backlight control: a PNP transistor (for example BC327 or BC557), a 1K resistor and a 10K resistor.

You will also need some male and female pin headers for connecting the LCD and of course some wire to make all the connections.

The total cost depends on how many components do you already have at hand and should be under $15. I already had all components in my collection, so the build was essentially free for me.

Step 2: Breadboard Time!

I first built the device on breadboard to test it out. This is fairly straightforward, just connect everything as you see in the connection diagram. The only tricky part are the I2C pins on the Pro Mini. I solved that by soldering two pieces of breadboard wire to the pins, later during final assembly they will be replaced by a more permanent solution. Connecting the HB1750 module is then easy, just connect SDA to pin A4 and SCL to pin A5.

As I said before, pay attention to the pinout of the LCD module you are using. If you have the blue version, your wiring will look the same as mine, but wiring of the red version will be different. There are already lots of tutorials for this, just search for "Arduino 5510 LCD tutorial".

Connect the LCD as follows (you can also find this in the code):

pin 13 on Arduino (SCK) - LCD serial clock (SCLK) 
pin 11 on Arduino (MOSI) - LCD data in (DIN)
pin 5 on Arduino - LCD Data/Command select (D/C)
pin 4 on Arduino - LCD chip select (CS)
pin 3 on Arduino - LCD reset (RST)

If you also want the automatic backlight control, you have to connect a BC327 (or similar) PNP transistor to Arduino pin 9 as shown in the last picture. This automatically dims the backlight if the light meter is above a certain value, to preserve battery. If you don't want this, just connect the BL pin of the LCD to +5V and it will just stay on all the time.

Get the code from my Github and upload it into your Arduino:

You might have to adjust the LCD contrast. Values of 50-55 worked fine for me. In the code, there are instructions for testing and adjusting it.

// Contrast value of 50 works fine for me. If your LCD is badly readable,
// or doesn't show anything at all, uncomment the following line to go into 
// Contrast Test mode and see, which value works best for you
// Then change display.setContrast(50) to that value

Step 3: The Basic Layout

Let's start building it on the prototype PCB. The first step was to decide on the layout. This is best described by looking at the pitcures.

I decided to have the button and charger module on the bottom. The top will be occupied by the LCD (mounted via a female pin header for easy removal), underneath it is the arduino itself. Arduino is placed such that the serial connector doesn't protrude too much outside the PCB.

The sensor is mounted on top via a female header. This makes it easily removable and it's also possible to make a 4-pin extension cable and place the sensor somewhere away from the main unit.

The charger module is placed on the bottom. I used single pins from a pin header to solder it in place.The pads have a slightly different pitch than the PCB, so these pins have to be bent slightly to compensate for that.

Step 4: The Wiring

Now comes the tedious part of wiring everything up. Since it was done on the fly, I sometimes swapped wires around to make it a nicer, tidier layout, so this may not always be well visible in the photos.

I started by routing the power wires. For initial testing I connected the VCC wire to the IN+ of the TP4056 module - this will simply provide +5V from the USB. At this point, VCC and GND were connected to the respective VCC and GND pins of the Arduino, the HB1750 module and the LCD. Also, one side of the push button was connected to GND. Then I wired up all LCD data connections with white wire, according to the wiring described previously. Not shown in these photos, I also connected the push button to Arduino pin 2.

I also soldered in the BC327 transistor for backlight, but left it unconnected for the initial tests. It will be connected later in the build.

Step 5: Adding the Battery

After verifying, that the lux meter works, it was time to add the battery. I liked the option to power the unit from USB, so I decided to keep it. To do that, the VCC wire which was previously connected to the IN+ of the charger module is now connected to the center pin of the SPST slide switch. One pin of the switch is then connected to the BAT+ of the charger module and the other pin goes again to IN+ (this also serves as Off position). See the schematic for this.

I didn't have a 90° switch which could be soldered directly into the PCB, so I had to use some wire to connect the pins to the PCB. One side is simply jumped over on the bottom side to the adjacent IN+ pin of the charger module. The other side is connected by a wire on the top side to the BAT+ pin. I had to modify the previous VCC wire routing to connect it to the center pin.

At this point I also soldered in the 1K and 10K resistors for the backlight control. 1K resistor goes from Arduino pin 9 to the base of the transistor. The base is also pulled up to VCC by the 10K resistor. Collector and Emitter are now connected to the LCD pins, as described before.

Once this is done, you can CAREFULLY solder red and black to the positive and negative terminals of the battery, respectively. To prevent any shorts, I sealed the connections with hot glue. Finally, connect the battery wires to BAT+ and BAT-.

Step 6: Done!

Finished! You now have a nice little handheld lux meter. To use it, simply press the button to change between the simple lux reading and the graph view. Both the reading and graph update every 250ms and the graph automatically scales its y-axis to fit the currently displayed range of values.

Some final notes: The code is currently pretty simple, except for changing between the two screens there aren't any settings involved. It would be nice to add more buttons and to create a configuration menu, at least for changing the contrast settings. Another nice feature would be to change the update speed of the graph, so that we could display longer periods of time. Or even better, add an SD card for data logging... The code is open, feel free to contribute :)

Thanks for reading my Instructable.

2 People Made This Project!


  • Weaving Challenge

    Weaving Challenge
  • Pie Contest

    Pie Contest
  • Trash to Treasure

    Trash to Treasure

15 Discussions


10 months ago on Step 2

hello, thank for the project,

i try to compilate the code on ide on line (arduino create) but there is one message about line 72:

/tmp/397448962/luxmeter_1/luxmeter_1.ino:72:21: error: 'BH1750_CONTINUOUS_HIGH_RES_MODE_2' was not declared in this scope


i include all library correctly, check in the HB1750.h file, for me all seem declared.

what do you think about it ?

best regards



2 years ago

Hey, Im getting the error:

\Downloads\luxmeter-master\luxmeter-master\luxmeter\luxmeter.ino:4:20: fatal error: BH1750.h: No such file or directory

#include <BH1750.h>

and then it says cant compile for Arduino Uno.

An assistance in this matter? How can i make this directory?

Thank you very much

3 replies

Reply 1 year ago

you can get BH1750 library in here


Reply 11 months ago

Hi, I have the same problem.I already downloaded the BH1750 (BH1750.h) library and put it in the same folder as the .ino file, but it still sends me the message that can not find file or folder BH1750.What can be? I'm stuck since yesterday here.


Reply 11 months ago

Try replacing

#include <BH1750.h>


#include "BH1750.h"

This should tell the compiler to look in the project directory first, instead of looking through your installed libraries.


2 years ago


I want to use this lux meter for very small amounts of light (fiber optics), and I have a photodiode sensor with cathode/anode pins. Is it possible to substitute that your sensor module for the photodiode?

Mário Césard1

2 years ago

​Really nice! But wouldn't you need to change a resistor in the TP4056?

1 reply
3zuliMário Césard1

Reply 2 years ago

Technically yes, you should change the current set resistor on the TP4056 board. My battery is 800mAh and the default charge current of TP4056 is 1A, so in my mind it was good enough and I just left it like that.


2 years ago

Thanks a lot for answering!


2 years ago

Very nice project, thanks. I build it and it works fine. I wonder, should it work on a Arduino Uno without changes??

1 reply

Reply 2 years ago

Yes, it should work straight away on Arduino UNO and also on a Nano or Mega.


2 years ago

The BC547 is a NPN transitor, not PNP as listed. Nice project though!


1 reply

Reply 2 years ago

Thanks for spotting that typo. I of course meant BC557, it's fixed now.