Giter Site home page Giter Site logo

devicehive / lora-gateway Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 5.0 18 KB

Simple gateway implementation between LoRa and DeviceHive.

License: Apache License 2.0

Shell 1.47% Arduino 34.26% Python 64.28%
iot devicehive lora lorawan lora-gateway iot-gateway

lora-gateway's Introduction

DeviceHive LoRa gateway

This project implements LoRa gateway using DeviceHive cloud service. It is a transparent gateway between DeviceHive cloud service and LoRa radio.Everything which LoRa receives sends to DeviceHive server as notifications. Command 'lora' transmit 'data' field into LoRa. It is a transparent gateway between DeviceHive cloud service and LoRa radio.

Hardware

This project uses Dragino LG01 gateway as a reference hardware.

Installation

Make sure that gateway firmware version is 4.3 or newer. You can get new firmware here

  • Install Python DeviceHive library. Connect with ssh to the router (ssh [email protected], password dragino by default) and run:
curl -SL https://github.com/devicehive/devicehive-python/archive/2.1.0.tar.gz | tar zx
cd devicehive-python-2.1.0/
python setup.py install
cd ..
rm -rf devicehive-python-2.1.0/
  • Copy gateway package:
mkdir -p /opt/devicehive && curl -SL https://github.com/devicehive/lora-gateway/releases/download/v0.0.2/gateway.tar.gz | tar zx -C /opt/devicehive
  • Install it with:
/opt/devicehive/gateway.py install

This command flashes firmware into gateway. Firmware automatically boots on power on and starts Python part.

  • Configure gateway with DeviceHive server URL, credentilals and LoRa frequency. Open web browser http://gateway-ip:8000 and enter settings there. Click on save.

To remove it completly, remove /opt/devicehive directory, pip uninstall devicehive and flash(or just leave it) any new firmware to the microcontroller part of the gateway.

Usage

Gateway boots automatically on power on. It works on specfied in config frequency and receives all LoRa packages which send to DeviceHive server as notifications. Notification name is always LoRa. Parameters contains field data which is the data that was received. rssi field means received signal strength indicator, units are dBm. Example:

{
  "data": {
           "A1":1.63,
           "A0":1.77,
           "A3":1.33,
           "A2":1.48,
           "A5":0.64,
           "A4":1.15
  },
  "rssi": -45
}

If LoRa data is a json it will be json object in this field. If LoRa data is a string or raw data it will be string object in this field. Any non pritable character, it will be escaped with \\x00 sequence where 00 is hex code of char. For example newline char \\x0a.

To send data to LoRa, send a command to dateway device with LoRa name(case insensetive) and data field in the parameters. It can be json object or string which will be sent as bytes to radio. Any non pritable charactes should be escaped with \\x00 sequence where 00 is hex code of char.

Sample LoRa device

There is a simple Arduino based(with LoRa hat) devices sample. This sample can be used for test of demo purpose. See details here.

Building from sources

To build firmwares and/or flash it separatly use Arduino IDE. More deatiled description about operating Dragino gateway is aviliable here. To generate release tarball:

  • build lora-gateway-firmware with Arduino IDE(Sketch -> Export compiled Binary)
  • run gen_release.sh script Tarball will be created in repo root directory.

License

Apache License, Version 2.0. See LICENSE file

lora-gateway's People

Contributors

nikolay-kha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  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.