Resilient MQTT for the Pico

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
User avatar
Posts: 4935
Joined: Fri Jul 18, 2014 8:01 am
Location: UK

Resilient MQTT for the Pico

Post by pythoncoder » Thu Feb 11, 2021 2:35 pm

The most obvious limitation of the Pico is the absence of WiFi.

Long before the Pyboard D I developed a means of bringing MQTT to the Pyboard 1.1. This has now been updated and ported to the Pico.

The concept is an ESP8266 running a fixed firmware build and linked to the Pico via five GPIO lines, which may be chosen at will. A binary is provided for generic ESP8266's for those not wishing to build firmware.

The user application on the Pico can log onto a local or remote broker and publish and subscribe as required. The system is designed to be resilient: WiFi or broker outages and even ESP8266 crashes are handled transparently. Data transfer is (obviously) delayed for the duration of the problem, but when the outage is cleared it resumes.

Code is asynchronous and updated for the new uasyncio V3.

See this doc. There are some limitations discussed in the doc: in particular it is not especially fast, and the ESP8266 firmware still seems unable to handle TLS on nonblocking sockets. Hopefully it will get well soon, but then I've been hoping for four years...
Peter Hinch

Post Reply