AloT Smart Flowerpot

Overview

The Smart Flowerpot automatically detects ambient temperature, air humidity, light level, soil moisture, and water tank level. When the soil gets too dry, it automatically turns on the pump to water the plant. An OLED screen displays current readings, while an RGB LED and buzzer provide status alerts. When paired with a "XiaoZhi AI host," you can also remotely query the flowerpot status, manually water, set automatic watering strategies, and calibrate the soil sensor.

No advanced coding experience is required. The course begins with basic setup and simple experiments before moving into complete projects. Applicable project: PIO-esp32-espnow-flowerpot

Learning Materials

Insight1 LMS
Insight1 LMS

Log-in on our learning management system to access all the course materials to aid your learning. The video lessons, quizzes, project code, and instructional materials are housed together inside our LMS. This keeps the learning journey organized and makes it easy for learners to move between lessons, review previous topics, and access the resources they need while completing each activity.

Access Course Materials
You can create an account or use your Google account to login.

Core Capabilities

Environmental Monitoring
Trigger: Auto-runs on power-up
OLED shows temperature, humidity, light, soil moisture, water level, and pump status
Automatic Watering
Trigger: Soil moisture drops below threshold
Relay activates the pump; auto-stops when time is up or soil becomes moist
Safety Protection
Trigger: Water tank runs low
Pump start is blocked; watering in progress stops immediately; RGB flashes purple
Wireless Control
Trigger: XiaoZhi host sends commands
Query status, manual watering, timed watering, set auto-watering, calibrate, mute

Software Installation

1
Install VS Code
  • Visit https://code.visualstudio.com/
  • Download version for your OS
  • Double-click installer and follow prompts
  • Open VS Code after installation
2
Install PlatformIO
  • Open VS Code → Extensions panel
  • Search for "PlatformIO IDE"
  • Click Install, wait for completion
  • Ant icon appears on left sidebar
3
Install USB Drivers
  • Common chips: CH340, CP2102
  • Search and install CH340 or CP2102 driver
  • Use a USB data cable
  • Try different USB ports
4
Open Project
  • File → Open Folder in VS Code
  • Select: PIO-esp32-espnow-flowerpot
  • Verify: platformio.ini, include/, src/
  • PlatformIO auto-installs dependencies

Hardware Wiring

Core Hardware Required

ESP32-S3 Dev Board
1 unit
The brain of the project
DHT20 Sensor
1 unit
Temperature & Humidity
BH1750 Light Sensor
1 unit
I2C interface
1.3" OLED Display
1 unit
SH1106 128×64
HD-38 Soil Sensor
1 unit
Analog output AO
XKC-Y21 Water Level
1 unit
Non-contact detection
5V Relay Module
1 unit
Single-channel
5V Water Pump
1 unit
Low-voltage DC pump
WS2812B RGB LED
1 unit
Status indicator

Wiring Steps

Step 1: Connect I2C Sensors & OLED
  • DHT20, BH1750, OLED share the same I2C bus
  • All SDA → GPIO17
  • All SCL → GPIO18
  • All VCC → 3.3V, All GND → GND
Step 2: Connect Soil Moisture Sensor
  • HD-38: VCC → 3.3V, GND → GND
  • AO → GPIO4 (DO leave unconnected)
  • Uses analog output, safe range 0–3.3V
Step 3: Connect Water Level Sensor
  • XKC-Y21: Attach to outside of water tank
  • OUT → GPIO5, VCC → 3.3V, GND → GND
  • GPIO5 HIGH: normal, LOW: low water
Step 4: Connect RGB LED & Buzzer
  • WS2812B: DIN → GPIO48, VCC → 5V, GND → GND
  • Buzzer: Positive/IO → GPIO7, GND → GND
  • LEDs are directional — data enters through DIN
Step 5: Connect Relay & Pump
  • Relay control: VCC → 5V, GND → GND, IN → GPIO6
  • Switching: COM → 5V+, NO → Pump+, Pump- → GND
  • ⚠️ Only 5V DC — never connect to mains power!
Step 6: Pre-Power Checklist
  • OLED, DHT20, BH1750 all connected to 3.3V
  • HD-38 AO → GPIO4, Relay IN → GPIO6
  • All GNDs share common ground
  • Tubing secured away from electronics

RGB LED Status Guide

Red Flashing
Soil too dry, entering ALERT
Purple Flashing
Water tank low
Blue Breathing
Currently watering

XiaoZhi AI Module

XiaoZhi AI Module
Pairing with XiaoZhi AI
  1. Power on both the Smart Flowerpot and the XiaoZhi host
  2. Enter pairing or device scanning mode on the host
  3. Host discovers: device_type: flower_pot, name: smart-flowerpot
  4. Host initiates binding, flowerpot shows "Bound"
  5. Host runs TRY or RE_TRY to test the link
Commands XiaoZhi Can Send
INFO_Request
Query temperature, humidity, light, soil moisture, watering status
FLOWER_WateringSwitch
Manually turn pump ON/OFF
FLOWER_AutoWatering
Set auto-watering thresholds and cooldown
FLOWER_SoilCalibrate
Record current ADC reading as dry/wet point

Troubleshooting

Software Issues

No PlatformIO Icon
Cause: PlatformIO extension not installed
Solution: Install PlatformIO IDE extension in VS Code
Compile Error
Cause: Dependency libraries not installed
Solution: Stay online, reopen project, wait for auto-install
Upload Stuck
Cause: Board not in download mode
Solution: Hold BOOT while uploading, release once writing starts
No Serial Port
Cause: USB cable or driver issue
Solution: Use data cable, install CH340/CP2102 driver

Sensor Issues

OLED Dark
Cause: Wrong address or reversed wiring
Solution: Confirm SH1106 at 0x3C, check SDA/SCL
OLED Garbage
Cause: Display is not SH1106
Solution: If SSD1306, change OLED driver code
Soil Value Static
Cause: Sensor not in soil or loose wiring
Solution: Insert probe into soil, check connections
Relay Not Clicking
Cause: Wrong GPIO or reversed logic
Solution: Adjust RELAY_ON_LEVEL in config.h