Skip to the content
2 layers65 × 56.5 mmRpi gardener hat, the printed circuit board in 3D

Rpi gardener hat

smallwat3r/rpi-gardener9

Houseplant monitoring system using a RPi 4, a Pico, and a bunch of sensors.

Size
65 × 56.5 mm
Copper layers
2
Thickness
1.6 mm
Parts
13
Nets
12
Pads
108
Tracks, vias
56, 0
Pours
2
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
15 Jan 2024
Updated
12 Sep 2026

Overview

Rpi gardener hat is an open-source printed circuit board by smallwat3r, from the smallwat3r/rpi-gardener repository on GitHub, published under the MIT licence. It is a 2-layer board of 65 × 56.5 mm with 13 parts on 12 nets, routed with 56 tracks and 0 vias.

It is built around the DHT22. Its parts include 8 connectors and 1 IC. It belongs with the RP2040 boards of this library.

Main components

1

README

README.md

RPi Gardener

Monitor your plant environment with a Raspberry Pi 4 and Raspberry Pi Pico.

gardener

Tracks temperature, humidity, and soil moisture with a real-time web dashboard, displays, smart alerts, and more.

dashboard

Features

  • Real-time temperature and humidity monitoring (DHT22)
  • Soil moisture tracking for up to 3 plants (Pico + capacitive sensors)
  • Modern web dashboard with live charts and threshold visualization
  • Visual alerts when sensor values exceed configured thresholds
  • Password-protected admin interface to manage settings
  • 128x64 OLED displays on both RPi and Pico
  • 16x2 LCD alert display with scrolling text
  • Notifications when thresholds are crossed and when alerts resolve
  • Smart plug automation (TP-Link Kasa) for humidity control
  • Custom RPi HAT PCB and 3D-printable case (optional, can also wire manually)
  • Docker deployment

Requirements

  • Raspberry Pi 4 with Docker installed
  • Raspberry Pi Pico (connected via USB for soil moisture sensors)
  • DHT22 temperature/humidity sensor
  • 2x SSD1306 OLED displays (128x64) - one for Pico, one optional for RPi
  • 3x capacitive soil moisture sensors (v1.2)
  • 1602A LCD with I2C backpack (optional, for alert display)
  • TP-Link Kasa smart plug (optional, for automatic humidity control)

Why both a Pico and a Raspberry Pi?

The Raspberry Pi 4 doesn't have analog-to-digital converter (ADC) inputs, which are required to read capacitive soil moisture sensors. A common solution is to add an external ADC module (like the ADS1115) to the RPi's I2C bus. However, this project uses a Raspberry Pi Pico instead for several reasons:

  • Practical: I already had a Pico lying around, so why not put it to use
  • More GPIO: The Pico provides 3 ADC pins and 26 GPIO pins total, leaving plenty of room for additional sensors or peripherals without competing for the RPi's limited GPIO. Future additions like light sensors, water level sensors, or relay controls can be handled entirely by the Pico
  • Architectural separation: Keeping sensor reading on a dedicated microcontroller isolates it from the main application. The Pico handles real-time ADC sampling and display updates, while the RPi focuses on the web server, database, and notifications. If the RPi application crashes or restarts, the Pico keeps running independently
  • Network scalability: Using a Pico W instead of the standard Pico allows sensors to communicate over WiFi rather than USB serial. This enables a distributed setup where multiple Picos in different locations (greenhouse, garden beds, indoor plants) can all report back to a single RPi base station over the network

Quick Start

Deploy from your machine

First create a .env in this checkout, see Configure Environment for the values:

text
cp .env.example .env

Then, with SSH access to the Pi (Raspberry Pi OS, a user with sudo), one command provisions the host, syncs the code and starts the stack:

text
make deploy DEPLOY_HOST=pi@gardener.local

DEPLOY_HOST is anything ssh accepts, user@host, an IP, or an alias from your SSH config.

Provisioning is idempotent and covers: I2C, a 50MB journald cap and swap off (both to limit SD card wear), Docker via get.docker.com, the docker group, and the monthly Tailscale cert renewal cron. Your .env is copied to the Pi on the first deploy only, later edits are made on the Pi. Re-run make deploy to ship code changes.

The manual steps below are what make deploy does, for reference.

1. Prepare the Raspberry Pi

Enable I2C:

