Photo-style AI picture: a small green circuit board with wires on a wooden floor in front of a glowing Christmas tree (request-match QC PASS try 3). File: Content/Article-Images/xmas-tree-pi-circuit-board.png

My Office Christmas tree has a motion sensor. Walk past it and the lights wake up and twinkle at you for 5 to 10 seconds, in a random pattern, then go quiet again.

The brains behind it are a first-generation Raspberry Pi, the original Model B. Last November I gave it a new job as the tree's brain. This year it came back out of the box for season two, and it joined the Wi-Fi on the first try.

HOW IT WORKS

- A cheap PIR motion sensor (the little white dome) is wired to one pin on the Pi (GPIO 23). - The lights hang off another pin (GPIO 18). A single LED can run straight off the pin with a resistor; a real light string needs a relay in between, because a Pi pin only gives out 3.3 volts and a few milliamps. - About 100 lines of Python wait for the sensor, blink the lights in a random on/off rhythm, and write every trigger to a log file. - It runs as a service, so if the power blinks the tree comes back on its own.

WHAT ONE SEASON LOOKED LIKE

That little log file turned out to be the best part. From late November last year to the day it got unplugged:

- 58,397 motion triggers. - 121 hours of twinkling in total, which is about five full days. - January was the busiest month (15,309 triggers), not December. The busiest single day was January 13, with 1,336. - Between midnight and 1 AM it fired 4 times all season. Even the dog sleeps.

THIS YEAR'S TUNE-UP

Before it went back under the tree, I did the boring part: brought it back online, pointed its software updates at the archive (its operating system is old enough that the normal update servers are gone), installed every update it could still get, and rebooted it. Old hardware is fine. Old hardware nobody checks on is how you end up with a holiday surprise.

The point: a computer from 2012 with one sensor and one string of lights can still make people smile, and the most fun part of the project was the data it quietly collected along the way.

— Continue reading at https://dizydiz.com/blog/my-christmas-tree-has-a-motion-sensor-and-58-397-reasons-to-keep-it.html