Has anyone of you implemented the CoreMQTT library in a microcontroller with USART connection? It would be interesting to hear about your experience.

Here’s an overview of my project, and the goal is to implement CoreMQTT on both of the MCUs:

Why do you need MQTT client on the second broker? Can’t you just send the data that you want to publish to main MCU which can then send it to the broker using MQTT?


The second MCU should be able to subscribe to topics and have the full capability of an MQTT client.

Right off the bat, a solution could be running two MQTT instances on the main MCU, where the second instance represents the second MCU. What do you think?

Running just one instance, would create further complexity in my opinion for routing of messages which should be the job of the MQTT client. Meaning the main MCU would need to know which topics belongs to who.

The full capability of an MQTT client are publish and subscribe from an application’s perspective.

You do not need two instances of MQTT. Instead you can use MQTT topics to route messages. For example, you could structure your application to use the topic space /primary for the main MCU and /secondary for the second MCU. Then any incoming message on the topic starting with /primary should be handled by the main MCU and /secondary should be forwarded to the second MCU.


Thanks for your feedback Gaurav. I will go ahead and implement this.

Great - let us know if you face any problem.