nganlh / MQTT-SN

MQTT-SN implementation in contiki for the course LINGI2146 - Mobile and Embedded Computing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MQTT-SN -- Group Q

MQTT-SN implementation in contiki for the course LINGI2146 - Mobile and Embedded Computing

Repository description

  • /broker : contains the config file of mosquitto broker
  • /gateway : contains all files relative to the gateway
    • gateway_v2.c : file containing the code of the sensor root node
    • gateway.py : file running the gateway
  • /sensor_node : contains all files relative to the sensor nodes
    • sensor_v2.c : file containing the code of a sensor node
  • /subscriber : contains all files relative to the subscribers of the MQTT network
    • subscriber.py : file running one subscriber
    • topics_subX.txt : file containing subscriber's topics

Requirements

  • contiki and cooja
  • the cooja plugin serial2pty.
  • Mosquitto
  • Python
  • paho-mqtt

How to test

  1. Inside a new simulation in cooja, add a first z1 mote with gateway_v2.c.
  2. On this node perform a right click and choose serial2pty.
  3. Add as many z1 motes as you want with sensor_v2.c.
  4. Go to the /gateway directory and run inside a command prompt sudo python gateway.py -m <mote_nomber> where <mote_number> is the number of the serial device of serial2pty. You can get this number unside cooja in the small window of the related plugin : /dev/pts/<mote_number>.
  5. Got to /broker and run mosquitto -c broker.conf. If mosquitto is already running, you need to kill its process.
  6. Inside a new command prompt, in the /subscriber directory, enter python subscriber.py -f <topics_file> where <topics_file> is a .txt file located in the same directory. You can perform this action as many times as you want.
  7. Finally run the simulation on cooja

Remark

The <topics_file> contains the different subscriptions of a subscriber. These subscriptions have the form : <node_id>/<topic> where <node_id>is the rime id of a node inside contiki and <topic> is temperature or humidity. An example is 2.0/temperature.

About

MQTT-SN implementation in contiki for the course LINGI2146 - Mobile and Embedded Computing


Languages

Language:C 78.6%Language:Python 20.5%Language:Makefile 0.9%