Soil moisture data shouldn't cost a monthly cell bill. With an ESP32, a LoRaWAN module, and The Things Network (TTN), you can deploy sensors across acres of field or garden and read them from anywhere for free. This guide walks through hardware selection, low-power firmware, and TTN integration so your first node survives months on a LiFePO4 cell.
Hardware Bill of Materials
| Component | Model | Notes |
|---|---|---|
| MCU | ESP32-WROOM-32E | Deep sleep < 10 µA |
| LoRa Radio | RFM95W / SX1276 | 868/915 MHz matching region |
| Soil Sensor | Capacitive v1.2 | Corrosion resistant, 3.3 V |
| Power | 3.2 V LiFePO4 14500 | Flat discharge curve, no regulator |
| Antenna | 1/4 wave whip | Cut to 868 or 915 MHz |
| Enclosure | IP67 project box | Cable glands for probe leads |
Wiring Essentials
Connect RFM95W SPI pins to ESP32 HSPI (GPIO 13/12/14/15). Soil sensor signal goes to ADC1_CH0 (GPIO 36). Pull RFM95W RESET to GPIO 27 and DIO0 to GPIO 26 for LMIC interrupt handling. Power everything from the LiFePO4 positive rail; add a 10 µF ceramic + 100 ¿ electrolytic near the radio VCC pin.
Firmware: Deep Sleep Cycle
TTN Console Setup
Create an application in the TTN v3 console. Register an end device with OTAA: paste DevEUI, JoinEUI, and AppKey from your firmware. Set Frequency Plan to your region (EU868 / US915). Add a Payload Formatter (JavaScript) to decode the two-byte integer back to percentage:
Power Budget Reality Check
| State | Current | Duration | Charge |
|---|---|---|---|
| Deep Sleep | 8 µA | 14.9 min | 2.0 mAh |
| Wake + Sensor | 12 mA | 2 s | 0.007 mAh |
| LoRa TX (SF7) | 110 mA | 1.2 s | 0.037 mAh |
| Total per cycle | 15 min | 2.04 mAh |
A 600 mAh LiFePO4 yields ~290 cycles — roughly 72 days at 15-minute intervals. Doubling the interval to 30 minutes pushes lifetime past 140 days.
"LoRaWAN isn't magic physics, but it feels like it when your sensor still reports after three months on a single AA-sized cell.
— Field test log, day 87
Next Steps
Add a BME280 for temperature and humidity on the same I2C bus. Implement ADR (Adaptive Data Rate) so the node backs off to SF12 only when gateway RSSI drops. For fleets, script TTN CLI to bulk-register devices and push firmware updates via multicast Class B windows.
✦
Flash the sketch, seal the box, bury the probe. Open the TTN live data tab and watch the first packet arrive. That’s your network — no SIM, no subscription, just physics and patience.










