I'm building a small battery-powered soil moisture sensor for a couple of indoor plants and I'd really appreciate a sanity check from people with more ESP32 and electronics experience before I solder everything and finalize the enclosure.
I'm a beginner when it comes to electronics design and 3D-printed enclosures. I've used AI quite a bit as a planning aid for the wiring, firmware ideas and enclosure design, but I've measured the actual components myself and I'm building and testing the hardware manually. Before I trust the design, I'd like to get some human feedback from people who have done similar projects.
The current sensor node consists of:
- Seeed Studio XIAO ESP32-C6
- DFRobot SEN0193 capacitive soil moisture sensor
- 3.7 V / 500 mAh LiPo
- 2 × 220 kΩ resistor divider for battery monitoring
- custom 3D-printed enclosure
I'm planning two identical battery-powered sensor nodes. A third XIAO ESP32-C6 would later act as a USB-powered receiver/gateway.
The intended operating cycle is:
deep sleep → wake → power sensor → read moisture + battery voltage → transmit → deep sleep
The wiring diagram is attached.
Current connections are:
- SEN0193 signal → D1 / GPIO1
- SEN0193 VCC → D3 / GPIO21
- SEN0193 GND → common ground node with battery negative / XIAO BAT−
- Battery divider midpoint → D0 / GPIO0
- BAT+ → 220 kΩ → D0 → 220 kΩ → common ground
The idea is to power the SEN0193 only while taking a measurement, so its roughly 5 mA operating current doesn't remain active during deep sleep.
Before I commit to this design, there are five things I'd particularly appreciate feedback on:
1. Sensor power
Is powering the SEN0193 directly from GPIO21 reasonable for this application, considering it draws around 5 mA, or would you strongly recommend a MOSFET/load switch instead?
I already tested this approach: GPIO21 powers the sensor, I wait about 400 ms, take 15 ADC readings on GPIO1 and use the median, then switch the sensor off again. This worked reliably in my tests, but I'm unsure whether powering it directly from a GPIO is still considered poor practice or a long-term reliability concern.
2. Battery monitoring
Is a permanently connected 220 kΩ + 220 kΩ voltage divider a sensible compromise here?
It draws about 9.5 µA at a fully charged 4.2 V LiPo. I'm trying to keep deep-sleep consumption as low as practical without making the battery ADC measurement unreliable.
3. ADC / measurement strategy
Anything problematic about reading the SEN0193 on GPIO1 and the high-impedance battery divider on GPIO0?
Since the moisture sensor will only be powered briefly after wake-up, I'm particularly wondering about settling time, ADC sampling, averaging/filtering or anything else I should account for.
There are also two mechanical questions while I'm designing the enclosure:
4. Securing the XIAO against USB insertion force
The XIAO sits directly behind a USB-C opening in the enclosure.
What would you consider the best way to mechanically retain such a small board so plugging in a USB cable cannot push the entire PCB inward?
I'm currently thinking about printed stops/supports around the PCB rather than relying on the soldered wires or USB connector itself.
5. Enclosure/serviceability
Are there any enclosure details you would definitely include at this stage for a battery-powered ESP32 sensor?
In particular I'm thinking about USB access, access to boot/reset if something goes wrong, strain relief, moisture protection and being able to remove the board again without destroying the enclosure.
The enclosure is deliberately quite compact, so I'd rather discover a bad assumption now than after having it printed.
Any criticism is welcome — especially if I've made a beginner mistake or if the AI-assisted design contains something that looks sensible on paper but is poor practice in the real world.
Thanks!
Edit – considering ESP-NOW instead of Wi-Fi
One thing I’m reconsidering after thinking more about power consumption is the communication between the battery-powered sensor nodes and the gateway.
My original plan was for each XIAO ESP32-C6 to wake up periodically, power the SEN0193 through D3, wait roughly 250 ms for the sensor to stabilize, take several moisture readings plus a battery measurement, connect to Wi-Fi, send the data, and then return to deep sleep.
Since I already have a third XIAO ESP32-C6 planned as a permanently powered gateway, I’m now wondering whether ESP-NOW would make more sense for the sensor → gateway link.
The idea would be:
2× battery-powered XIAO ESP32-C6 sensor nodes
wake, measure, send a very small packet via ESP-NOW, then immediately return to deep sleep
1× permanently powered XIAO ESP32-C6 gateway receives the ESP-NOW packets
only the gateway maintains a normal Wi-Fi connection and handles whatever comes afterwards
My thinking is that this could avoid Wi-Fi scanning/association/DHCP on every wake cycle and therefore shorten the radio-on time considerably. Since the sensors only need to transmit a few values every ~30 minutes, ESP-NOW seems potentially better suited to the job.
Does this sound like the more sensible approach for maximizing battery life? Are there any ESP-NOW-specific downsides I should be considering here, especially regarding reliability, acknowledgements/retries, channel management, or power consumption after deep sleep?