# Greenhouse monitor with ESP32 gateway and ATmega sensor nodes

An open hardware smart agriculture system: an ESP32 gateway with six onboard relays and an LCD menu, linked by 2.4 GHz radio to battery-powered ATmega8 nodes that read capacitive soil moisture probes.

- Category: Code (build)
- Made by: [La Văn Thịnh (vthinh-la)](https://github.com/vthinh-la) on GitHub
- Original: https://github.com/vthinh-la/smart-agriculture-iot-system
- On Afterware: https://afterware.xyz/p/greenhouse-monitor-with-esp32-gateway-and-atmega-sensor-nodes

## Can I build this?

- Difficulty: Expert
- AI-buildability: 3/5 (The firmware is well suited to AI help, but fabricating and assembling the custom PCBs and relay driver stage takes real hands-on work.)
- Time: A few weekends for one gateway and node,
- Cost: $80–150
- Parts: ESP32-WROOM-32 DevKit, ATmega8A, ATmega88V, NRF24L01+ module, Omron G5LE-14 relay, ULN2003APG, LM2596-5.0V, AMS1117-3.3V, DHT11, MQ-135
- Tools: soldering iron, 3D printer, PCB fabrication service or etching suppl, USB programmer, multimeter

Estimates based on the original write-up.

## Build sheet

- Gateway: ESP32-WROOM-32 DevKit
- Nodes: ATmega8 / ATmega88 + NRF24L01
- Outputs: 6x Omron G5LE-14 relays
- Firmware: PlatformIO / Arduino IDE

## Starter prompt

```
Based on "Greenhouse monitor with ESP32 gateway and ATmega sensor nodes" on Afterware: https://afterware.xyz/p/greenhouse-monitor-with-esp32-gateway-and-atmega-sensor-nodes

Write PlatformIO firmware for an ESP32 DevKit V1 that reads a DHT11 on GPIO32 and a 16x2 I2C LCD at address 0x27. Add four buttons for a menu to set humidity thresholds, and drive a relay on a GPIO with hysteresis control. Receive soil moisture packets from an NRF24L01 module on SPI, using a 2.4 GHz channel and a simple struct payload.
```

## Story

The project is a full greenhouse monitoring and irrigation system, not a single device. A central gateway built on an ESP32-WROOM-32 board handles WiFi, a Blynk cloud dashboard, and web OTA updates. It reads a DHT11, float switch, MQ-135 air quality sensor, pH probe and BH1750 light sensor, and drives six Omron G5LE-14 relays through a ULN2003 driver for pumps, misting, a fan, heating and lighting. A 16x2 I2C LCD and four buttons let the operator set thresholds locally.

Field sensing runs on separate nodes. Each node uses an ATmega8 or ATmega88 running from its internal 8 MHz oscillator, with a 18650 Li-ion cell and TP4056 charging, and up to six capacitive soil moisture probes. The nodes send periodic packets back to the gateway over NRF24L01 radios.

The repository includes EasyEDA and Sprint-Layout PCB sources, Gerbers, 3D printable enclosures and brackets, PlatformIO and Arduino IDE firmware, and documentation covering assembly, wiring, testing and known issues. The hardware is released under the MIT license.

## Resources

- [Repository](https://github.com/vthinh-la/smart-agriculture-iot-system)
- [Creator profile](https://github.com/vthinh-la)
- [PlatformIO IDE](https://platformio.org/)
- [Arduino IDE 2.x](https://www.arduino.cc/en/software)

Tags: esp32, atmega8, nrf24l01, soil moisture, greenhouse, pcb, open hardware

AI assistants can search all Afterware builds through the MCP server at https://afterware.xyz/mcp (setup: https://afterware.xyz/agents).
