How to connect 3 esp32 use Mqtt Broker HIveMQ

i have a final project from my camus,
the project is about make a otomatic irigation in a large field using 3 esp32 as a slave who are connect with a relay and a pump. and than there is one esp32 as a master to control all of the esp32.
and in this case i want to use hiveMQ as my broker.
can you help me about how to make the coding as master and slave and how to get the cloud from the hiveMQ ?

Hi @NurulMagfirah ,

It is great to see your interest in MQTT. Please be welcome to our community!

Have you decided if you want to host a HiveMQ broker on your own or you would first want to try the free HiveMQ Cloud version? You can create a free account here:

Once you have created a free account please follow to the “Getting Started” section where you find code examples for different platforms.

We do not have a ESP32 example, but we have one for Arduino here: HiveMQ Cloud

I hope this helps,
Dasha from HiveMQ Team

You don’t have ESP32 example but does it work with HiveMQ? how ?

Hi @shararku ,

Thanks for your question: The ESP8266 example will not work with ESP32. You can only look at it as a reference, but to work with ESP32 you will need to replace all ESP8266-specific libraries with ESP32-specific ones.

Kind regards,
Dasha from HiveMQ Team

thank you for your answer,
i will try your tips