Table of Contents
Edge computing processes IoT data close to where it is generated rather than sending everything to the cloud. For India, where internet connectivity can be unreliable and bandwidth costs are real, edge computing is not just a technology trend — it is a practical necessity. This guide shows you how to implement edge intelligence on ESP32 and Raspberry Pi devices.
What is IoT Edge Computing
Edge computing in IoT means processing data on or near the device that generates it:
- Local processing: Filter, aggregate, and analyse data before sending to cloud
- Reduced latency: Millisecond response times vs seconds for cloud round-trips
- Bandwidth savings: Send summaries instead of raw data — save 90%+ bandwidth
- Offline capability: Continue operating during internet outages
- Privacy: Sensitive data stays local — important for healthcare and industrial IoT
Edge vs Cloud Processing
| Aspect | Edge Processing | Cloud Processing |
|---|---|---|
| Latency | 1-10 ms | 100-500 ms |
| Bandwidth | Minimal (summaries) | High (raw data) |
| Internet needed | No | Yes |
| Cost | Device hardware | Monthly cloud fees |
| Compute power | Limited | Unlimited |
| Best for | Real-time control | Historical analysis |
ESP32 as an Edge Device
The ESP32’s dual-core processor and 520 KB SRAM make it a capable edge computing platform:
- Core 0: Handle WiFi communication and connectivity
- Core 1: Run edge computing tasks — data filtering, ML inference
- PSRAM: ESP32-WROVER and S3 variants offer 2-8 MB additional RAM
- FreeRTOS: Real-time operating system for deterministic task scheduling
Recommended Components
Data Filtering and Aggregation at the Edge
Instead of sending every sensor reading to the cloud, process at the edge:
// Edge computing: Send average every 5 minutes
// instead of raw data every second
#define READINGS_BUFFER 300 // 5 minutes * 60 seconds
float tempReadings[READINGS_BUFFER];
int readingIndex = 0;
void collectData() {
float temp = dht.readTemperature();
if (!isnan(temp)) {
tempReadings[readingIndex++] = temp;
}
if (readingIndex >= READINGS_BUFFER) {
// Edge processing: calculate statistics
float sum = 0, minVal = 999, maxVal = -999;
for (int i = 0; i < READINGS_BUFFER; i++) {
sum += tempReadings[i];
if (tempReadings[i] maxVal) maxVal = tempReadings[i];
}
// Send summary (3 values) instead of 300 raw readings
char payload[128];
snprintf(payload, sizeof(payload),
"{"avg":%.1f,"min":%.1f,"max":%.1f,"samples":%d}",
sum / READINGS_BUFFER, minVal, maxVal, READINGS_BUFFER);
client.publish("edge/temperature/summary", payload);
readingIndex = 0;
}
}
Running TensorFlow Lite on ESP32
Run machine learning models directly on ESP32 for on-device intelligence:
#include
#include "model_data.h" // Your trained model
// Anomaly detection: Detect unusual sensor patterns
// without cloud connectivity
void runEdgeML(float* sensorData, int dataLen) {
// Load model
tflite::MicroInterpreter* interpreter;
// ... model setup code ...
// Feed sensor data to model
TfLiteTensor* input = interpreter->input(0);
for (int i = 0; i data.f[i] = sensorData[i];
}
// Run inference (takes ~10ms on ESP32)
interpreter->Invoke();
// Get result
float anomaly_score = interpreter->output(0)->data.f[0];
if (anomaly_score > 0.8) {
// Alert: anomalous pattern detected locally
sendAlert("Anomaly detected", anomaly_score);
}
}
Edge Computing Architectures
Common edge computing architectures for IoT:
- Device Edge: ESP32 processes its own sensor data locally
- Gateway Edge: Raspberry Pi collects data from multiple ESP32 nodes, processes, and forwards summaries to cloud
- Fog Computing: Local server handles processing for an entire building or factory floor
- Hybrid: Process urgent data at edge, send raw data to cloud for historical analysis
Real-World Use Cases in India
Edge computing solves real problems in India:
- Agriculture: Soil monitoring sensors in rural areas with poor 4G coverage process data locally and send daily summaries via SMS
- Manufacturing: Factory floor sensors detect equipment anomalies in milliseconds — cloud latency would be too slow for safety shutdowns
- Retail: In-store sensors count footfall and analyse patterns locally, sending aggregated reports hourly
- Healthcare: Patient monitoring devices process vitals locally, only alerting the cloud for critical events (data privacy compliance)
Recommended Product
BME280 Environmental Sensor (Temperature, Humidity, Barometric Pressure)
Frequently Asked Questions
Can ESP32 really do edge computing?
Yes, the ESP32’s dual 240 MHz cores and optional PSRAM are sufficient for data filtering, statistical analysis, simple ML inference, and decision-making. It is not suitable for complex computer vision, but handles most sensor data processing tasks well.
Does edge computing replace cloud computing?
No, edge and cloud are complementary. Edge handles real-time processing and reduces bandwidth. Cloud handles long-term storage, complex analytics, and global coordination. Most production IoT systems use both.
What about power consumption for edge computing?
Edge computing on ESP32 uses more power than simple sensor reading. With WiFi active and processing running, expect 80-160 mA. For battery-powered applications, use deep sleep between processing cycles.
Is edge computing suitable for Indian smart cities?
Absolutely. Indian smart city projects benefit greatly from edge computing — traffic cameras process video locally (reducing bandwidth), air quality sensors detect spikes instantly, and the system works during internet outages.
{“@context”: “https://schema.org”, “@type”: “FAQPage”, “mainEntity”: [{“@type”: “Question”, “name”: “Can ESP32 really do edge computing?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “Yes, the ESP32’s dual 240 MHz cores and optional PSRAM are sufficient for data filtering, statistical analysis, simple ML inference, and decision-making. It is not suitable for complex computer vision, but handles most sensor data processing tasks well.”}}, {“@type”: “Question”, “name”: “Does edge computing replace cloud computing?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “No, edge and cloud are complementary. Edge handles real-time processing and reduces bandwidth. Cloud handles long-term storage, complex analytics, and global coordination. Most production IoT systems use both.”}}, {“@type”: “Question”, “name”: “What about power consumption for edge computing?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “Edge computing on ESP32 uses more power than simple sensor reading. With WiFi active and processing running, expect 80-160 mA. For battery-powered applications, use deep sleep between processing cycles.”}}, {“@type”: “Question”, “name”: “Is edge computing suitable for Indian smart cities?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “Absolutely. Indian smart city projects benefit greatly from edge computing u2014 traffic cameras process video locally (reducing bandwidth), air quality sensors detect spikes instantly, and the system works during internet outages.”}}]}
Ready to Build Your IoT Project?
Browse our complete collection of ESP32 boards, sensors, and IoT components. Fast shipping across India with technical support.
Add comment