A solar-powered IoT sensor node using the ESP32 with deep sleep is the ultimate remote monitoring solution. It harvests solar energy, stores it in a small lithium battery, and sends sensor data over WiFi at regular intervals — all while running autonomously for months or years without maintenance. This guide covers the complete design process for building a solar-powered ESP32 sensor node optimised for Indian conditions.
Table of Contents
- Use Cases for Solar IoT Nodes
- Power Budget Calculation
- Solar Panel and Battery Sizing
- Hardware Design
- Deep Sleep Optimization
- Code Implementation
- Frequently Asked Questions
- Conclusion
Use Cases for Solar IoT Nodes
Solar-powered ESP32 nodes are ideal for monitoring situations where grid power is unavailable:
- Agricultural monitoring: Soil moisture, temperature, and humidity in farm fields
- Weather stations: Remote weather data collection across India’s diverse climates
- Water level monitoring: Tank levels, river levels, and borewell water tables
- Air quality: PM2.5 and gas sensors in outdoor locations
- Solar system monitoring: Track the performance of larger solar installations
- Security: Remote motion detection and alerting
Power Budget Calculation
The key to solar-powered IoT is minimising power consumption. The ESP32’s power states:
- Active + WiFi: 160-260 mA (depending on transmit power)
- Active (no WiFi): 20-68 mA
- Light sleep: 0.8 mA
- Deep sleep: 10-150 uA (depending on peripherals and RTC configuration)
- Hibernation: 2.5 uA (only RTC timer running)
For a node that wakes every 15 minutes, reads a sensor, connects to WiFi, sends data, and goes back to deep sleep:
- Active time per cycle: ~5 seconds at 200 mA average = 0.28 mAh
- Deep sleep time: 14 minutes 55 seconds at 0.15 mA = 2.24 mAh — but wait, 0.15 mA x 14.9/60 = 0.037 mAh
- Total per cycle: 0.28 + 0.037 = 0.317 mAh
- Per day (96 cycles): 30.4 mAh = approximately 0.11 Wh at 3.7V
This is incredibly low — a 500mAh lithium battery could last 16 days without any solar input. With even a tiny solar panel, the node runs indefinitely.
Solar Panel and Battery Sizing
Minimum Solar Panel
Daily consumption: 0.11 Wh. With 5 hours of sunlight and 70% charging efficiency: Panel = 0.11 / (5 x 0.7) = 0.031W. Even a tiny 0.5W panel is massively oversized, providing excellent cloudy-day resilience.
In practice, use a 1W or 2W panel (6V output, about 6×8 cm) for reliable operation even during monsoon. These panels cost ₹100-300.
Battery Selection
A single 18650 cell (3.7V, 2200-3000mAh) provides more than enough storage. Even without solar, it provides 2-3 months of autonomy at the power budget above.
Hardware Design
Core Components
- ESP32 development board: Use a bare ESP32 module (not a dev board) for lowest power. If using a dev board, cut the power LED trace to save 5-10 mA.
- TP4056 with protection: Charges the 18650 cell from the solar panel. The protection circuit handles over-discharge.
- Small solar panel (1-2W, 5-6V): Connects to the TP4056 input
- Sensor: DHT22 for temperature/humidity, or any I2C sensor
Wiring
Solar panel (+) → TP4056 IN+ → TP4056 OUT+ → ESP32 3V3 pin (via LDO or directly if battery voltage is compatible). The TP4056 handles charging and protection. The ESP32 runs directly from the battery voltage (3.0-4.2V range is within the ESP32’s 2.3-3.6V VDD range when using the internal LDO).
Deep Sleep Optimization
Maximising deep sleep efficiency is the key to solar IoT longevity:
Reduce Active Time
- Pre-compute WiFi connection parameters (save BSSID and channel in RTC memory to skip scanning)
- Use static IP address instead of DHCP (saves 1-3 seconds per wake)
- Use UDP instead of TCP for data transmission (faster, lower overhead)
- Send data to a local MQTT broker rather than a cloud service (reduces latency)
Minimise Deep Sleep Current
- Disconnect external sensors using a MOSFET switch controlled by a GPIO pin (turn on before reading, off before sleep)
- Use RTC memory to store data across sleep cycles — batch send every few hours instead of every wake cycle
- Disable WiFi and Bluetooth radios before entering deep sleep
Code Structure
void setup() {
// Power on sensor
// Read sensor data
// Connect WiFi (using saved credentials)
// Send data
// Save state to RTC memory
// Configure wake timer
esp_sleep_enable_timer_wakeup(15 * 60 * 1000000ULL); // 15 min
esp_deep_sleep_start();
}
void loop() {
// Never reached — ESP32 restarts from setup() after deep sleep
}
Code Implementation
A complete solar IoT node implementation includes error handling and power management:
- Battery voltage monitoring: Read the battery voltage through an ADC pin before attempting WiFi. If below 3.3V, skip WiFi and go back to extended deep sleep (1 hour instead of 15 minutes) to preserve the battery.
- WiFi timeout: Set a 10-second timeout for WiFi connection. If it fails, save data locally and try again next cycle.
- Data buffering: Store up to 24 readings in RTC memory. Send all buffered data when WiFi connects, then clear the buffer.
- Watchdog timer: Enable the hardware watchdog to reset the ESP32 if any function hangs (prevents battery drain from software bugs).
Frequently Asked Questions
Can this work through the Indian monsoon?
Yes. The oversized battery (2200mAh for 30mAh/day consumption) provides 70+ days of autonomy. Even during the worst monsoon weeks with minimal sunlight, the 1W solar panel will trickle-charge enough to keep the node running. Test during your local monsoon to verify.
What is the WiFi range of a solar ESP32 node?
Standard ESP32 WiFi range is 50-100m in open air with the PCB antenna. For remote installations, use an external antenna version for 200-300m range, or consider LoRa (SX1276 module) for multi-kilometre range.
How do I waterproof the node for outdoor use?
Use an IP65-rated junction box from any electrical shop (₹100-300). Seal cable entry points with silicone. The solar panel mounts on top of the box or externally with cables entering through a gland. Apply conformal coating to the PCB for additional moisture protection.
Conclusion
A solar-powered ESP32 IoT node is one of the most practical projects for remote monitoring in India. The combination of deep sleep optimization, a small solar panel, and a single 18650 cell creates a system that runs autonomously for years. Start with a simple temperature/humidity node and expand to more complex sensor arrays. Find ESP32 boards, 18650 cells, TP4056 modules, and all components at Zbotic’s online store.
Add comment