A solar powered farm sensor node off-grid IoT design enables reliable agricultural monitoring in remote fields without access to mains electricity. India has over 60% of its agricultural land in areas with unreliable power supply, making solar-powered IoT nodes essential for precision farming at scale. This guide covers designing, building, and deploying a complete solar-powered sensor station with ESP32, BME280, soil moisture sensor, and LoRa communication.
Table of Contents
- Why Solar Power for Farm IoT
- System Architecture and Design
- Power Budget Calculation
- Components Required
- Circuit and Connections
- Deep Sleep ESP32 Code
- Field Deployment Tips
- Frequently Asked Questions
Why Solar Power for Farm IoT
Traditional farm monitoring systems require cable runs of hundreds of metres for power and data — expensive and impractical in India’s diverse terrain. Solar-powered nodes solve this by being completely self-contained:
- No electrical wiring across fields — saves ₹15,000–50,000/acre in cabling costs
- Works in remote locations: hill farms, tea estates, apple orchards in Himachal
- 5–10 year operational life with minimal maintenance
- Easily relocatable between crop seasons
- Government subsidies available: PM-KUSUM scheme covers up to 60% of solar pump/sensor costs
System Architecture and Design
The solar node uses a duty-cycle architecture: the ESP32 sleeps for most of the time, wakes up every 15–30 minutes to take readings, transmit via LoRa, and return to deep sleep. This reduces average power consumption from ~120mA to under 1mA.
Components in the chain:
- Solar panel (6V/2W) → charge controller → LiPo battery (3.7V/3000mAh)
- Battery → 3.3V LDO regulator → ESP32 + sensors
- ESP32 collects data → transmits via LoRa SX1278 → LoRaWAN gateway → cloud
Power Budget Calculation
Understanding power consumption is critical for sizing the solar panel and battery:
| State | Current Draw | Duration | Energy (mWh/cycle) |
|---|---|---|---|
| Deep sleep | 0.01 mA | ~29 min | 0.001 |
| Wake + sensor read | 80 mA | 2 sec | 0.147 |
| LoRa transmit | 120 mA | 1 sec | 0.110 |
Total per cycle: ~0.26 mWh. With 48 cycles/day: ~12.5 mWh/day = ~3.4 mAh/day at 3.7V. A 3000mAh battery provides 880 days of operation without any solar charging — in practice, even a 1W panel on a cloudy day recharges the battery easily.
Components Required
Sensors and Modules from Zbotic
Complete build list:
- ESP32 WROOM-32 development board
- LoRa SX1278 433MHz module (Ra-02)
- BME280 sensor (temp/humidity/pressure)
- Capacitive soil moisture sensor
- 6V 2W solar panel
- TP4056 LiPo charge controller with protection
- 18650 LiPo cell (3000mAh) or 3.7V LiPo pouch cell
- MCP1700-33 LDO regulator (3.3V, 250mA, ultra-low quiescent current)
- IP65-rated weatherproof enclosure
- Silica gel desiccant packets
Circuit and Connections
Key wiring notes for solar node:
- Solar panel → TP4056 IN+ IN- → LiPo B+ B-
- TP4056 OUT+ OUT- → MCP1700 VIN GND
- MCP1700 VOUT → ESP32 3V3 pin (bypass onboard LDO for better efficiency)
- BME280: SDA→GPIO21, SCL→GPIO22, VCC→3.3V
- Soil sensor AOUT → GPIO34 (ADC1, no input-only restriction)
- LoRa: MOSI→GPIO23, MISO→GPIO19, SCK→GPIO18, CS→GPIO5, RST→GPIO14, IRQ→GPIO2
- Soil sensor power → GPIO32 (switch off during sleep to prevent corrosion)
Deep Sleep ESP32 Code
#include <Wire.h>
#include <Adafruit_BME280.h>
#include <LoRa.h>
#include <SPI.h>
// LoRa pins
#define LORA_SS 5
#define LORA_RST 14
#define LORA_DIO0 2
// Sensor pins
#define SOIL_PIN 34
#define SOIL_PWR_PIN 32
// Deep sleep interval: 15 minutes
#define SLEEP_INTERVAL_US (15ULL * 60 * 1000000)
Adafruit_BME280 bme;
// RTC memory survives deep sleep
RTC_DATA_ATTR int bootCount = 0;
RTC_DATA_ATTR float lastTemp = 0;
void setup() {
Serial.begin(115200);
bootCount++;
// Power on soil sensor
pinMode(SOIL_PWR_PIN, OUTPUT);
digitalWrite(SOIL_PWR_PIN, HIGH);
delay(200); // Stabilise
// Init BME280
Wire.begin(21, 22);
bool bmeOK = bme.begin(0x76);
// Read sensors
float temperature = bmeOK ? bme.readTemperature() : 0;
float humidity = bmeOK ? bme.readHumidity() : 0;
float pressure = bmeOK ? bme.readPressure() / 100.0 : 0;
delay(100);
int soilRaw = analogRead(SOIL_PIN);
int soilPct = map(soilRaw, 4095, 1500, 0, 100); // Calibrate these values
soilPct = constrain(soilPct, 0, 100);
// Power off soil sensor (prevents corrosion)
digitalWrite(SOIL_PWR_PIN, LOW);
// Read battery voltage via voltage divider on GPIO35
float batVoltage = analogRead(35) * (4.2 / 4095.0) * 2; // 100k/100k divider
// Init LoRa and transmit
SPI.begin(18, 19, 23, LORA_SS);
LoRa.setPins(LORA_SS, LORA_RST, LORA_DIO0);
if (LoRa.begin(433E6)) {
LoRa.setSpreadingFactor(10); // SF10 for range
LoRa.setSignalBandwidth(125E3);
LoRa.setCodingRate4(5);
LoRa.setTxPower(17);
// Build compact payload (25 bytes)
LoRa.beginPacket();
LoRa.write((uint8_t)bootCount);
LoRa.write((int16_t)(temperature * 100) >> 8);
LoRa.write((int16_t)(temperature * 100) & 0xFF);
LoRa.write((uint8_t)humidity);
LoRa.write((uint16_t)(pressure) >> 8);
LoRa.write((uint16_t)(pressure) & 0xFF);
LoRa.write((uint8_t)soilPct);
LoRa.write((uint8_t)(batVoltage * 50)); // Scale to 0-255
LoRa.endPacket();
Serial.printf("Sent: T=%.1f H=%.1f P=%.1f Soil=%d%% Bat=%.2fV
",
temperature, humidity, pressure, soilPct, batVoltage);
}
LoRa.end();
SPI.end();
// Enter deep sleep
esp_sleep_enable_timer_wakeup(SLEEP_INTERVAL_US);
Serial.println("Going to sleep...");
Serial.flush();
esp_deep_sleep_start();
}
void loop() {
// Never reached
}
Field Deployment Tips
For successful long-term deployment in Indian field conditions:
- Enclosure: Use IP65 or better. Seal cable entry with silicone gel. Replace desiccant every 6 months.
- Solar panel orientation: Face south at latitude angle (e.g., 18° in Maharashtra). Clean monthly.
- Antenna: LoRa whip antenna must exit the enclosure — use SMA bulkhead connector with O-ring seal.
- Mounting height: Node at 1.5m, soil sensor buried 15cm deep for root zone measurement.
- Surge protection: Add TVS diodes on sensor lines in lightning-prone regions.
- Battery life check: Battery voltage field in LoRa packet alerts you when battery drops below 3.5V.
Related Products
- GY-BME280 5V — for 5V system variants — ₹199
- Capacitive Soil Moisture Sensor — ₹129 (no corrosion, suitable for long-term burial)
Frequently Asked Questions
What solar panel size do I need for an ESP32 LoRa node?
A 2W (6V) panel is ample for a duty-cycled ESP32 with 15-minute wake intervals. Even in monsoon conditions (2–3 peak sun hours/day), a 2W panel delivers 4–6 mAh/day, far exceeding the ~3.4 mAh/day consumption.
Can the system work without a gateway?
Yes, using point-to-point LoRa (not LoRaWAN) to a Raspberry Pi or Arduino gateway at the farmhouse. The gateway collects data locally and can also forward to the cloud via 4G/WiFi.
How far can LoRa transmit in agricultural environments?
In open flat farmland, expect 2–5 km at SF10. In hilly terrain or with dense crop cover, range drops to 500m–1.5 km. Use SF12 (slower, but longer range) for the most distant nodes.
What is the IP rating required for outdoor farm enclosures?
Minimum IP65 for protection against dust and water jets. In flood-prone fields (Assam, Bihar during monsoon), use IP67 (submersion to 1m). Avoid IP54 enclosures — they fail within one season in Indian field conditions.
Add comment