caneast-site1-ot1-snr01 — sump pit sensor node
Document control
| Field |
Value |
| Version |
0.4 |
| Status |
In progress — hardware installed, pending physical mount |
| Last updated |
2026-04-11 |
| Repo |
archon-apps |
| Path |
ot/docs/caneast-site1-ot1-snr01.md |
Overview
Basement sump pit monitor. Tracks water level, flood/rain condition, and pump vibration. Publishes all sensor data via MQTT to the CanEast OT pipeline.

Hardware
| Component |
Part |
Status |
| Microcontroller |
ESP32 dev board (30-pin, ESP-WROOM-32) |
Installed |
| Breadboard |
830-point solderless |
Installed — to be replaced |
| Breakout board |
Create Idea 30-pin GPIO 1-to-2 |
Installed |
| Level sensor |
HC-SR04 ultrasonic |
Installed |
| Level sensor (planned) |
JSN-SR04T waterproof ultrasonic |
Pending — replacement for HC-SR04 before permanent sump pit install |
| Rain/flood sensor |
MH-RD rain sensor module (LM393 comparator, AO + DO) |
Installed |
| Vibration sensor |
MPU-6050 GY-521 accelerometer/gyroscope |
Installed and running |
| Enclosure (ESP32) |
Repurposed router shell, wall-mounted |
Pending |
| Enclosure (MPU-6050) |
Tic Tac plastic box, hot-glued rigid, zip-tied to pump housing |
Pending — mount for vibration detection via rigid pipe coupling |
| Mini breadboard |
ELEGOO 170 tie-point (GND bus) |
Replaced by Create Idea breakout board |
Physical installation
See ot/docs/sump-install.svg for full diagram.
ESP32 enclosure
- Mounted on basement wall adjacent to sump pit
- Dry zone — above flood line at all times
- USB 5V powered from wall outlet
- Wire exits through small drilled holes toward pit
HC-SR04 (water level)
- Mounted on underside of pit lid
- Pointing straight down toward water surface
- Distance from sensor face to dry pit floor = baseline (max reading)
- Distance to alarm threshold configured in firmware
Rain/flood sensor
- Mounted on pit interior wall
- Positioned above pump trigger level, below alarm threshold
- AO pin (0–4095): raw moisture analog reading
- DO pin (0/1): threshold-triggered digital alarm
- Note: this is one module with two outputs — not two separate sensors
MPU-6050 (pump vibration)
- Enclosed in Tic Tac plastic box (non-conductive, splash resistant)
- Zip tied to exhaust pipe above pit lid — always dry
- Detects pump motor vibration through rigid pipe coupling
- Abnormal FFT signature indicates clogging or bearing wear
Wiring
ESP32 pin assignments
| GPIO |
Function |
Sensor pin |
Notes |
| D5 |
HC-SR04 TRIG |
TRIG |
|
| D18 |
HC-SR04 ECHO |
ECHO |
|
| D23 |
Rain sensor digital |
DO |
Active-LOW flood alarm |
| D34 |
Rain sensor analog |
AO |
Input-only GPIO, no internal pullup |
| D21 |
MPU-6050 SDA |
SDA |
I2C data |
| D22 |
MPU-6050 SCL |
SCL |
I2C clock |
| AD0 |
MPU-6050 I2C addr select |
GND |
Locks I2C address to REDACTED |
| 3V3 |
Power rail |
VCC (all sensors) |
|
| GND |
Ground rail |
GND (all sensors) |
|
Note: XDA, XCL, INT on MPU-6050 are not connected.
Breadboard layout
- ESP32 dev board dev board in center of 830-point breadboard
- Create Idea 30-pin GPIO breakout board expands each pin to 2 tie points
- ELEGOO 170-point mini breadboard used as dedicated GND/3V3 bus
- HC-SR04, rain sensor module, MPU-6050 all on main board
- Sensor heads exit enclosure via wire leads through drilled holes
Legacy breadboard wiring (pre-breakout)
| Pin |
Breadboard location |
| HC-SR04 TRIG (D5) |
BB1-I8 |
| HC-SR04 ECHO (D18) |
BB1-I9 |
| HC-SR04 VIN |
BB2-C1 |
| HC-SR04 GND |
BB2-C2 |
| HC-SR04 VCC |
BB2-C27 |
| HC-SR04 TRIG pin |
BB2-C26 |
| HC-SR04 ECHO pin |
BB2-C25 |
| HC-SR04 GND pin |
BB2-C24 |
Firmware
| Attribute |
Value |
| Toolchain |
PlatformIO + VS Code |
| Framework |
framework-arduinoespressif32 v3.20017.241212 |
| Path |
ot/esp32/caneast-site1-ot1-snr01-sump/ |
| Libraries |
knolleary/PubSubClient@^2.8, rfetick/MPU6050_light@^1.1.0 |
| Monitor speed |
115200 baud |
| Publish interval |
Sensor loop: 10 s — IMU loop: 5 s (independent) |
| IMU calibration |
mpu.calcOffsets(true, true) runs at boot — recalibrate if sensor is physically moved |
| Watchdog |
Deferred — API incompatible with framework v3.20017.241212 |
Flash procedure (WSL)
usbipd bind --busid 9-1 --force
usbipd attach --wsl --busid 9-1
sudo modprobe cp210x
sudo chmod a+rw /dev/ttyUSB0
pio run --target upload --upload-port /dev/ttyUSB0
MQTT topics
| Topic |
Direction |
Description |
Payload |
Interval |
| caneast/ot-zone/snr01/level |
publish |
Water distance from HC-SR04 |
mm float, -1 on timeout |
10 s (only if delta ≥ 5 mm) |
| caneast/ot-zone/snr01/rain |
publish |
Rain sensor analog raw |
integer 0–4095 (0=wet, 4095=dry) |
10 s |
| caneast/ot-zone/snr01/flood |
publish |
Flood alert |
"1" or "0" (floodSensor OR levelAlarm) |
10 s |
| caneast/ot-zone/snr01/imu/accel |
publish |
Accelerometer |
JSON {"x":0.00,"y":0.00,"z":0.00} m/s² |
5 s |
| caneast/ot-zone/snr01/imu/gyro |
publish |
Gyroscope |
JSON {"x":0.00,"y":0.00,"z":0.00} deg/s |
5 s |
| caneast/ot-zone/snr01/imu/temp |
publish |
IMU die temperature |
float °C |
5 s |
| caneast/ot-zone/snr01/status |
publish |
Firmware status |
"online" (retained) / "offline" via LWT |
on connect |
| caneast/ot-zone/snr01/rssi |
publish |
WiFi signal strength |
dBm integer |
10 s |
| caneast/ot-zone/snr01/cmd |
subscribe |
Command inbound |
string (stub — no dispatch implemented) |
on receipt |
Flood logic
- levelAlarm is active: fires when
distanceMM > 0 AND distanceMM < 200.0 mm (water surface within 200 mm of sensor face)
- Calibration note: 200.0 mm threshold observed to cause false alarms when HC-SR04 reports 195.9 mm in a dry pit. Recommend reducing threshold to ~150 mm before permanent installation.
- floodSensor reads PIN_FLOOD (D23, active-LOW); uses a 2-read debounce —
floodCount must reach 2 on consecutive 10 s cycles before alerting
- floodAlert =
floodSensor OR levelAlarm — published on caneast/ot-zone/snr01/flood every 10 s
Node identity
| Attribute |
Value |
| Node ID |
caneast-site1-ot1-snr01 |
| Hardware |
ESP32 dev board (ESP-WROOM-32, 30-pin) |
| IP |
REDACTED |
| MAC |
REDACTED-MAC |
| Location |
Basement — sump pit |
| I2C address (MPU-6050) |
REDACTED |
Pending work
- [x] Receive breakout board (Create Idea 30-pin); ELEGOO 170 mini breadboard replaced by breakout
- [x] Receive MPU-6050 GY-521
- [x] Consolidate to single breadboard using breakout board
- [x] Wire rain sensor AO to D34, DO to D23
- [x] Wire MPU-6050 SDA/SCL to D21/D22
- [x] Update firmware for MPU-6050 I2C + rain sensor analog reads
- [x] Add MQTT topics for rain and IMU (imu/accel, imu/gyro, imu/temp)
- [x] Re-enable levelAlarm in firmware (active at < 200 mm)
- [ ] Order and install JSN-SR04T waterproof ultrasonic (replacement for HC-SR04 before permanent install)
- [ ] Mount HC-SR04 to pit lid underside
- [ ] Mount rain/flood sensor to pit wall above trigger level
- [ ] Mount MPU-6050 in Tic Tac box, hot-glued rigid, zip-tied to pump housing
- [ ] Mount ESP32 enclosure on wall
- [ ] Add FFT vibration analysis to firmware
- [ ] Clean up esp1_sensors junk data in InfluxDB
- [ ] SentinelBot Telegram alert via Node-RED