Solar-Powered Raspberry Pi Controlled Chicken Door with Smartthings Integration

This is a follow up to my original project, a 12 volt Z-Wave Smartthings controlled chicken door that opened a sliding door at sunrise and closed it 20 minutes after sunset. The Z-Wave version became a jumble of wires and components. It worked but it wasn’t very pretty with limited function. I decided to dive into Raspberry Pi as a cleaner solution and to learn something new. Below is a list of components and code I used to piece this together. In celebration of finally connecting the solar yesterday… I present the new and improved solar-powered Raspberry Pi chicken door for Smartthings!

Raspberry Pi Zero HW - small in size and price. Connects to Smartthings via wifi.
RasPiRobot Board V3 - controls the linear actuator and provides power to the Pi via a 12 volt input.
DS18B20 Temperature Sensor
12 inch linear actuator - this is very slow-moving (80 seconds for full extension & retraction) and a little noisy. My hens hear it and move away from the sound if they aren’t already roosting for the night.
20 watt solar panel and controller
12 volt 8Ah battery

I started by using the code from Mag Pi issue 43 - page 44 to control the motor. Additional help from forums and friends got me to this final python script. You’ll want to make this script run at startup automatically.

I used WebIOPi to connect the Pi to Smartthings and control the open/closing of the door - https://thepiguy.altervista.org/webiopi-rp3/ and the Virtual Pi Relay from @iBeech

I never figured out how to get the temperature sensor to work over WebIOPi but I was successful using this excellent writeup by @paulc2 - Raspberry Pi Temperature Sensor - At first glance, the process seemed complicated but taking it step by step I had a functioning temp sensor appearing in Smartthings after about an hour. I had one issue where the script would stop, a cron job every 30 minutes fixed that.

The solar panel charges the battery through the solar charge controller. The controller’s 12 volt output connects directly to the RasPiRobot V3 power input. This powers the Pi and motor without any other circuits or components. Nice and neat!

I plan to add a reed switch to the door connected to an LED facing the house so I can see that the door is open or closed. The Pi has performed flawlessly in the six months I’ve been using it but a physical switch would add some peace of mind since I can’t see the door without going out to the coop. Also on the to-do list is a camera inside the coop and a laser tripwire to cut power to the door just in case…

Someday I would love to build a stand-alone website and Smartthings SmartApp containing all of the coop’s sensors and controls in one spot but that’s a bit beyond my current skill level.

6 Likes

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.