For those who have been following my cannabis grow journal, you'd note that a few weeks back I started monitoring my tent's temperature and humidity (and TVOC) a little more closely with the help of two Airthings Wave Minis and an Airthings Hub. I'm then collecting the data from these using a locally hosted instance of Home Assistant reaching out to the cloud and pulling down the data. While this works, it's less than ideal for a couple reasons, not the least of which being the delay in receiving accurate data.
I'm not fond of proprietary cloud-based solutions, which damn near every monitoring device seems to be these days. Moving forward, I'd like any automation I put in the grow tent (and my home) to be local, the data stored privately, the access limited, and most importantly, unable to be easily obsoleted at the whim of a third party.
In terms of what else I'd like to automate in my grow tent, I'm planning on the following, roughly in order:
- Remote controller for my two AC Infinity fans, able to be adjusted automatically or semi-automatically based on the temperature readings;
- Remote power control for the lights and fans via Home Assistant as well as energy use monitoring;
- Remote monitoring of plant moisture levels for up to 4 plants;
- Remote monitoring of PAR/PPFD light levels at multiple points in the tent;
- Remote controller for the dimmer on my Mars Hydro TSW-2000 lamp so I can adjust the light intensity remotely;
Likely the solution would have to be one or more programmable microcontrollers. I've played around with Arduino back in the day but my heap of old Arduino parts is getting a touch dated - I never had a wireless adapter/shield for it. The devices are also a bit large compared to what's available today. I know there are newer, smaller, more powerful Arduino devices but rather than stick with Arduino due to familiarity alone, I decided to investigate other solutions on the market.
Raspberry Pi, which I have some familiarity with, would definitely be powerful enough to drive just about any of the monitoring and controls I could think to build, but it's also potentially a little too heavy a hitter given it's a full-blown microcomputer running Linux that just happens to also be a microcontroller. I'm not really looking to be able to open a secure shell or run anything processor-intensive in my grow tent. What I'm looking for is a simple, low power, difficult to exploit, small footprint device that can be programmed easily to wirelessly relay data to Home Assistant.
Enter the ESPHome and the Expressif ESP32
Since my Arduino days, the Internet of Things (IoT) has taken off in wild (and scary) ways, but it has also driven the need for tiny, power-efficient microcontroller processors and boards that can operate wirelessly over WiFi, Bluetooth, and other protocols. The Expressif ESP32 is one such device, compatible (for some versions) with the Arduino development tools and only a few square cm in footprint. It supports many channels of PWM which I would need for my fan controls, I2C which I would need for my sensors, and many other features which could come in handy. It'd be simple to program, stable, and very low power.
In fact, I may not even have to program them - ESPHome is a "system to control your [ESP32] by simple yet powerful configuration files and control them remotely through Home Automation systems." In essence, if I build the circuitry attached to the ESP32 correctly, this toolset should allow me to simply create YAML configurations in Home Assistant that ESPHome will compile into instructions for the ESP32, allowing me to skip the "programming" step entirely. I'm a bit skeptical on that front, but I'm prepared to handle the programming if need be.
In any case, I've ordered some ESP32 boards from Sparkfun along with some pre-built opto-isolator circuits for controlling my fans, and I'll start there. Not being one for waiting patiently, I applied my very out-of-practice electronics training and started sketching the circuit in Fritzing. I'm not 100% sure of my pinouts or how the board versions vary yet, but it's a start. Fritzing didn't have the pre-built opto-isolator circuit in its inventory, so I copied out the opto-isolator schematic from Sparkfun.
I'm unsure yet if I want one board controlling basically everything in the tent (a single potential point of failure) or multiple single-purpose boards, but I'll figure it out.