MQTT over Mesh

Qubitro
3 min readNov 25, 2021

--

Have you ever considered that all of our devices are connected wirelessly and communicate with one another across the internet?

In this post, I’ve created a simple mesh network using Wi-Fi, and the data from mesh devices were sent to Qubitro, so you don’t have to configure each device with a network; instead, you can connect a single device to the internet, which will collect all the data from mesh devices and send it to Qubitro.

Let’s get this party started…🌟

Components Needed:

Let’s do some coding:

1. Hardware Setup:

You should first configure your WisBlock or esp32s or esp8266s with the mesh network so that they can communicate with one another through the mesh.

You can refer this page for setting up your Wisblock in Arduino Environment.

In this project, I’ve included some dummy sensor values in the code that you can replace with your own. It’s all open to your imagination.

After you’ve uploaded the code to all the esp devices and turned them on, connect WisBlock to the serial monitor and check the serial monitor results; you should now be able to view the data from all the other devices in the serial monitor.

They’re all communicating now, and also they’re sharing sensor readings.

Here is the Arduino sketch, this is compatible with both wisblock, ESP8266 and ESP32.

2. Qubitro with Raspberry Pi:

We acquired serial monitor results in the previous section, and now we need to submit the serial monitor data to Qubitro. To do so, I updated the python script to interface with Qubitro.

To begin, setup the Qubitro Portal with your device and change the device tokens and id in the Python script with your device tokens and id.

The data from the serial monitor can be converted to JSON and delivered to Qubitro using this script.

Connect WisBlock to the Raspberry Pi and execute the Python script. You can see the received data from mesh in the terminal, as well as the data that was sent to Qubitro.

Visualize the Data:

Now that we’ve reached the end of the process, open your Qubitro portal and go to the project.

Click the Data Tab, and you’ll see the mesh device data on the portal…you can now visualize the data as a chart as needed.

You can see some delays in between the reading because of the data transmitting through mesh.

That’s it for now, guys; I just developed this to communicate the sensor readings in my apartment floors. You are free to use and change it as you see fit.

Happy Making….😎

📌 Published by Qubitro Ambassador Pradeep🤩

--

--

Qubitro

Infrastructure for the Internet of Things solutions. Build connected solutions faster than ever.