MQTT, CoAP o LwM2M: Protocolo para NB-IoT
· 8 min read · Technical Whitepapers
CoAP UDP ~208 mJ. MQTT TCP ~348 mJ. TLS: MQTT >1,600 vs CoAP ~600.
En una red NB-IoT, enviar una lectura de sensor de 1,000 bytes via CoAP sobre UDP cuesta ~208 mJ. La misma carga via MQTT sobre TCP cuesta ~348 mJ — 67% mas. Agregue cifrado TLS y MQTT quema mas de 1,600 mJ por intercambio; CoAP+DTLS se mantiene alrededor de 600 mJ. La diferencia no es academica: para un sensor a bateria transmitiendo una vez por hora, MQTT+TLS agota una celda de 2,400 mAh en aproximadamente 8 meses. CoAP+DTLS en el mismo hardware funciona mas de 2 anos.
Los Numeros: Benchmarks Reales NB-IoT/LTE-M
CoAP usa ~40% menos energia que MQTT. La brecha se amplia con cifrado. Por que TCP perjudica en NB-IoT: NB-IoT es half-duplex. TCP requiere un handshake de 3 vias antes de que fluyan los datos. Si el dispositivo entra en PSM entre transmisiones, la sesion TCP se destruye. La siguiente transmision paga el costo completo del handshake nuevamente.
Cuando MQTT Sigue Siendo la Eleccion Correcta
Cuando tu backend en la nube es AWS IoT Core, Azure IoT Hub u otra plataforma nativa MQTT. Cuando el dispositivo usa LTE-M (full-duplex, amigable con TCP) en lugar de NB-IoT. Cuando necesitas distribucion de mensajes multi-suscriptor que el modelo solicitud/respuesta de CoAP no soporta nativamente.
Preguntas frecuentes
CoAP or MQTT —which uses less battery on NB-IoT?
CoAP over UDP uses approximately 40% less energy than MQTT over TCP for the same payload on NB-IoT (208 mJ vs 348 mJ). With encryption, CoAP+DTLS (~600 mJ) vs MQTT+TLS (>1,600 mJ). The gap is caused by TCP's 3-way handshake —on NB-IoT's half-duplex radio, re-establishing TCP after every PSM sleep cycle multiplies the energy cost. For battery-powered sensors on NB-IoT, CoAP is the technically superior choice.
When should I still use MQTT despite the power penalty?
When your cloud backend is AWS IoT Core, Azure IoT Hub, or another MQTT-native platform and rewriting the ingestion pipeline costs more than the battery-life savings; when the device is mains-powered or regularly recharged; when using LTE-M (full-duplex, TCP-friendly) rather than NB-IoT; or when you need multi-subscriber pub/sub message distribution that CoAP's request/response model does not natively support.
What does LwM2M give me that CoAP alone does not?
Standardized remote firmware updates (FOTA), device configuration, connectivity monitoring, and zero-touch bootstrap provisioning —all defined as numbered objects in the LwM2M specification. CoAP handles data transport; LwM2M handles the device's entire lifecycle. For deployments over 1,000 devices, the ~18% energy overhead of LwM2M over raw CoAP is recovered the first time you avoid a truck roll for a firmware update.