
Greenhouse Automation System
Here’s how I developed an automatic window opening system to regulate temperature in a greenhouse.
Prototyping
To get started, I had a conversation with a bot to plan out the build. Thanks ChatGPT!
The Raspberry Pi Pico microcontroller seemed to be a good choice. Then a temperature sensor, motor driver, and other components needed to be selected. After the parts arrived, I started prototyping:
Basic setup
Components
- Raspberry Pi Pico microcontroller
- GPIO breakout board
- 2x 12V linear actuators
- DHT22 temperature/humidity sensor
- 1602 LCD display with I2C module
- BTS7960B H-bridge motor driver
- 6x micro tactile push buttons
- Mini slide switch
- Rocker power switch
- 4-position push-in cable connector terminal
- JST plug and port
- C13 AC power port
- 12V to 5V/3.3V DC step-down converter
- 12VDC power supply
Some comments regarding the components:
- The GPIO breakout board is made for these kind of applications. It facilitates good wiring connections.
- The motor driver is way overkill (the actuators probably draw max 3A combined), but it’s one of the cheapest drivers out there.
- The push buttons, switches, cable terminal, JST connectors, and power port were all salvaged from old electronic devices.
Design
Once I had an MVP (minimum viable product), I switched to CAD.
First of all I modeled a rough idea in Blender (it’s not ideal for making parametric models, but the overall workflow is really fast).
After coming up with a viable design, I switched to Onshape, where I created accurate designs of the components and enclosure in order to finalize the design.
You can view the design in OnShape here.
3D printing
I 3D printed the enclosure, the mount for the front panel assembly, the motor mount, and the JST connector mount in PLA.
A more heat-resistant material like PETG would have been a much better choice, but my printer was having problems and I don’t have much experience with anything else than PLA.
Assembly
The push buttons and switch were mounted on veroboard, which was then assembled together with the LCD display on a 3D printed mount.
The component placing was a bit too close, which made assembly and wiring difficult. I was trying to keep it compact and didn’t give enough thought to wiring.
The components are all fixed except for the 12V to 5V/3V step-down converter on top of the power supply. There wasn’t any place to screw it on to.
Programming
This was my first time using MicroPython specifically, and I enjoyed it so much that I don’t want to go back to Arduino/C. (This is due to my familiarity with Python in general.) After my couple of experiences with Arduino, I didn’t expect MicroPython to be so simple. However, I do realize that a low-level language like C is necessary for advanced systems.
The code: https://github.com/n-anselm/greenhouse-automation-system
I used Thonny IDE, which seems to be the most popular IDE used for MicroPython. (I really missed the autocomplete.)
Function
There are two modes: auto and manual which are set with the switch.
Auto mode will open/close the windows based on adjustable opening and closing temperatures.
Manual mode disables temperature-based operation and allows the user to manually open or close the windows.