A lightweight MQTT client library for Arduino and compatible hardware enabling IoT publish/subscribe messaging.
PubSubClient is an Arduino library that provides MQTT client functionality for IoT devices, enabling them to publish and subscribe to messages through an MQTT broker. It solves the problem of implementing lightweight MQTT communication on resource-constrained Arduino hardware, allowing devices to participate in IoT networks using the standard MQTT protocol.
Arduino developers building IoT projects that require MQTT communication, particularly those using Ethernet or WiFi shields to connect devices to message brokers.
Developers choose PubSubClient because it's a lightweight, well-established MQTT implementation specifically optimized for Arduino's constrained environment, with broad hardware compatibility and simple API that doesn't require extensive networking knowledge.
A client library for the Arduino Ethernet Shield that provides support for MQTT.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Works with a wide range of Arduino boards and shields including Ethernet, WiFi, ESP8266, and ESP32, as listed in the Compatible Hardware section, minimizing integration effort.
Allows adjustment of message buffer size and keepalive interval via defines or runtime methods like setBufferSize(), providing flexibility for different network conditions and memory constraints.
Implements the modern MQTT protocol version by default, ensuring reliable and standard-compliant IoT communication, with an option to downgrade to MQTT 3.1 if needed.
Prioritizes minimal resource usage and a straightforward API, making it suitable for memory-constrained embedded systems, as emphasized in the project philosophy.
Can only publish messages at QoS 0, which lacks reliability for critical applications requiring guaranteed delivery, as admitted in the README limitations.
The maximum packet size is set to 256 bytes by default, which can be restrictive for data-intensive projects without manual configuration, potentially causing message truncation.
Does not support ENC28J60-based hardware, forcing users to seek alternative libraries for compatible boards, as noted in the Compatible Hardware section.
Requires editing header files or calling specific methods to change key parameters, which can be cumbersome and error-prone for developers unfamiliar with Arduino library internals.