温室まるごと自動化(入門) ・ 智能温室入门
Sense temp/humidity, water on dry soil, and ventilate. The showcase build.
温湿度を測り、土が乾けば水やり、暑くなればファン。温室自動化の入り口。Port.A(I2C)とPort.B(アナログ)を使い分け。
测温湿度、土干则浇水、过热则通风。温室自动化入门,分别使用 Port.A(I2C) 与 Port.B(模拟)。
| Part | Role | Ports | Links |
|---|---|---|---|
| M5Stack CoreS3 | Controller | grove_i2c, grove_analog, grove_uart, mbus, usb_c, sdcard | official page |
| Unit PaHub2 | I2C hub (1→6) | grove_i2c | official page |
| Unit ENV III | Temp / humidity / pressure | grove_i2c | official page |
| Unit CO2 | CO2 sensor | grove_i2c | official page |
| Unit Watering | Moisture sensor + pump | grove_analog | official page |
Build a smart greenhouse starter with M5Stack. The CoreS3 reads temperature, humidity, and pressure from the ENV III sensor, watches soil moisture with the Watering unit, and turns on the Fan unit when it gets too hot. The screen shows live readings and the pump waters when the soil is dry. Everything connects with plug-in Grove cables, so no soldering is needed.
# Smart greenhouse starter for M5Stack CoreS3
# ENV III + Fan share the red I2C bus; Watering uses the black analog port.
import time
from machine import ADC, Pin
from M5 import Lcd
import M5
# Library names vary by firmware; adjust if your version differs.
from unit import ENVUnit, FanUnit # I2C units on Port.A
M5.begin()
env = ENVUnit() # temperature / humidity / pressure
fan = FanUnit() # ventilation fan
moist = ADC(Pin(8)) # Watering moisture sensor on Port.B
moist.atten(ADC.ATTN_11DB) # read full 0-3.3V range
TEMP_ON = 28 # fan turns on above 28 C
DRY = 1500 # below this ADC value = dry soil (tune for your sensor)
while True:
t = env.read_temperature()
h = env.read_humidity()
soil = moist.read() # raw 0-4095; lower = wetter (typical)
fan.set_state(t > TEMP_ON) # auto ventilation
pump_on = soil < DRY # water when dry
# NOTE: pump control depends on your Watering unit firmware API.
# Many versions expose a digital output pin; keep it simple here.
Lcd.clear()
Lcd.setCursor(10, 20)
Lcd.print('Temp: %.1f C' % t)
Lcd.setCursor(10, 50)
Lcd.print('Humi: %.0f %%' % h)
Lcd.setCursor(10, 80)
Lcd.print('Soil: %d' % soil)
Lcd.setCursor(10, 110)
Lcd.print('Fan:%s Pump:%s' % ('ON' if t>TEMP_ON else 'off',
'ON' if pump_on else 'off'))
time.sleep(2)
UnitKit — describe what you want to build, get a parts list and wiring diagram.