Code Monkey home page Code Monkey logo

rusty-mqtt's Introduction

rusty-mqtt

A bridge between the MQTT broker of TTN and ThingsBoard in Rust built for the Internet of Things 19/20 course during the Engineering in Computer Science Master's Degree.

LinkedIn Profile

Leonardo Razovic

Assignment 1/2/3

Prerequisites

  1. Rust, you can install it using rustup
  2. A working instance of ThingsBoard
  3. A B-L072Z-LRWAN1 LoRa kit or an IoT-LAB Account
  4. An account on The Things Network

Usage

USAGE:
    rusty-mqtt [OPTIONS] --TTN-port <RPORT> --server <SERVER> --topic <TOPIC> --username <USER_NAME>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -k, --TTN-port <RPORT>        TTN MQTT server port [default: 1883]
    -s, --server <SERVER>         ThingsBoard MQTT server address [default: 0.0.0.0]
    -t, --topic <TOPIC>           TTN topic to subscribe
    -p, --port <TPORT>            ThingsBoard MQTT Server port [default: 1883]
    -r, --TTN-address <TTN>       TTN MQTT server address [default: eu1.thethings.network]
    -u, --username <USER_NAME>    ThingsBoard gateway device ACCESS_TOKEN

In the src folder you need a file credentials.rs containing the App ID and the App Access Key from the TTN Application Console. You can modify and rename the sample_credentials.rs file as reference. In the TTN Application Console we must specify a custom decoder function like:

function Decoder(bytes, port) {
  var result = "";
  for (var byte in bytes){
    result += String.fromCharCode(bytes[byte]);
  } 
  return {"result": result };
}

Example

cargo run --release -- -t "#" -u "A1_TEST_TOKEN" -r "eu1.cloud.thethings.network"

Usefull Links

Assignment 4

I developed an HTML5 application using the Generic Sensor API that collects data from the accelerator sensor of the mobile phone. A User Activity Recognition model is executed both on the device (Edge-based approach) and ThingsBoard (Cloud-based approach).

The application is hosted using GitHub Pages and it's available here. You simply need to enter a ThingsBoard Device Access Token and after pressing the start button data from the accelerometer is sent to ThingsBoard using the Telemetry Upload HTTP API.

Blog Posts

Assignment 1: The MQTT protocol using ThingsBoard, Rust and React

Assignment 2: How to setup an Async MQTT transparent bridge in Rust

Assignment 3: The LoRaWAN communication protocol using RIOT, ThingsBoard and Rust

Assignment 4: Generic Sensor API, Sensors For The Web!

YouTube Videos

Assignment 1: https://www.youtube.com/watch?v=6th-NgDjC1w&feature=youtu.be

Assignment 2: https://youtu.be/JiG8LkaZDtQ

Assignment 3: https://www.youtube.com/watch?v=bsJNijxUCw0

Assignment 4: https://www.youtube.com/watch?v=d5ZlM878lms

rusty-mqtt's People

Contributors

lrazovic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.