Research breakthrough possible @S-Logix

Office Address

  • 2nd Floor, #7a, High School Road, Secretariat Colony Ambattur, Chennai-600053 (Landmark: SRM School) Tamil Nadu, India
  • +91- 81240 01111

Social List

How to Simulate the MQTT Protocol in Contiki-NG Simulator?

Simulate the MQTT Protocol in Contiki-NG

Simulate the MQTT Protocol in Contiki-NG


   MQTT is a lightweight, publish-subscribe, machine-to-machine network protocol. It uses Publisher/Subscriber pattern and translates the messages between devices, servers, and applications. The MQTT protocol was initially created to link sensors like pipelines that communicate with satellites, emphasizing minimal battery loss and bandwidth consumption.

Step 1

Open cooja simulator

In terminal cd contiki-ng/tools/cooja >> ant run

Create new simulation

Step 2

Create motes for simulation

Choose the following location and create motes 1.contiki-ng/examples/rpl-border-router/border-router.c //For border router 2.contiki-ng/examples/mqtt-client/mqtt-client.c //For Publisher 3.contiki-ng/examples/mqtt-client/mqtt-client.c //For Subscriber

Step 3

connect border-router and broker/server

Open a new terminal to connect a border_router. contiki-ng/examples/rpl-border-router >>make TARGET=(platform) connect-router-cooja

Open another terminal to connect a broker. 2.mosquitto -p port address

Step 4

Open cooja simulator

Run Simulation

Open cooja simulator and Run Simulation
Run Simulation and get the output