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.
I have it set up how I like it, but I should check that the repository is up to date. If you’re trying it and either need help, want to use a different sensor, or need a specific feature, let me know.
Do you ssh to the Pi to check the status or run a webserver on it? Would be cool to have a webserver that shows the current values and a historic chart.