Broken image

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:

image


Basic setup

image


Components


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).

image

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.

image image image


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.

image image

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.

image image image


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.

image

Manual mode disables temperature-based operation and allows the user to manually open or close the windows.

image