Is Tipping Bucket Rain Gauge Sensor Compatible with Home Assistant (ESPHome)?
Electrical Specifications
Always confirm pin assignments against the manufacturer datasheet before wiring.
Compatibility Overview
Magnetic reed switch tipping bucket rain collector measuring real-time rainfall rate and daily accumulation.
Wiring Tipping Bucket Rain Gauge Sensor to ESP32
| Module pin | ESP32 | Note |
|---|---|---|
| RJ11 centre conductor | GPIO27 | The gauge is a reed switch across the two centre conductors of its RJ11 lead, and it has no polarity: either one can go to the GPIO. The config turns on the internal pull-up, so the pin idles high and each tip pulls it to ground for a moment. |
| Other centre conductor | GND | |
| Outer RJ11 positions | unconnected | The switch is only on the centre pair. |
| Supply | none | A magnet and a reed switch: nothing in the gauge needs power. The only 3.3V involved is the pull-up. |
| 10kΩ resistor (optional) | GPIO27 to 3V3 | Worth fitting when the lead runs a long way outdoors. The internal pull-up is weak, and a long unshielded cable picks up enough noise to count tips that never happened. |
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 | Pulse Counter GPIO / 3.3V |
| Bridge Required | NO |
| Border Router Needed | None |
| Hardware Capabilities & Peripherals | Rainfall Rate (mm/h) Rainfall Total (mm) 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_rain_gauge_ha.yaml and run esphome run emb_esp32_rain_gauge_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
Tip the bucket once by hand with the node running: at the next update Rainfall Rate reads 18mm/h for that minute, then returns to 0, and Rainfall Total goes up by 0.3. A total that goes up by 0.6 for a single tip is contact bounce; nothing at all is the wrong pair of RJ11 conductors or a dead reed switch; rain recorded in dry weather with nobody touching the gauge is noise on a long lead, which the external pull-up fixes.
ESPHome Configuration
Starting configuration for Tipping Bucket Rain Gauge Sensor on ESP32. Untested on hardware — verify wiring and pins against your own board.
# ESPHome configuration for Tipping Bucket Rain Gauge Sensor
# 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_rain_gauge_ha
friendly_name: "Tipping Bucket Rain Gauge Sensor"
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
# A reed switch closes once per bucket tip. 0.3mm per tip is the MISOL-type
# gauge; SparkFun's weather meter gauge is 0.2794mm. Both multipliers come
# from that figure: the rate is tips/min x 0.3 x 60, the total is tips x 0.3.
sensor:
- platform: pulse_counter
pin:
number: GPIO27
mode:
input: true
pullup: true
name: "Rainfall Rate"
unit_of_measurement: "mm/h"
device_class: precipitation_intensity
accuracy_decimals: 1
filters:
- multiply: 18
total:
name: "Rainfall Total"
unit_of_measurement: "mm"
device_class: precipitation
accuracy_decimals: 1
filters:
- multiply: 0.3
update_interval: 60s
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
mm/h. pulse_counter counts tips per minute, and the multiply: 18 filter turns that into millimetres an hour for a gauge that empties 0.3mm a tip (0.3 × 60).
Millimetres since boot, from the counter's total: block with multiply: 0.3. It carries accuracy_decimals: 1 because the total defaults to whole numbers, and a single 0.3mm tip would display as 0. It is total_increasing, so a Utility Meter helper in Home Assistant with a daily cycle turns it into rain today.
Known Problems and Fixes
The multipliers are the calibration
pulse_counter reports tips per minute whatever the update_interval, so both numbers in the config come from the millimetres per tip: 18 on the rate is that figure × 60, and 0.3 on the total is the figure itself. A gauge with a different bucket needs both changed together, or the rate and the total stop agreeing.
0.3mm or 0.2794mm per tip
MISOL lists this gauge at 0.3mm a tip, which is what the config assumes; the SparkFun weather meter sheet, for a similar-looking gauge, gives 0.2794mm (0.011 inch). Neither is exact for your unit. Measure the funnel opening, pour a known volume in slowly and count the tips: rainfall in millimetres is 10 × millilitres ÷ the opening area in cm², and that divided by the number of tips is the figure for both multipliers.
A one-minute rate is coarse
At a 60s update_interval a single tip is the smallest step the rate can take — 18mm/h on a 0.3mm gauge, then straight back to zero. A longer interval, 15 minutes say, averages the tips into a rate that means something. The alternative is to leave the rate alone and put a Derivative helper on the total in Home Assistant.
The hardware filter cannot debounce a reed
On an ESP32 the counter runs on the PCNT peripheral, and ESPHome rejects an internal_filter above 13µs with it — far shorter than a mechanical contact takes to settle. If one tip ever counts as two, set use_pcnt: false, which allows a longer filter in software. Keep that filter shorter than the closure itself: the software filter also drops the edge that ends a closure shorter than it, and that is the edge the config counts.
The total starts again at boot
The count lives in RAM. A total_increasing sensor copes — Home Assistant's statistics treat the drop to zero as a meter reset — but the node itself cannot tell you last week's rainfall after a restart.
Level, open sky, clean funnel
The bucket calibration assumes the gauge is level; tilted, one side fills sooner than the other. Mount it clear of walls, roofs and trees that shelter it or drip into it, and check the funnel for leaves and insects — a blocked funnel reads zero through a storm.
Report a Pinout Error or Submit Tested Code Snippets
Found a pin mapping quirk or built a custom ESPHome YAML driver for Tipping Bucket Rain Gauge Sensor? Submit a pull request or report corrections to our index.
Hardware Correction Reporter (emb-esp32-rain-gauge-ha)
Frequently Asked Questions
Does Tipping Bucket Rain Gauge Sensor work without an internet connection?
How is Tipping Bucket Rain Gauge Sensor powered and wired to the host board?
How does the host board reach Home Assistant (ESPHome)?
Alternatives
YF-S201 Water Flow Meter Sensor
A turbine flow meter on pulse_meter: the same pulse counting for water in a pipe, with the conversion already in the config.
Flood & Water Leak Resistance Detector
A wet-or-dry probe says it has started raining at the first drops, well before the bucket has collected enough to tip.
BME280 Temp Humidity & Pressure Sensor
Temperature, humidity and pressure on I2C, for the rest of a weather station on the same node.
AS3935 Franklin Lightning Sensor
Lightning detection with an estimated storm distance, if the node is watching the weather rather than only the rain.