NR24L01 Network and MQTT Protocol

Hi, I need advice from more experienced developers.
Let me describe my topology.
Currently I have working network using NR24L01 modules.

I have one main(master) server Arduino Mega and other nodes Arduino Pro Mini.
It is quite simple, nodes control different sensors, sends information back to the master.

I have built my communication using RF24 Mesh library.

I have created my custom communication protocol, it is like HTTP. It has GET command to obtain information from nodes, POST/PUT to set some sensor data(for example enable it or disable) and some custom like ALARM an so on. It is custom.

As I mentioned main server is Arduino Mega it plays role of broker (not really MQTT broker). And at first I have handle HTTP request on master server and response back with required information.

But recently I have realized such great protocol MQTT. It is made exactly for devices and very lightweight.

So for the sake of studying and learning some new technologies, I wanna to integrate it with my topology.

What I need to get from the outside of the local NRF24 network ?

Still it is like HTTP REST service.

  1. Get list of sensors, nodes.
  2. Get their states.
  3. Set periodical update.
  4. Get notifications
  5. Control nodes and sensors.
  6. And other common stuff.

Previously I implemented notifications using GCM (Google cloud messaging) but it was quite painful, MQTT has bidirectional communication support, so it is great.

I don't understand how should I integrate MQTT into my topology. Again my nodes don't have separate IP address (they are in NRF24 network) and cannot handle communication like ESP modules.

I wonder where should be MQTT broker in my architecture should it be current master server or master server will be like a bridge between internal network and MQTT protocol ? (If so I think it will slow down communication)

Please help to integrate MQTT into my existing topology. Give some advice how to build all this stuff correctly.


like a bridge between internal network and MQTT protocol

I think this would be the best way to go.
If the devices want to communicate with each other, there is no need for MQTT, just use your own protocol.

Thank for answer. So in general it would look like

Sensors ----NRF24L01-----> Master Server -----MQTT(over the local network at home) -----> MQTT broker (hosted on my PC with static inet IP) ------MQTT(over the internet)------> Outer World (Android Devices,WEB apps)

Am I right ?

Makes sense to me. The Master Server publishes the devices and marshals requests.

Thank you for advice. Appreciate it.