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

Steps to Simulate the MQTT in Contiki Cooja Simulator?

Simulate the MQTT in contiki cooja

MQTT Simulation Model using Contiki Cooja Simulator


   MQTT is an ISO standard publish-subscribe based messaging protocol. It works on Application layer, Message broker used distributes topics to clients. Topics are UTF-8 string-based with hierarchical structure. There is no direct connection between clients also QoS(Quality of Service) levels are used in messaging services

Source code

Step 1: Install mqtt packages
mqtt-sn-contiki package download and extract at location: home/user/contiki in Vmware workstation

Step 2: Open cooja simulator
In terminal: cd contiki/tools/cooja >> ant run
Create new simulation(ctrl+n).

Step 3: Create motes for simulation

Choose location and create motes

1. home/user/contiki/examples/ipv6/rpl-border-router/rpl-border-router.c

2. home/user/contiki/mqtt-sn-contiki/ main_core.c //for publisher

3. home/user/contiki/mqtt-sn-contiki/ main_core.c //for subscriber.

Step 4: Connect the border router and broker/server.
Open terminals and change directories to following location: contiki/examples/ipv6/rpl-border-router >> make connect-router-cooja contiki/mqtt-sn-contiki/tools/mosquitto.rsmb/rsmb/src
sudo ./broker_mqtts config.mqtt //to connect mosquitto broker to clients.

Step 5: Open cooja simulator

Run simulation

What is MQTT and how to simulate the mqtt in contiki cooja simulator
Install mqtt packages Open cooja simulator