Scenario: A city IT department deploys 10,000 parking sensors across downtown. Each sensor reports status changes (occupied/vacant) ~5 times/day plus monthly battery level. Sensors use NB-IoT cellular ($0.50/MB data). The city already has REST API infrastructure for their web portal and mobile app, but needs to minimize cellular data costs for 5-year sensor deployment.
Think about:
- What’s the total cost difference over 5 years between 500-byte HTTP requests and 50-byte CoAP messages at $0.50/MB for 10,000 sensors?
- How does a CoAP-to-HTTP gateway let you keep constrained protocols on sensors while maintaining REST API compatibility?
Key Insight: CoAP with HTTP proxy reduces cellular data costs by $900,000 over 5 years while maintaining REST API compatibility:
Why CoAP + Proxy Architecture Wins:
Architecture:
Benefits:
1. Sensor Side (CoAP):
- Minimal code footprint (~10KB vs ~50KB for HTTP)
- Low power (UDP, no TCP handshake)
- Small messages (4-byte header vs 300+ for HTTP)
- Perfect for NB-IoT's bursty nature
2. Backend Side (Proxy):
- Translates CoAP to HTTP seamlessly
- Existing REST APIs unchanged
- Single point of protocol translation
- Can add caching, aggregation
Cost Analysis (10,000 sensors, 5 years):
CoAP+Proxy HTTP Direct MQTT
Sensor RAM 16 KB 64 KB 32 KB
Sensor cost $15 $25 $20
Data/msg ~50 bytes ~500 bytes ~60 bytes
Monthly data 1 MB 10 MB 1.2 MB
NB-IoT cost/month $0.50 $2.00 $0.60
Backend change Proxy ($500) None Broker ($2K)
5-Year TCO:
Sensors: $150,000 $250,000 $200,000
Connectivity: $300,000 $1,200,000 $360,000
Backend: $500 $0 $2,000
------------------------------------------------------------
TOTAL: $450,500 $1,450,000 $562,000