I live in a part of the country where hail and severe weather are common place during the summer months. I was getting frustrated every year when my wife's garden was get demolished by the nightly hail storms losing our entire haul of vegetable goodies!
I decided to do something about it. I threw together a quick solution using a couple linear actuators bolted onto a frame I built around the garden (approximately 12ft x 12ft garden). The linear actuators would pull a heavy duty tarp over the garden when a storm was approaching. Here is a quick view of the roof in action:
The two motor controllers at the top were there to interface to the linear actuators to the PI. I had both software and manual control of the roof. The manual control of the roof used a two way rocker switch pictured at the bottom. The manual rocker switch control was active by default. When the PI was going to run the motor controllers it would deactivate the rocker switch, hence the need for the relay which is lit up in the picture.
I threw in a BMP280 temp/pressure sensor for good measure.
I actually planned to use a bunch of soil moisture sensors and rain detection sensors to report more status of the garden/weather but ran out of time before the storm season arrived. Version 2 of this will also incorporate an automatic watering system by recirculating rain water by pumping water out of a bucket through sprinkler hosing attached to the roof crossbar. Big dreams...
Software control of the garden was accomplished by using a Raspberry Pi and MQTT to communicate via Adafruit IO to reach the mobile app on my phone:
The MQTT app on my phone
The whole system was powered by a 12V Marine deep cycle battery. I kept it charged by using a solar panel. I also wanted to measure power to make sure I had enough current to drive the actuators and to verify battery status. I used a current sensor to keep an eye on it and reported it through the app.
Roof Status Detection
I needed a way to determine the status of the roof (open, closed, or unknown) and also a way to turn on/off the linear actuators when the roof cross bar was in its final open or closed position. Otherwise, they would tear the frame apart.
Additionally, the linear actuators worked independent of each other so it was possible they would be out of sync and wouldn't close/open completely. In practice the linear actuators were always out of sync so this became a real problem.
I solved this problem by using 4 limiter switches, one on each of the four corners, to detect when the cross bar would be triggering (resting on) each of the switches.