Giter VIP home page Giter VIP logo

duck-sparrow-link's Introduction

duck-sparrow-link

LoRa based backend for Sparrow Mesh

Overview

This repository helps establish connecetion from smartphones to IBM watson backend via network of LoRa/BLE/WiFi interfaces. The hardware primarily consists of 2 types of devices Mama and Papa devices. The Mama devices connect to smartphones via BLE and Wifi and recieve data which is forwarded to Papa devices over LoRa. The Papa devices on recieving this data parse it and publish it on a appropriate mqtt topic so that it reaches the IBM watson backend. THe response is asynchronously recieved on a differernt mqtt topic which is again sent back to Mama over LoRa and then is recieved by the smartphone

Steps for flashing the code

  1. Install Arduino IDE from the official Arduino website arduino.com
  2. Install esp32 Board from the Board manager inside the IDE, detailed instructions here https://github.com/espressif/arduino-esp32
  3. Open the sketches in the repository using the IDE.
  4. Make sure the hardware is connected and in a working state.
  5. Click on the upload button and wait for the process complete.

Message format

Any messages generated by users have a fixed JSON format: The Papa device can parse messeges in this format in order to route them correctly

{
"key":$messageID,
"userID":$userID,
"timeStamp":$timeStampOfMessageOrigin,
"destination":$destination,
"message":$messgeContent
}

$userID - As defined in UserIds
//e.g sparrow:jaylohokare123456789

$timeStampOfMessageOrigin - Time stamp when message was generated
//e.g 982823474842  

$messageID - $userID + '_' + $timeStampOfMessageOrigin
//e.g sparrow:jaylohokare123456789_982823474842

$destination - "sparrow" if destination is Sparrow, $destinationUserID if message is sent to someone within the mesh

$messageContent - The actual message content

Wifi server on ESP32

We implement a Wifi server on ESP32 (Similar to Project Owl) to make a Wifi endpoint available to users. On connecting, users are redirected to a webApp (running on localhost) which delivers a Sparrow chat interface.
Implementation of the webApp can be found at https://github.com/sparrow-platform/sparrow-wifi-web-app

ESP32 - SparrowMesh sync over BLE

We run a Sparrow Mesh node in ESP32. The Node implementation follows same rules and format as it's smartphone based counterparts.
For more details on how Sparrow Mesh works, check Sparrow Mesh git repo - https://github.com/sparrow-platform/sparrow-mesh

MQTT server

We are using a custom MQTT broker as of now. We plan to eventually migrate to IBM IoT's MQTT broker. The reason for not implementing using IBM IoT at this stage is that we need devices to register by themselves. IBM IoT needs additional logic to be implemented to programatically add new devices.
Our MQTT broker is live at 18.221.210.97

Hardware

We used ESP32 devices for replicating Project Owl Clusterduck.
We tested cluster duck - Sparrow compatibility by connecting Sparrow mesh with 20 devices to one LoRa device. The Mesh achieved assured delivery of message with average sync time of 41 seconds per message.

Devices directly connected to a duck (ESP32) have <3 seconds network latency. Messages take time in Sparrow mesh because of the lazy AODV protocol implementation which prioritizes less battery consumption on smartphones over quicker message sync.

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.