Giter Site home page Giter Site logo

ulorawan's Introduction

uLoRaWAN

This is a LoRaWAN v1.0 re-implementation in MicroPython.

Replaces original use of library Crypto on Raspberry PI by ucryptolib available in MicroPython.

Currently tested on ESP32 and ESP8266 will follow.

LoRa

TODO test also LoRa library... or add MicroPython code for sx127x

Example

import uLoRaWAN
from uLoRaWAN.MHDR import MHDR

# Init
devaddr = [0x26, 0x01, 0x11, 0x5F]
nwskey = [0xC3, 0x24, 0x64, 0x98, 0xDE, 0x56, 0x5D, 0x8C, 0x55, 0x88, 0x7C, 0x05, 0x86, 0xF9, 0x82, 0x26]
appskey = [0x15, 0xF6, 0xF4, 0xD4, 0x2A, 0x95, 0xB0, 0x97, 0x53, 0x27, 0xB7, 0xC1, 0x45, 0x6E, 0xC5, 0x45]

lorawan = uLoRaWAN.new(nwskey, appskey)

# Create LoRaWAN packet
lorawan.create(MHDR.UNCONF_DATA_UP, {'devaddr': devaddr, 'fcnt': 1, 'data': list(map(ord, 'Python rules!')) })

payload = lorawan.to_raw()
print(payload)

# Read LoRaWAN packet
lorawan.read(payload)
print(lorawan.valid_mic())
print("".join(list(map(chr, lorawan.get_payload()))))

LoRaWAN

This is a LoRaWAN v1.0 modification of original LoRaWAN library from jeroennijhof to use python library pycryptodome, instead of Crypto(pycrypto) which I had problem to install under Python 3.6. I hope it can be useful for someone as I have used it for validation of MicroPython code.

All changes are basically added encryption type AES.MODE_ECB. No more changes on LoRaWAN for Python are not planned since this repo is mainly for MicroPython.

It uses https://github.com/mayeranalytics/pySX127x and it's currently being tested with a RFM95 attached to a Raspberry PI. See: https://www.lora-alliance.org/portals/0/specs/LoRaWAN%20Specification%201R0.pdf

Special thanks

Thanks for nice implementation of LoRaWAN stack by jeroennijhof, which was more or less straightforward to reimplement to pure MicroPython.

ulorawan's People

Contributors

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