Since starting bmengineer.com, I've done a lot of runtime tests of flashlights. I've done all of these with the light sensor built in to an old Moto X Play phone I had laying in a drawer. It's been great, but there were a few things I didn't like about it:
The sensor in this particular phone is extremely low resolution, and that's apparent in some measurements
Making sure the phone is always charged isn't fun
The phone needs to sit perfectly still during readings, which means if the battery starts dying I need to plug it in - which I can't do during a test per the previous point
There's no way to check the current light level without turning on the screen and risking moving the phone
So, I decided to build myself something that would fit my needs a bit better. I bought a Raspberry Pi Zero W, an Adafruit TSL2591 light sensor, and a couple cables to get it all connected, and I wrote RuTiTe - a short runtime test script with a few features:
I may make a guide to using this at some point in time in the future, but not yet. I'm sure it's too buggy still, writing guides is tedious, and you need to be able to figure out how to get this set up on a Raspberry Pi to be able to use it in its current state.
And a big thanks to parametrek and oweban, who have helped me find some issues in the code already.
More ways to do runtime tests is always better and it was fun helping out with this project.
If you’d like to use a different computer than the Pi (possibly running Windows or OSX but Linux is best supported) or a more typical luxmeter then there is my project which has similar python utilities for the GM1020 luxmeter and UT382 luxmeter. A lot of people complain that the UT382 doesn’t work on newer versions of Windows - it does with my code. I am currently adding support for the TL-600 luxmeter too.
Excellent work and thanks for sharing details of your project. I’ve been looking at options for a lux logging solution and have considered Bluetooth lux meters and a simple Arduino project. Still looking at what is the best/easiest one I go for.
I’m slowly working on documentation, as well as some images of my setup. Have enjoyed testing, as well as learning some new things about both Python and sensors in general.
It still needs some tidying up, but here's a peek at what this looks like for my integrating...shoebox.
At the top is the Raspberry Pi Zero. The breadboard is really only used for the status LEDs, and the wires run to the sensor at the bottom. If you don't want the LEDs, it's as easy as running a wire from the Pi to the sensor, which I know Oweban has chosen to do.
An Adafruit VEML7700 Ambient Light Sensor arrived today!
There are some nice examples for the VEML7700:
Hardware used so far:
Raspberry Pi Zero W
FLIRC case
Adafruit 40x3” (75cm) Female/Female Jumper Wires
Adafruit VEML7700 Ambient Light Sensor
Raspian/Raspberry Pi OS Lite in headless mode.
I was getting an I2C address error initially. I had forgotten to enable I2C. Doh!
sudo raspi-config
Interfacing Options > I2C > Yes > OK > Finish
After installing dependencies with pip3, matplotlib then ran into a few missing libraries:
sudo apt-get install libopenjp2-7 libtiff5
I modified rutite.py locally by adding a few lines and commenting some out:
import adafruit_veml7700
sensor_ceiling = 120000.0
sensor = adafruit_veml7700.VEML7700(i2c)
sensor.light_gain = veml7700.ALS_GAIN_1_8
I found the new ceiling value and the gain value by looking at the VEML7700 datasheet:
Detectable maximum illuminance | With ALS_GAIN = “10” | 120 000
ALS_GAIN 10 | ALS gain x (1/8)
The VEML7700 driver code has an example of ALS_GAIN_2:
Before you white box it how does it compare to whatever off the shelf meter you use for just regular lux readings using different light sources (LED, ambient/sun, incan)?
Your post history is too new for me to stalk what popular single cell lights you have. If you have one that may have been reviewed by enough people to see lux measurement (kcd) not lumens you can re-create that test.
I only ask because getting a baseline on this sensor seems important before you put it into your own white box with too many variables to reverse engineer. I think user oweban might be doing a VEML7700 config at some point as well.
I’m really into home automation side of things but not so much arduino/pi (except that all my home automation runs on a pi4). In any case I stumbled upon what might be a good solution to plot this data in real time:
MQTT to handle serving up sensor data and Grafana to ultimately plot it. Just a thought…
Use Olight i3T (with full-ish battery) and measure out a distance of like 10-15 feet (3-5 meters, 1-2 kangaroos) - record exact distance and shine light right at sensor on high. Come back with lux measurement from sensor and distance and we can probably figure out if it’s calibrated like a lux meter.
edit; I guess I should also say do it in an area that is at least a little bit dark. doesnt have to be pitch black (you could even measure the “ambient” light in room with sensor first)
I addressed all that in the original post. I have trouble keeping the phone still, my phone has very poor resolution, and it often crashes on very long tests thanks to Android killing apps after a while. This option is cheaper, more configurable, and just overall better for my use case.