Introduction: Super-sensitive Photographic Light Meter Using Adafruit TSL2591 Sensor

 I enjoy the decadent pastime of taking pictures with vintage film cameras. I now have 2 Voigtlander folding cameras and intend to make some stereo images but that is another story. These old cameras have no lightmeter built in, and although lovely examples of old light meters are available on ebay, the selenium photocells they rely on do not withstand the passage of time well and lose sensitivity. The price of a new modern lightmeter runs to hundreds of pounds. Therefore I designed and built a simple lightmeter using the cheap uber-capable Adafruit TSL2591 and provide here the design, build and testing.

NB this is an incident light meter (e.g. you use it by taking a measurement at the position of the subject). It could easily be modified to create a reflective mode by fixing a simple lens over the sensor in order to create approximately a 60 degree acceptance angle.

The device is powered by a single 18650 lithium cell which should last for about 9 hours if it's capacity is 2000mAh.

It's sensitivity is adequate to give accurate readings down to candlelight portraiture and moonlit scenes. But beware, for obvious reasons, no reciprocity failure has been programmed into the sketch.

Supplies

Arduino nano https://www.amazon.co.uk/gp/product/B09LVH5D93/

Header pins for the Arduino (which are usually supplied with it.)

On/off switch https://www.ebay.co.uk/itm/284180623282

Food container approx 10 x 7 x 15cm - from any supermarket

Adafruit TSL2591 High dynamic range light sensor - https://thepihut.com/products/adafruit-tsl2591-high-dynamic-range-digital-light-sensor

HD44780 LCD display with I2C backpack - https://www.amazon.co.uk/Yellow-Green-Backlight-Interface-Compatible-MEGA2560/dp/B09FXJ1799/ (these are available in blue or green, the blue one is hard to read in bright light)

Battery charging board (single cell) - https://www.amazon.co.uk/gp/product/B07BSVS842/

Buck boost converter - https://www.amazon.co.uk/Yizhet-Efficiency-Regulator-Converter-Adjustable/dp/B0823P6PW6/

18650 battery holder (single cell). You can usually find a good one from a defunct laptop, or power tool battery pack. Since the project only draws about 85mA the cell does not need to have high capacity.

Ribbon cable - https://www.amazon.co.uk/gp/product/B07FM8YVZQ/

Push switches (4) momentary action - https://thepihut.com/products/tactile-button-switch-6mm-x-20-pack

PVC right angle strip - from any double glazing stockist

A piece of reclaimed printed circuit board (PCB) or other rigid material approx 10cm x 10cm

Opalescent plastic 2 x 2cm x 3mm (thickness not critical) - https://www.ebay.co.uk/itm/113079031078 but available from many suppliers, a serviceable piece could be harvested from a disposable white plastic food container or bottle.

M3 nuts and bolts

Sticky backed velcro (or alternative means of fastening Nano down.)

Soldering iron

Drill and bits

Craft knife

Optional: Rotary tool (such as Dremel)

Hot glue gun

Step 1: Try Out the Circuit Before Assembly

Assemble the circuit first on breadboard you don't need to include the battery, buck boost regulator or USB battery charge board at this stage.

In your IDE add the following libraries (click Manage Libraries and search or select from the list)

  • hd44780
  • Button
  • Adafruit TSL2591
  • Adafruit unified sensor

Download the sketch. (tsp2591_light-meterV6.ino)

Open the sketch in your IDE

Plug your Nano board in to your PC and upload the sketch to the Nano board

Check that you are getting readings on the LCD display (see image) and in the serial monitor.

Step 2: Arrange Components on Case Lid

Start preparing the case as follows.

All the components except the sensor will be attached to the lid (for easy maintenance)

Position the LCD, reclaimed PCB, battery holder, push switches and main switch roughly on the lid. Mark out where you want them. See the suggested layout diagram.

Cut a slot and bolt holes for the LCD unit and install it into the lid.

Drill a hole ready for the power switch and install it.

Step 3: Install Push Switches

The push switches will be trapped between lid and the piece of reclaimed PCB. So estimate the size of PCB you need and cut a piece accordingly. Mark and drill 4 holes through the lid and the PCB, ready to attach it. Drill holes in the lid for the 4 push switches. Note the PCB does not serve any electrical purpose it is only there to retain the push switches.

Solder 5 wires to the push switches according to the circuit diagram. Use some of the ribbon cable for this: make a note of which colour goes to which switch and which is the common. Leave about 10cm free length on the ribbon cable.

Carefully trap the push switches between the PCB and box lid, insert the 4 bolts and tighten the nuts on to them. While assembling, it might help to keep the push switches in place with a small dab of hot glue on each. NB be sure your connections to the push switches do not contact any redundant tracks on the reclaimed PCB. If that seems likely cover it with duct tape.