text
sudo raspi-config  # Interface Options -> I2C -> Enable
sudo modprobe i2c-dev
echo "i2c-dev" | sudo tee -a /etc/modules

Cap the system journal so it cannot wear the SD card (container logs are already capped in docker-compose.yml):

text
sudo mkdir -p /etc/systemd/journald.conf.d
printf '[Journal]\nSystemMaxUse=50M\n' | sudo tee /etc/systemd/journald.conf.d/sdcard.conf
sudo systemctl restart systemd-journald

2. Install Docker

text
curl -fsSL https://get.docker.com | sudo sh
sudo usermod -aG docker $USER
sudo reboot  # reboot pi

3. Configure Environment

Create a .env file:

sh
# SSL certificate (use your RPi's local IP)
CERT_IP=192.168.1.100

# Admin password for the settings UI (optional, off by default)
# When set, the settings UI asks for username "admin" and this password
ADMIN_PASSWORD=your_secure_password

# DHT22 thresholds (optional, these are defaults)
MAX_TEMPERATURE=25
MIN_TEMPERATURE=18
MAX_HUMIDITY=65
MIN_HUMIDITY=40

# Moisture thresholds (optional)
# Default for all plants
MIN_MOISTURE=30
MIN_MOISTURE_PLANT_1=25
MIN_MOISTURE_PLANT_2=30
MIN_MOISTURE_PLANT_3=35

# Notifications (optional, set to 1 to enable)
ENABLE_NOTIFICATION_SERVICE=0
# Backends: "gmail", "slack", or "gmail,slack" for both
NOTIFICATION_BACKENDS=gmail

4. Start Services

text
make up

The dashboard will be available at https://YOUR-RPI-IP/

(Accept the self-signed certificate warning in your browser)

5. Set Up the Pico

See pico/README.md for Pico installation instructions.

Commands

Production (Raspberry Pi)

bash
make up          # Start all services
make up-rebuild  # Rebuild (clears static volume for fresh FE)
make down        # Stop services
make logs        # View all logs
make logs-app    # View app container logs
make restart     # Restart services
make clean       # Stop and remove volumes
make mprestart   # Restart Pico script (if it loses sync)

Development (local machine)

Run the dashboard locally without RPi hardware. The dev environment uses mock sensors (MOCK_SENSORS=1) to generate realistic data without physical hardware.

bash
cp .env.example .env   # Configure environment
make dev               # Start dev environment
make dev-seed          # Seed database with sample data
make dev-logs          # View logs
make dev-down          # Stop dev environment
make dev-rebuild       # Rebuild after frontend changes

The dev dashboard will be available at http://localhost:5000/

Testing

bash
make devdeps     # Install dev dependencies
make test        # Run test suite
make lint        # Run linters

Pico Communication

The Pico sends moisture readings via USB serial as JSON, including raw ADC values for debugging:

text
{"plant-1": {"pct": 45.2, "raw": 29550}, "plant-2": {"pct": 67.8, "raw": 25000}, ...}

The RPi auto-detects /dev/ttyACM0 or /dev/ttyACM1 and persists readings directly to the database.

Data Management

  • Historical data is automatically deleted after the configured retention period (default: 7 days)
  • Retention period can be changed via the admin interface
  • Database persisted in Docker volume rpi-gardener-db
  • Regenerate SSL certs by removing volume: docker volume rm rpi-gardener-certs

Troubleshooting

See TROUBLESHOOTING.md for common issues and solutions.

Security

This project is designed for local home networks:

  • HTTPS with self-signed certificates
  • Dashboard is publicly accessible (read-only)
  • Settings UI is open by default, set ADMIN_PASSWORD to protect it with HTTP Basic Auth
  • Do not expose to the internet without additional security

Remote access with Tailscale (optional)

To reach the dashboard from outside your home network with a trusted (non self-signed) certificate, put the Pi on a Tailscale tailnet and let nginx serve a Tailscale-issued cert.

nginx picks the certificate by hostname (SNI): requests to your *.ts.net name get the Tailscale cert, everything else (local IP, gardener.local) keeps the self-signed cert. Nothing changes for users who don't use Tailscale.

Seed the cert once on the Pi host (Tailscale must be installed and up):

sh
./docker/tailscale-cert-renew.sh

Tailscale certs expire after 90 days. make deploy schedules the script in the root crontab to renew monthly, or add it yourself (sudo crontab -e):

