- Summary
- Story
- Setup
- Step 01 - Turn on an LED
- Step 02 - LED flash
- Step 03 - Connect to WI-FI
- Step 04 - SetUp Mosquitto
- Step 05 - SetUp your first Subscribe to Mosquitto
- Step 06 - Publish with Mosquitto
- Step 07 - Set MQTT with your esp32
- Step 08 - Create your Broker
The schema below shows the architecture of broker MQTT:
Explanation
Each device can publish on a broker local or global.
The Broker is an intermediary between devices and subscribers.
It allows to store, process and share the data to other entities.
Whether it is another broker or his phone to be aware of an alert according to the data.
🛠️ Required Hardware:
- ESP32
- USB cable
Your first objective is to light an LED on your ESP32 with code.
Use the LED on your card or an external LED and turn it on.
🛠️ Required Hardware:
- ESP32
- USB cable
Now it's time to make your LED blink.
To do this, implement some code in your ESP32.
Your LED must blink with 500 ms.
🛠️ Required Hardware:
- ESP32
- USB cable
For this step, you will set ssid and password for connect your board to the WI-Fi.
Integred conditional state for print Wi-fi and Ip Address of your device.
- To print data you must use serial connection.
- The first purpose of the MQTT IOT is a Wi-Fi.
- Print the
ip
of your board inserial monitor
- Ping your device.
If this step is ending you can go out to the next step. 🎉
🛠️ Required Hardware:
- Your Computer
Now that you have an network to your esp32.
This is the first step.
Then you must understand and work MQTT IoT.
- Take your computer and download Mosquitto.
- On this piece you have a Broker MQTT with a raspberry.
- Call a manager to explain how a broker works. 👋
🛠️ Required Hardware:
- Your computer
Now it's time to know how subscribes to a topic.
This information is necessary to communicate with the Broker 🚀
Topic : /Workshop/Hardware/MQTT
Username : MosquiFruit
Password : SendMeYourEmail
- First step : Subscribe to all topics
- Second step : Subscribe to specific topic /Workshop/Hardware/MQTT
😊 Subscribe to the topic
If your received message, you can jump to the task 06 🎉
🛠️ Required Hardware:
- Your Computer
You will now publish your epitech 📧 to the topic /Workshop/Hardware/.
You can find all information in the step 05 to send me your email.
If the messages appear in my log you have successfully completed this step!
Let's continue to the next step! 👏
🛠️ Required Hardware:
- ESP32
- USB cable
We will set up network on your esp32 and understand how use MQTT.
Now you must publish and subscribe to topic with your esp32.
- Create client
- Subscribe to
/Workshop/Hardware/Step07/
- Publish the date time.
👉 Don't forget information for the communication with the broker local.
Surprise The Broker respond to you 😎
You can pass to the last step of this Workshop !
🛠️ Required Hardware:
- Raspberry Pi
- USB cable
Come and see a supervisor and ask for a raspberry pi 🏄
The raspberry is almost configured.
Your job if you accept it is :
- to change the mosquitto configuration to subscribe to /Workshop/Hardware/Success.
- Redirect the messages to the main broker.
😊 After change config, don't forget to restart service.
You now know the basics of MQTT ESP32. Feel free to use your imagination to implement IoT Communication. Or combine the previous exercises for new results.
Albert VALENTIN |
---|
🚀 Don't hesitate to follow us on our different networks, and put a star 🌟 on
PoC's
repositories.