loading

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: https://github.com/3zuli/luxmeter/

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.

display.setContrast(50);
// 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
//testContrast();

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.

<p>Hello,</p><p>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?</p>
<p>Hey, Im getting the error:</p><p>\Downloads\luxmeter-master\luxmeter-master\luxmeter\luxmeter.ino:4:20: fatal error: BH1750.h: No such file or directory</p><p>#include &lt;BH1750.h&gt;<br><br>and then it says cant compile for Arduino Uno. </p><p>An assistance in this matter? How can i make this directory? </p><p>Thank you very much</p>
​Really nice! But wouldn't you need to change a resistor in the TP4056?
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.
<p>Thanks a lot for answering!</p>
<p>Very nice project, thanks. I build it and it works fine. I wonder, should it work on a Arduino Uno without changes??</p>
<p>Yes, it should work straight away on Arduino UNO and also on a Nano or Mega.</p>
<p>Hi, thanks for sharing this project, I'm building it a bit ugly but with some extras, but I have an issue, on a sunny day I get only 54612 lux as max, it should be about 65535 isn't?</p>
<p>The sensor outputs 0..65535lx raw value, but to get the actual light level, you need to divide it by 1.2. So when fully lit, 65535/1.2 = 54612 lux. The BH1750 library does this automatically. </p>
<p>Hi, thanks for your reply, I see. Well like I'm said, I made a version of your meter with some extras like battery indicator, hold and save/export data, sadly I haven't a nokia display so I've to pretty much write all the code, but if you or anyone are interested on my version or to adapt the extras to your version are welcome, I put the code, the diagram and a mini-wiki on a shared folder on gDrive: goo .gl/4NhtGC I'm trying to add photography related functionality, like f/iso/ev functions, but it's work on progress so when I'm finish I'll posted here and on github. Again, thanks for sharing!.</p>
Just finished it, it works great! Thanks
<p>Awesome, I'm glad you built one. Thanks for sharing!</p>
thx for makeing this :)
thx for makeing this :)
<p>Hi,<br>The BC547 is a NPN transitor, not PNP as listed. Nice project though!<br><br>Cheers,<br>Scott</p>
<p>Thanks for spotting that typo. I of course meant BC557, it's fixed now.</p>

About This Instructable

7,722views

125favorites

License:

More by 3zuli:Mini Arduino Lux Meter ESP8266 Internet Alarm Universal Portable USB Charger 
Add instructable to: