← All Posts

Making a Mozilla Webthing — A Lux Sensor — Part 2

July 03, 2019

This post follows on from Part 1

Some Data!

Here is Lux and Luminosity for the past 24 hours.

Data from the last day

Lux and Luminosity from the last 24hrs

Some cool things in the data.

  • you can see the sunrise! (approx 4:30AM)
  • you can see when someone in the house woke up and turned on the living room lights. Yay privacy! (They don’t mind. This is less annoying than when I made a clap sensor that required very loud claps to debug)
  • Unlike the calculated lux, infrared does not change significantly when the LED wall lights are turned on. There is a peak 18:30, which correlates with a strong rise in the broadband value relative to the calculated lux. Could be something to do with the sensor’s automatic gain setting? I’d need to check if the luminosity values are calculated to account for this or not.

Picking a threshold

Even with the auto gain potentially complicating things it’s pretty easy to draw a horizontal line across the chart: above this the artificial lights are “on”, below they are “off”.

One little python script later…

a script printing on and off as I toggle the lights

a script printing on and off as I toggle the lights

Next Post

From simple script to Webthing!


I, Pete Taylour, shall be writing up some projects.
I'm a full-stack software dev from London Brighton.

[LinkedIn for work]. [Github for code].

© 2023