cron
0 4 1 * * /path/to/rpi-gardener/docker/tailscale-cert-renew.sh >> /var/log/ts-cert.log 2>&1

The script is a no-op if Tailscale isn't installed, so it's safe to leave scheduled regardless. Certs live in the persistent rpi-gardener-certs volume, so they survive deploys and are not regenerated on make up.

Hardware Build

There are two ways to build the hardware: using a custom PCB with 3D-printed case, or manual wiring on a breadboard.

Option 1: Custom PCB Hat + Case

A custom PCB that mounts as a Raspberry Pi HAT with an integrated Pico. Includes 3D-printable base and display plates.

pcb_with_case

See hardware/README.md for:

  • PCB specifications and manufacturing files
  • 3D printable case files (OpenSCAD/STL)
  • Complete bill of materials
  • Step-by-step assembly instructions

Option 2: Manual Wiring

For prototyping or if you prefer not to use the PCB.

manual_setup

Refer to hardware/README.md for pin assignments and use the wiring diagram below as a reference.

manual_wiring

License

This project uses a dual-license structure:

Parts

13
QtyValueFootprintReferences
4MHMountingHole:MountingHole_3.2mm_M3H1, H2, H3, H4
1DHT22Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ4
1LCD_I2CConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ3
1MOIST1Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ6
1MOIST2Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ7
1MOIST3Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ8
1OLED_PicoConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ5
1OLED_RPiConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ2
1PicoRPi_Pico:RPi_Pico_SMD_THU1
1RPi_GPIOConnector_PinSocket_2.54mm:PinSocket_2x20_P2.54mm_VerticalJ1

Similar boards

  • 2 layers271.8 × 114.3 mmArdumower mega shield svn, the printed circuit board in 3D

    Ardumower mega shield svn

    Ardumower/ardumower

    Develop an open source robotic lawn mower (HW+SW reference platform)

    426 parts282
  • 2 layers104.8 × 72.1 mmSST V2 4, the printed circuit board in 3D

    SST V2 4

    mcbittech/souliss-smart-thermostat-WiFi

    ESP8266 WiFi Smart Thermostat based on Souliss IoT Framework

    53 parts110GPL-2.0
  • 2 layers40.6 × 50.8 mmIot sourdough starter monitor, the printed circuit board in 3D

    Iot sourdough starter monitor

    justinmklam/iot-sourdough-starter-monitor

    Tracking the fermentation of sourdough starter over the cloud.

    7 parts93GPL-3.0
  • 2 layers28 × 13 mmDHT22 pcb, the printed circuit board in 3D

    DHT22 pcb

    MakersAsylumIndia/M19O2

    M19O2 open source hardware Oxygen Concentrator based on the Pressure Swing Adsorption cycle aka Skarstorm cycle

    5 parts68MIT
  • 2 layers136 × 100 mmClimateSprinklerController, the printed circuit board in 3D

    ClimateSprinklerController

    kbx81/ClimateSprinklerController

    ESP32-based climate and sprinkler controller for use with ESPHome

    194 parts56
  • 2 layers162 × 60 mmEsp shield, the printed circuit board in 3D

    Esp shield

    felixwittwer/homeassistant_automaic_greenhouse

    A cool Project to make your greenhouse smart. What about automaic irrigation and collecting enviromental data right from your garden.

    20 parts27
  • 2 layers74.9 × 40.6 mmAnavi thermometer, the printed circuit board in 3D

    Anavi thermometer

    AnaviTechnology/anavi-thermometer

    WiFi Smart Thermometer with ESP8266, DHT22, DS18B20, OLED display and slots for up to 3 I2C sensor modules

    25 parts17
  • 2 layers81.3 × 36.8 mmAirQualitySensor, the printed circuit board in 3D

    AirQualitySensor

    Finomnis/AirQualitySensor

    Simple Air Quality sensor based on nRF52840, Zigbee, AM2302/DHT22 and Senseair S8

    44 parts16Apache-2.0

Questions

How big is the Rpi gardener hat PCB?

It measures 65 × 56.5 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Rpi gardener hat use?

13 parts, built around the DHT22. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Rpi gardener hat KiCad files?

From the smallwat3r/rpi-gardener repository on GitHub, at the commit this page was made from: the board is hardware/kicad/rpi-gardener-hat.kicad_pcb and its schematic hardware/kicad/rpi-gardener-hat.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Rpi gardener hat design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).