RuTiTe - my standalone runtime tester project

24 posts / 0 new
Last post
bmengineer
bmengineer's picture
Offline
Last seen: 1 day 12 hours ago
Joined: 01/26/2018 - 11:38
Posts: 1038
Location: Ontario, Canada
RuTiTe - my standalone runtime tester project

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:

  • Automatically output a graph at the end of a test
  • Sensor readings are much nicer

  • Configurable recording interval so very long runtimes don't end up as huge files
  • No batteries
  • Cheap! The whole setup costs about $30 USD
  • I can print updates to the terminal on the Pi, and check them from anywhere in the house with an app
  • Status LEDs to tell at a glance when my test is done

If you're interested, I've made the code I use available at github.com/bmengineer-gear/RuTiTe

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.

Find all my reviews of flashlights and more gear at www.bmengineer.com

Edited by: bmengineer on 07/11/2020 - 10:23
Scientist
Scientist's picture
Offline
Last seen: 6 days 5 hours ago
Joined: 07/24/2017 - 13:33
Posts: 374
Location: Out standing in my field NY

Looks great. Thanks for making this handy tool available to the BLF community!

Please illuminate responsibly
Part time fragmented conciousness technician

UV triple using Sofirn C8F
395nm High Power LED in Sofirn SC31b

Parametrek
Parametrek's picture
Offline
Last seen: 3 days 10 hours ago
Joined: 02/08/2017 - 19:50
Posts: 220

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.

Try the largest, fastest, most flexible flashlight search engine: parametrek.com

63 brands, 3100 models and still growing!

Also: USA li-ion database

Rolz
Offline
Last seen: 1 month 2 weeks ago
Joined: 01/25/2011 - 19:55
Posts: 976
Location: Australia

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.

oweban
oweban's picture
Offline
Last seen: 1 year 10 months ago
Joined: 02/12/2019 - 06:34
Posts: 1263
Location: Sydney AU

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.

bmengineer
bmengineer's picture
Offline
Last seen: 1 day 12 hours ago
Joined: 01/26/2018 - 11:38
Posts: 1038
Location: Ontario, Canada

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.

Find all my reviews of flashlights and more gear at www.bmengineer.com

Dlux
Offline
Last seen: 8 hours 27 min ago
Joined: 05/27/2019 - 18:43
Posts: 66

Great project! I love this kind of things Love
Thanks a lot for sharing!!!

TimMc
TimMc's picture
Offline
Last seen: 20 hours 52 min ago
Joined: 06/26/2020 - 02:22
Posts: 779
Location: Melbourne, Australia

An Adafruit VEML7700 Ambient Light Sensor arrived today! Steve

There are some nice examples for the VEML7700:
https://learn.adafruit.com/adafruit-veml7700/python-circuitpython

Hardware used so far:
Raspberry Pi Zero W
FLIRC case
Adafruit 40×3” (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
sensor.light_gain = veml7700.ALS_GAIN_1_8

I found the new ceiling value and the gain value by looking at the VEML7700 datasheet:
https://www.vishay.com/docs/84286/veml7700.pdf

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:
https://github.com/adafruit/Adafruit_CircuitPython_VEML7700/blob/master/...

Time to build a white box to put this in…

contactcr
Offline
Last seen: 2 days 18 hours ago
Joined: 05/19/2017 - 18:52
Posts: 3720
Location: US
TimMc wrote:
An Adafruit VEML7700 Ambient Light Sensor arrived today!

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)?

TimMc
TimMc's picture
Offline
Last seen: 20 hours 52 min ago
Joined: 06/26/2020 - 02:22
Posts: 779
Location: Melbourne, Australia
contactcr wrote:
how does it compare to whatever off the shelf meter you use

I don’t have any commercial light meters (photography etc). I’ve got a TinyCircuits TSL2572 Ambient Light Sensor but never had a use for it until now.

VEML7700 seems to react when I shine an SC64c LE at it from across a room.

contactcr
Offline
Last seen: 2 days 18 hours ago
Joined: 05/19/2017 - 18:52
Posts: 3720
Location: US
TimMc wrote:
contactcr wrote:
how does it compare to whatever off the shelf meter you use

I don’t have any commercial light meters (photography etc). I’ve got a TinyCircuits TSL2572 Ambient Light Sensor but never had a use for it until now.

VEML7700 seems to react when I shine an SC64c LE at it from across a room.

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.

