Overview
Built a minimal, non-blocking Arduino library that wraps native ESP-IDF esp-mqtt to simplify secure MQTT communication between ESP32 devices and AWS IoT Core.
Core capabilities
- Uses true mutual TLS with certificate/key strings directly in code, with no SPIFFS/LittleFS mount requirement
- Keeps
loop()responsive using asynchronous event-driven receive callbacks - Queues outgoing publish/subscribe actions while TLS and broker connection are still establishing
- Exposes a compact API for initialization, callback registration, and queued MQTT actions
Hardware scope
- ESP32 DevKit V1 (Xtensa dual-core)
- Seeed Studio XIAO ESP32C3 (RISC-V single-core)
Standard AVR boards (Uno, Nano, Mega) are not supported because the library depends on ESP32 Arduino Core and ESP-IDF components.
Quick API surface
mqtt_manager_init(endpoint, root_ca, client_cert, private_key)mqtt_manager_set_message_cb(callback_function)mqtt_manager_action(action_type, topic, payload)
Reliability and troubleshooting notes
- Diagnosed publish queue saturation (
ESP_ERR_NO_MEM) as an upstream connection/auth issue rather than an application loop issue - Documented common AWS IoT setup pitfalls: inactive certs, missing policy permissions, and incorrect non-ATS endpoints
- Added debug guidance through Arduino Core Debug Level and
esp_log_level_set("esp-tls", ESP_LOG_INFO)for TLS handshake visibility - Highlighted NTP dependency for certificate validation and the impact of blocked UDP 123 traffic
Outcome
Delivered a practical ESP32-focused MQTT manager that reduces integration complexity for AWS IoT Core while preserving secure transport and responsive firmware behavior.