Log and Plot Light Levels With PiCam

Consistent with my goal to utilize as few sensors on my robot as possible by maximizing the capabilities of each sensor, I was wondering if it was possible to use the PiCamera to measure room light levels, similar to a Grove Light Sensor, or a photo-resistor that give a “unit-less” analog value.

It turns out the PiCamera tags every JPEG photo with a floating point “BrightnessValue” which rises logarithmically with increasing light levels. This is my project:

Log and Plot Brightness Value Using PiCamera

Project to monitor light level using picamera JPG format EXIF Brightness Value, and generate a plot versus local time for 24 hours from 00:00 to 24:00

The PiCamera pointed horizontal 10 inches off the floor, records a Brightness Value:

  • exactly 0.0 for total darkness
  • roughly 0.05 in a dark room with light streaming through the doorway from kitchen 30 feet away
  • roughly 0.7 for a small room lit only by 150 watt overhead lighting
  • roughly 1.0 for a small room with one large window at evening light plus overhead lighting
  • roughly 1.5 for a small room with one large window during end of the world storm outside
  • roughly 2.6 for a small room with one large window with partial blinds and full sun outside

Based on:

Example plot:

Code is at: https://github.com/slowrunner/Carl/tree/master/Projects/LogLightValueAndPlot