contactcr
Offline
Last seen: 2 days 18 hours ago
Joined: 05/19/2017 - 18:52
Posts: 3720
Location: US

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:

https://guysoft.wordpress.com/2020/03/02/mtigos/

MQTT to handle serving up sensor data and Grafana to ultimately plot it. Just a thought..

TimMc
TimMc's picture
Offline
Last seen: 20 hours 52 min ago
Joined: 06/26/2020 - 02:22
Posts: 779
Location: Melbourne, Australia

I’ve a ZL SC64c LE, H600Fc, Olight i3T.

contactcr
Offline
Last seen: 2 days 18 hours ago
Joined: 05/19/2017 - 18:52
Posts: 3720
Location: US
TimMc wrote:
I’ve a ZL SC64c LE, H600Fc, Olight i3T.

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)

oweban
oweban's picture
Offline
Last seen: 1 year 10 months ago
Joined: 02/12/2019 - 06:34
Posts: 1263
Location: Sydney AU

I might pick a VEML up to compare – my TSL2591 recorded very similar readings to my UT383S.

TimMc
TimMc's picture
Offline
Last seen: 20 hours 52 min ago
Joined: 06/26/2020 - 02:22
Posts: 779
Location: Melbourne, Australia

contactcr wrote:
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.

 

Olight i3T

LADDA AAA battery voltage 1.34V

Distance: 225cm

Lux on high was between 161 and 168.

Lux on low was exactly 5.0687999999999995 each time.

 

#!/usr/bin/env python3
import time
import board
import busio
import adafruit_veml7700

i2c = busio.I2C(board.SCL, board.SDA)
veml7700 = adafruit_veml7700.VEML7700(i2c)
veml7700.light_gain = veml7700.ALS_GAIN_1_8

while True:
    print("lux:", veml7700.lux)
    time.sleep(0.3)
patmurris
patmurris's picture
Offline
Last seen: 2 weeks 4 days ago
Joined: 12/22/2014 - 15:54
Posts: 1723
Location: Nice, France

Interesting project.

Sorry to ask, but isn’t it simpler to just use a phone app?
Or will it drain the phone on long runtime tests?

contactcr
Offline
Last seen: 2 days 18 hours ago
Joined: 05/19/2017 - 18:52
Posts: 3720
Location: US
TimMc wrote:

Olight i3T


LADDA AAA battery voltage 1.34V


Distance: 225cm


Lux on high was between 161 and 168.

= 850cd = 58.3m throw

specs on box say 60m throw, one review says 67m

It sounds like it’s at least in the ballpark for this test.

bmengineer
bmengineer's picture
Offline
Last seen: 1 day 12 hours ago
Joined: 01/26/2018 - 11:38
Posts: 1038
Location: Ontario, Canada

patmurris wrote:
Interesting project.

Sorry to ask, but isn’t it simpler to just use a phone app?
Or will it drain the phone on long runtime tests?

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.

Find all my reviews of flashlights and more gear at www.bmengineer.com

Chicken Drumstick
Offline
Last seen: 16 hours 44 min ago
Joined: 08/27/2012 - 05:00
Posts: 2989
Location: UK

Thanks for sharing. Might have to look into this at some point in the future.

contactcr
Offline
Last seen: 2 days 18 hours ago
Joined: 05/19/2017 - 18:52
Posts: 3720
Location: US

bmengineer, any new progress or additions to this or did you get it set up how you wanted and it already serves its purpose as is?

bmengineer
bmengineer's picture
Offline
Last seen: 1 day 12 hours ago
Joined: 01/26/2018 - 11:38
Posts: 1038
Location: Ontario, Canada

contactcr wrote:
bmengineer, any new progress or additions to this or did you get it set up how you wanted and it already serves its purpose as is?

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.

Find all my reviews of flashlights and more gear at www.bmengineer.com

dave1010
dave1010's picture
Offline
Last seen: 1 week 2 days ago
Joined: 07/04/2017 - 02:38
Posts: 487
Location: Dorset, United Kingdom

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.

bmengineer
bmengineer's picture
Offline
Last seen: 1 day 12 hours ago
Joined: 01/26/2018 - 11:38
Posts: 1038
Location: Ontario, Canada

dave1010 wrote:
D
o 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.

Right now I just ssh. I agree that a webserver would be more convenient, just haven’t picked and learned the tools that would require yet

Find all my reviews of flashlights and more gear at www.bmengineer.com