How to customize a personal plant health steward(arduino) - XIAO Soil Moisture sensor - lsw031105guge-bit - CodeCraft Hub
Scene: Agriculture. Edge AI application on CodeCraft Hub for Agriculture use cases.
Devices / BOM: XIAO Soil Moisture sensor
Agriculture application on CodeCraft Hub. This Arduino firmware is for XIAO ESP32 and Seeed Studio Soil Moisture Sensor, connecting to Home Assistant. It collects real-time moisture data, provides LED indication, supports WiFi provisioning, and allows custom ADC calibration and humidity thresholds for smart plant care.
Deploy steps
- 1.Import Core Library
Soil Moisture Sensor
The official library is large—no need to import all of it. Extract only the "Arduino HA section" (the folder you need), compress it to.zip.
In Arduino, go to "Sketch → Include Library → Add.ZIP Library" and import the compressed file.
- 2.Install Dependent Libraries
You’ll need two more libraries to avoid compilation errors. Search for and install them via Arduino’s Library Manager:
Software Dependencies: ArduinoJson (by Benoit Blanchon)
Software Dependencies: WebSockets (by Markus Sattler)
- 3.Compile
Open your modified code (minimum system + HA code) and click "Verify" in Arduino. If no errors, enter Boot Mode (per Step Three) and re-upload.
After uploading, verify again via serial monitor to ensure humidity data displays correctly with no errors.
- 4.Setup Prep
After restarting, the sensor will broadcast a WiFi hotspot named "Seeed_TempHum_AP" (pre-set in code—you can change it)
- 5.Connect to Hotspot
Use your phone or computer to find and connect to the hotspot (enter the password—you can change it in code too).
- 6.Setup Success
The ESP32-C6 will restart. Check the serial monitor—you’ll see setup success messages.
Now the sensor is connected to your home WiFi and ready to upload humidity data to HA.