https://github.com/rroemhild/ruuvitag-lorawan
Publish RuuviTag sensor data with LoRaWAN
https://github.com/rroemhild/ruuvitag-lorawan
bluetooth iot lorawan micropython pycom pycom-lopy ruuvitag thethingsnetwork
Last synced: 7 months ago
JSON representation
Publish RuuviTag sensor data with LoRaWAN
- Host: GitHub
- URL: https://github.com/rroemhild/ruuvitag-lorawan
- Owner: rroemhild
- License: mit
- Created: 2018-03-11T14:45:49.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-02-26T16:09:02.000Z (over 4 years ago)
- Last Synced: 2025-03-15T00:47:52.702Z (7 months ago)
- Topics: bluetooth, iot, lorawan, micropython, pycom, pycom-lopy, ruuvitag, thethingsnetwork
- Language: Python
- Homepage:
- Size: 215 KB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE-CODE.txt
Awesome Lists containing this project
README
=========================================
Publish RuuviTag sensor data with LoRaWAN
=========================================This repository contains the up to date snippets for the `Publish RuuviTag sensor data on The Things Network `_ tutorial.
This PoC uses settings specifically for connecting to LoRaWAN networks within the European 868 MHz region. For other regions usage, please see the `settings.py` and `lib/lorawan.py` file for relevant sections that need to be changed.
Data Format
-----------For each RuuviTag we send 8 bytes. The RuuviTag ID is the index from the mac address in the `settings.py` list. We match this later in the decoder.
+--------+---------------------------------------------+
| Offset | Description |
+========+=============================================+
| 0 | Tag ID (8bit) |
+--------+---------------------------------------------+
| 1-2 | Temperature in 0.005 degrees (16bit signed) |
+--------+---------------------------------------------+
| 3-4 | Humidity in 0.0025% (16bit unsigned) |
+--------+---------------------------------------------+
| 5-6 | Batter voltage + 1600 (16bit unsigned) |
+--------+---------------------------------------------+
| 7-8 | RSSI * -1 (8bit) |
+--------+---------------------------------------------+In example for 2 RuuviTags the following payload will be send:
.. code-block:: python
b'\x00\x05$\x8e\xf8\x04\x8f[\x01\x11d/@\x05\rB'
+----+------+--------+---------+------+----+------+--------+---------+------+
| ID | Temp | Humid | Voltage | RSSI | ID | Temp | Humid | Voltage | RSSI |
+====+======+========+=========+======+====+======+========+=========+======+
| 00 | 0524 | 8EF8 | 048F | 5B | 01 | 1164 | 2F40 | 050D | 42 |
+----+------+--------+---------+------+----+------+--------+---------+------+Read more about the data format used in this project in the `Ruuvi Sensor Data Format 5 Protocol Specification `_.
Payload Format Decoder
----------------------Example payload format decoder for the The Things Network Console. The var `map` is used to identify each Ruuvitag by name. The oder must match the order in the `RUUVITAG` list in the `settings.py`.
.. code-block:: javascript
var map = ["outdoor", "livingroom"];
function Decoder(bytes, port) {
var ruuvitags = {};
var tags = bytes.length / 8;for (i=0;i