DIY connected motion and luminosity sensor

This device has been in the making for quite a while, mainly because I couldn’t find a continuous stretch of time to make noticeable progress. Good thing I had the whole day to myself today!

The idea was to take a standard motion sensor shell and fill it with connected goodness. Namely:

The point of this exercise was to provide my smart home with an accurate measure of outdoors luminosity, in part to more accurately turn on garden lamps after dark, but also to judge whether automated indoor lamps should be on. Then there is of course the motion sensor which serves as a security measure, but also as a trigger to turn up the terrace lighting at night from dim to high to welcome us.

It should have been pretty smooth sailing, as it’s little more than wiring, using existing libraries, reading values and passing them on. Unfortunately the adafruit TSL2561 library that worked spotlessly on the Arduino Uno, did not at all want to cooperate in the Particle environment. Luckily I ran across an inspiring project integrating the Particle Photon with HomeKit, and it happened to use a different library for this same sensor. After the quick required rewiring of the pins all looked good! Now it’s already mounted outside doing its thing!

PS: This image on top isn’t my version of Hal, but rather the sensor during boot showing its status and connectivity.