Step 4: Solder the Header Pins to the Arduino Nano

Solder the header pins onto the arduino. Please note solder them on the opposite way round to normal, e.g. so the long pin ends are sticking upwards(see photo). This is so you can solder your connections on to the header pins on the top of the board, we can then fix the board into the lid. You will see in the next step how this provides strain relief for the cables.

Step 5: Wire Up the Main Components

In this section we are going to wire up the

  • Arduino to the...
  • TSL2591 sensor
  • HD44780 LCD display
  • Push buttons you have already installed in the lid.

Initially I soldered the ribbon cable directly to the pads on the board but with movement the fine wires soon broke. So we are going to use the header pins and some heat shrink to provide strain relief. Please don't apply heat to the heat shrink until you are sure that all the cables to that pin have been soldered on, it is a nuisance to have to cut off heat shrink that was shrunk prematurely. Where there are multiple cables attached to one pin it is easiest to twist the bared wires together and tin them before soldering them to the pin. Please see the drawing which illustrates the method.

Now you are going to start wiring it all together. Follow the circuit diagram carefully. Ensure you give the TSL2591 light sensor board a good long flying lead of ribbon cable (25cm) since it will be fastened into the lower part of the container later and it would be difficult to open the case for maintenance if the lead was short. The other leads do not need to be excessively long. Make sure while you are soldering onto the arduino pins that you include the 2 leads (on the 5V pin and the ground pin) you will need later to solder to the buck boost regulator.

Step 6: Mount the Battery Charger Board

Cut a piece of the PVC "L" section, the width of the battery charging board (BCB).

The L section will be glued to the edge of the PCB and hold the battery charging board (BCB) at right angles to the lid, so that a power supply lead can be inserted into a slot in the lid, into the BCB (see photo). So assemble it accordingly, then use the hot glue gun to glue the BCB to the L piece in such a way that the BCB USB socket will be hard up against the inside of the case lid, don't glue the L piece to the PCB yet.

Solder suitable wires to the battery charge board as this is more easily done before it is in-situ.

Then mark out the slot you will have to cut so you can plug a USB power supply into the battery charge board. Then cut the slot and glue the L piece to the PCB. NB cutting the tiny slot for a micro USB may be tricky, I resorted to melting a suitable slot with a soldering iron and dressing the edges with a craft knife afterwards. If you do this, ensure copious ventilation.

