What is MQTT and how to simulate the mqtt in 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

+ Description

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

  • 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:
    1.cd contiki/examples/ipv6/rpl-border-router >> make connect-router-cooja
    2.cd 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

u12a
+ 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:
    1.cd contiki/examples/ipv6/rpl-border-router >> make connect-router-cooja
    2.cd 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

u12a
Leave Comment

Your email address will not be published. Required fields are marked *

clear formSubmit