Chicken coop tech stack
Cluck cluck, beep beep
(First a brief note about products and shipping. SPIDriver and the SPIDriver Expert Pack are back in stock. TermDriver has shipped to all the backers, and it’s available to buy from Crowd Supply, Mouser, and directly from us. If you are a new owner of a TermDriver, you can get the preliminary user guide here.)
Our chicken coop is a short distance away from our house. Far enough away that it doesn’t have electricity. This led me to install a small solar panel and a battery in the coop, to power indoor lights. The lights run on 12V DC from the battery, and are a great convenience when locking the birds up in the winter nights.
At this point, of course, I was filled with an irresistible desire to remotely monitor the solar battery voltage. And if I was going to monitor that, I’d also like to know if the coop door was open or not. (The coop must be locked up every night, and opened up every morning.)
So this got made. Not pretty, of course, like everything about the chicken coop, but it’s worked very well.
The box is cut from plywood using a customized design from the excellent boxes.py. Running the show is a Raspberry Pi Pico. It’s powered by the 12V the solar battery supply. A regulator drops it to 5V. The Pico has three sensors:
battery voltage, connected through a resistor divider to an ADC pin
an I²C temperature sensor from Electric Dollar Store
an I²C magnetic compass, also from EDS
The Pico is collects the data and sends it back via the Reyax LORA module at the top of the box. The Reyax uses a simple serial interface at 115200 baud, with a good old AT-style command set for sending messages.
Every 60 seconds the Pico wakes up, samples the sensors, and sends a packet over the Lora with the sensors in JSON format like this:
{”magnet”: [-138, 104, -774], “vbatt”: 12.9571, “temp”: 13.625}At this point you might be wondering why I’m interested in the direction and magnitude of Earth’s magnetic field in the henhouse. Well, the whole box is mounted on the henhouse door:
When the door is opened, it swings through almost 180° and the resultant change in compass bearing is easily turned into a door open/door closed flag. I was particularly pleased with this cunning scheme - the door sensor uses no moving parts! (Unless you count the whole electronics package itself as a moving part, which I don’t).
Back at the base, another Reyax receives the packets and is connected through a TermDriver to a Raspberry Pi.
The Pi reads the JSON data and sends it on to the house MQTT server, which is Mosquitto running on another Raspberry Pi.
One improvement I made last year is to hook up a lamp in the house to the door open/closed logic, using a Shelly Smart Plug. Besides all their cloud/smarthome features (which I don’t use) they have a simple web server for off/on control. So you can switch the socket off or on by fetching a single URL from the Shelly like:
http://192.168.0.60/relay/0?turn=onAs soon as the receiver sees that the door has been closed, it turns on the lamp in the house. This works very well; we can easily confirm that one of us has locked the chickens in each evening just because the lamp has gone on. We don’t have to look at a screen or remember to check anything. I particularly like this kind of invisible technology.
I should say a few words about the software. The Pico in the coop runs a small CircuitPython loop. The receiver Lora/MQTT gateway indoors is just a small Python script. It’s simple stuff, reliable and easy to diagnose if anything goes wrong.
Thanks for reading.






Brilliant use of the compass! Door sensor with no moving parts - love it