Is Capacitive Soil Moisture Sensor v1.2 Compatible with Home Assistant (ESPHome)?
Variants covered by this page
v1.2 Capacitive Soil Moisture Sensor v1.2
v2.0 Capacitive Soil Moisture Sensor v2.0
Electrical Specifications
Always confirm pin assignments against the manufacturer datasheet before wiring.
Compatibility Overview
Corrosion-resistant capacitive soil moisture sensor for garden irrigation automation plant hydration alerts and greenhouse monitoring.
Wiring Capacitive Soil Moisture Sensor v1.2 to ESP32
| Module pin | ESP32 | Note |
|---|---|---|
| VCC | 3V3 | The board's 662K 3.3V regulator is below its rated input once the supply drops under about 3.4V, so on the 3V3 rail the probe runs on roughly what the rail gives it. The analogue output tracks that supply — calibrate on the node the probe will actually run on. |
| AOUT | GPIO34 | ADC1 channel 6, an input-only pin. Keep the probe on ADC1 (GPIO32 to GPIO39): ADC2 is shared with the Wi-Fi radio. |
| GND | GND | |
| Blade | soil | In as far as the bottom of the components and no further, with soil pressed firmly against both faces. An air gap against the blade reads as dry. |
Host pins are the ones the configuration on this page uses. Move a pin here and change it in the YAML — they are documented together so they cannot disagree.
Technical Specification Matrix
| Feature / Attribute | Specification / Status |
|---|---|
| Hardware Protocol | Analog ADC / 3.3V |
| Bridge Required | NO |
| Border Router Needed | None |
| Hardware Capabilities & Peripherals | Soil Moisture (%) Note: these entities come from the ESPHome configuration you flash — each one needs its matching component in that YAML before it appears. |
| Pairing Complexity | Plug-and-Play |
| Factory Reset Instruction | Hold BOOT button for 3s. |
Wire, Flash, Adopt, Check
Wire it up
Follow the wiring table above. The ESP32 pins there are the ones the configuration uses, so if you move one, change it in both places.
Flash the configuration
Create a new device in the ESPHome dashboard (the Home Assistant add-on) and paste the configuration below into it, or save it as emb_esp32_soilmoisture_ha.yaml and run esphome run emb_esp32_soilmoisture_ha.yaml. The first flash goes over USB. If it is not detected, hold BOOT button for 3s to put it in download mode. Every update after that is over the air.
Adopt it in Home Assistant
Settings → Devices & Services. A node on the same network shows up as a discovered ESPHome device within a minute of joining Wi-Fi; choose Configure and enter the API encryption key from your secrets.yaml. If discovery does not find it, add the ESPHome integration by hand with the node's IP address.
Check it works
Once calibrated, Soil Moisture reads near 0% with the blade in air and near 100% in a glass of water, and watering a pot shows a clear step within an update or two. A reading that never changes is usually an NE555 that is not oscillating or AOUT on the wrong pin; one far below 0% in air that takes minutes to register water is the missing R4 ground.
ESPHome Configuration
Starting configuration for Capacitive Soil Moisture Sensor v1.2 on ESP32. Untested on hardware — verify wiring and pins against your own board.
# ESPHome configuration for Capacitive Soil Moisture Sensor v1.2
# Host: ESP32. Pin numbers below are host-side defaults — any free
# GPIO will do, and you should change them to match your own wiring.
esphome:
name: emb_esp32_soilmoisture_ha
friendly_name: "Capacitive Soil Moisture Sensor v1.2"
esp32:
board: esp32dev
framework:
type: esp-idf
logger:
api:
encryption:
key: !secret api_encryption_key
ota:
- platform: esphome
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
sensor:
- platform: adc
pin: GPIO34
name: "Soil Moisture"
attenuation: 12db
update_interval: 60s
filters:
# Calibrate against your own probe: reading in air, then in water.
- calibrate_linear:
- 2.60 -> 0.0
- 1.10 -> 100.0
unit_of_measurement: "%"
Before you flash:
the !secret values come from your
secrets.yaml, and the GPIO numbers are host-side
defaults rather than properties of this part — change them to match how you actually wired it.
What Appears in Home Assistant
A percentage, from the ADC voltage through a two-point calibrate_linear filter: 2.60V is 0% and 1.10V is 100%. Those are starting values, not your probe's. The filter is a straight line, so a reading drier or wetter than either point carries on past 0% or 100%; a clamp filter after it holds the value in range.
Not in the config. Calibration needs the raw volts, which the filtered sensor hides: comment out filters: and unit_of_measurement: for one flash and the same sensor reports volts.
Known Problems and Fixes
Calibrate the probe you have
The config's 2.60V and 1.10V are placeholders, and a real probe can sit well away from them. With the filters commented out, note the voltage with the blade in air and in a glass of water up to the components, and put those two numbers into calibrate_linear. Dry and saturated soil make better end points than air and water, if you can arrange them.
Look at the timer chip
The v1.2 design uses a TLC555, a CMOS timer that runs happily at 3.3V. Some boards arrive with an NE555 in its place, which is out of specification at 3.3V, and many of those do not work there at all. The part number is on the eight-pin chip; an NE555 board is one to send back, not to debug.
The missing ground on R4
On many boards the 1MΩ resistor that bleeds the output down is not connected to ground. The probe then reads close to its supply in air and is slow to register water. A 1MΩ resistor soldered from AOUT to GND stands in for it.
Seal the top and the cut edges
The solder mask protects the faces of the blade, but the components above it are bare, and the cut edges of the board wick water into the fibreglass. Coat the edges and pot the electronics in epoxy; heatshrink over the top works for about a year and then lifts away.
Slow to follow a change
Moved from dry to wet, the output can take more than half a minute to settle. At the config's 60s update interval that makes no difference; on the bench it looks like a dead sensor. Give it time before deciding.
Why 12db
At the ESP32's lower attenuations the ADC tops out between about 1.1V and 2.2V, below a dry probe's output. attenuation: 12db reads up to roughly 3.1V, which covers the probe; one that sits above that in air saturates, and every dry reading comes out the same.
Report a Pinout Error or Submit Tested Code Snippets
Found a pin mapping quirk or built a custom ESPHome YAML driver for Capacitive Soil Moisture Sensor v1.2? Submit a pull request or report corrections to our index.
Hardware Correction Reporter (emb-esp32-soilmoisture-ha)
Frequently Asked Questions
Does Capacitive Soil Moisture Sensor v1.2 work without an internet connection?
How is Capacitive Soil Moisture Sensor v1.2 powered and wired to the host board?
How does the host board reach Home Assistant (ESPHome)?
Alternatives
RS485 NPK Soil Sensor (EC/Temp/Moisture)
An industrial-style Modbus RS485 probe that reports moisture together with soil temperature and conductivity.
DS18B20 Waterproof Temperature Probe
The waterproof DS18B20 probe, for soil temperature on the same node.
Flood & Water Leak Resistance Detector
If the only question is whether the saucer is full, a two-contact water probe answers it without calibration.