Finally use the glue gun to fix the L piece (with it's attached battery charge board) to the reclaimed PCB in perfect alignment with the slot, doing this with a USB cable plugged in makes it easier.

Step 7: Wire in Battery Holder

You have 2 flying leads which you previously soldered to the battery charge board, on the pads marked Bat+ and Bat -

Solder these to the battery holder, carefully observing polarity.

Use the hot glue gun to fix the battery holder to the lid.

Step 8: Mount the 5v Buck Boost Regulator

First solder the -ve output wire from the battery control board to the input of the buck boost and solder the +ve output from the battery control board via the power switch to the positive input of the buck boost.

Very Important -setting the voltage to 5V: Install the battery and connect a multimeter to the output of the Buck Boost Converter. Switch on the power switch and adjust the potentiometer on the board until the output is 5.0V. (You could of course use an external power supply set to about 4V if that is more convenient.)

Now solder the wires from the arduino 5V and ground to the output of the buck boost

Finally use sticky backed velcro to stick the buck boost regulator to the PCB.

Step 9: Check Your Work So Far.

You should have all the components wired in as per the circuit diagram. Plug the USB into the arduino nano and check the display. Now unplug the USB cable and try running it from the battery. Also try charging the battery by plugging a micro USB cable into the battery charge board.

A note about the display, the f number (aperture) t (shutter speed) and ISO should be familiar to photographers. The number in the top left is the illuminance in Lux. The character in the bottom right is the gain set in the sensor board (Low Medium High or maX).

Make suitable ISO and Aperture signs for the push buttons, and stick these on. I just used an inkjet printer to make the signs and stuck them on with clear adhesive tape.

Step 10: Mounting the TSL2591 Sensor

Decide where in the base section of the case you would like the sensor to be. Offer it up and mark on the case where the photo diode is. Drill an 8mm hole in this position. Use a soldering iron to remove the STEMMA QT sockets because these prevent you from attaching the board close to the case and so the photo-diode is too far back from the hole (giving a more directional response). Holding the sensor against the case mark the case over the mounting holes in the sensor. Drill the case accordingly. Clear off any swarf. While being very careful to hold the sensor in exactly the right place squirt some hot glue into each hole in the case so that the sensor is attached in 4 places. You could use small nuts and bolts if you prefer, it depends how much patience you have and how accurate you are with the drill.

Step 11: Attaching the Opal Diffuser and Recalibrating

The opal diffuser serves 2 purposes. It creates a more nearly cosine polar response and it reduces the reading by a useful amount. The latter is necessary because the sensor, even on it's lowest gain saturates in bright sunlight.

Open the sketch in your IDE. Change the value of the variable "calibration_factor" from 1.56 to 1.0 and upload the sketch to the Arduino. Remove the cable and assemble the box.

With the opal diffuser off, point the light meter at a constant light source and take a reading in Lux (call it A). Hold the diffuser over the sensor and take another reading (call it B). Calculate A / B and put this number in the variable "calibration_factor", then save and upload the sketch again to the arduino.

Fix the opal diffuser in place with hot glue (or some adhesive tape if you think you might want to remove it again.)

If you are going to want to measure very low Lux (less than 1) you will need to use black insulating tape to cover up LEDs on all the PCB module, unless perhaps your case is black.

Step 12: Testing

This is not required of the builder of this instrument but details of tests performed during development are given so that the builder may confirm similar performance if desired.

There is little guidance available for the TSL2591 sensor as to when to switch from one gain setting to another. With a dynamic range of 600million to 1, testing it's response over the whole range is a daunting task. Instead I compared readings on different gains in 2 experimental setups (bright light, and dim light). This covered the Lux range 0.17 to 2194. The results are shown and indicate that it makes little difference which range you are using as long as neither the infra-red or whole spectrum readings do not saturate or approach single figure precision. To these ends, in the sketch, the switchover points for gain settings were set at :

  • Low Gain >100 Lux
  • Med Gain 10 to 100 Lux
  • High Gain 1 to 10 Lux
  • Max Gain 0 to 1 Lux

The higher intensity source was a 20W halogen lamp driven by a 12V stabilized power supply. The lower intensity lamp was a small white LED driven at 1.12mA. In both cases the room was blacked out and readings were taken on all four gain settings at various distances from over 3m to 5cm. Note that a different sketch was used for these measurements since the gain had to be manually selectable. In this sketch, interrupts were used to change gain. The sketch is attached (tsl2591_light-meter_interupt_range_change.ino)

The circuit was similar to the main project, but no power boards or battery were used, the system was just powered through the Arduino USB. The range switches were connected to pins D2 and D3 (these are the only pins on a basic Nano which are usable as interrupts) The circuit is shown, the resistors and capacitors just "debounce" the switches.

I also did some tests against 2 other meters in varying situations. I used an inexpensive Lux meter (Sunche) and the meter in a Praktica SLR film camera. The latter was chosen because these cameras were ahead of their time, using a (durable) silicon photocell while other cameras were using Cds or selenium cells which degrade over time.

Comparison of readings with Sunche light meter (this unit vs Sunche)

Indoor, darkened room 5 vs 0 Lux

Indoor, light room 120 vs 150 Lux

Outdoor overcast 1,770 vs 4,460

Outdoor sunny 30,000 vs 69,000


Comparison of readings with Praktica camera

Indoor, darkened room +1 stop

Indoor, light room 0 stops

Outdoor overcast -1 stop

Outdoor sunny 0 stops

Step 13: Trouble Shooting and Further Development

Program description. The sketch is well annotated so it should be self explanatory. The loop section of the program polls the TSL2591 on low gain mode and may repoll the TSL2591 with higher gain settings depending on the Lux value measured originally. Also in the loop, the sketch detects if the operator has pressed one of the ISO or Aperture adjusting buttons. After a few calculations it finally displays the Lux, ISO, Aperture, Shutter speed and gain setting that was in force when the reading was taken. A further delay is built in to enable the operator to read the display without flickering digits.

Interrupts vs loops: An annoying aspect of the operation is that the user must be pressing the button while the loop is at a certain point, or the sketch will not detect the button press. This makes big changes to ISO or aperture slow and a bit odd. An interrupt would avoid this problem but the basic Arduino Nano provides only 2 interrupt pins (we would need 4). I did look at a table of other Arduinos and the only ones I found with more interrupt pins were ones with wifi built in and cost over 10 times as much. After completing the project and during write up I chanced upon a more economical one, the Arduino Nano Every, which only costs about 3 times a basic Nano and allows all digital pins to be interrupts.

The total cost of components excluding wires etc and the 18650 cell was approximately £20 ($26 US). A Nano every would have pushed this up to £26 which I think would have been worth it.

I used the blue LCD HD44780 display which is impossible to read in bright light. I am unsure if a green one would have been better. Ideally some kind of e-ink display with an LED illuminator would have been ideal.

First Time Author Contest

Participated in the
First Time Author Contest