Difference between revisions of "LoraLuftdatenForwarder"

From RevSpace
Jump to navigation Jump to search
m (Compilation)
Line 24: Line 24:
 
   git clone https://github.com/bertrik/LoraLuftdatenForwarder.git
 
   git clone https://github.com/bertrik/LoraLuftdatenForwarder.git
 
* enter the LoraLuftdatenForwarder/gradle directory
 
* enter the LoraLuftdatenForwarder/gradle directory
cd LoraLuftdatenForwarder/gradle
+
  cd LoraLuftdatenForwarder/gradle
* run the gradle script to build the software
+
* run the gradle script to build the software:
./gradlew assemble
+
  ./gradlew assemble
 
* the application zip is now available in LoraLuftdatenForwarder/LoraLuftdatenForwarder/build/distributions
 
* the application zip is now available in LoraLuftdatenForwarder/LoraLuftdatenForwarder/build/distributions
  
Line 32: Line 32:
 
* Update software from github archive:
 
* Update software from github archive:
 
   git pull
 
   git pull
* perform the steps above again
+
* perform the last two steps above again
  
 
== Installation ==
 
== Installation ==

Revision as of 13:24, 7 March 2021

Project LoraLuftdatenForwarder
350px
LoRaWAN forwarder for particulate matter data
Status In progress
Contact bertrik
Last Update 2021-03-07

What is this

This is a Java application that sends airborne particulate matter measurement data from TheThingsNetwork and forwards it to sensor.community (formerly Luftdaten).

It is used in combination with my LoraWanDustSensor: the sensor sends measurement data to TheThingsNetwork, this application picks up the data from TheThingsNetwork and forwards it to sensor.community and to opensensemap.org.

Requirements

You need the following:

  • a server that is always on and connected to the internet, can be Linux or Windows
  • a Java installation (JDK to compile), at least version 8
  • some configuration on TheThingsNetwork side
  • some configuration of my application (YAML file)

Compilation

To compile the software:

  • clone the software from my github archive
 git clone https://github.com/bertrik/LoraLuftdatenForwarder.git
  • enter the LoraLuftdatenForwarder/gradle directory
 cd LoraLuftdatenForwarder/gradle
  • run the gradle script to build the software:
 ./gradlew assemble
  • the application zip is now available in LoraLuftdatenForwarder/LoraLuftdatenForwarder/build/distributions

To update to the latest version:

  • Update software from github archive:
 git pull
  • perform the last two steps above again

Installation

Unzip the distribution file somewhere on your system. I put it in my home directory, for example

 cd
 tar xvf code/LoraLuftdatenForwarder/LoraLuftdatenForwarder/build/distributions/LoraLuftdatenForwarder.tar

Configuration

Device side

The particulate matter measurement device needs to send data in the Cayenne format. I used the following conventions:

  • PM10 is encoded as analog value on channel 1
  • PM2.5 is encoded as analog value on channel 2
  • PM1.0 is encoded as analog value on channel 0 (optional)
  • Temperature is encoded using standard Cayenne encoding (optional)
  • Humidity is encoded using standard Cayenne encoding (optional)
  • Barometric pressure is encoded using standard Cayenne encoding (optional)

TheThingsNetwork

You need to define an 'application' on TheTheThingsNetwork.

  • Go the TTN console: https://console.cloud.thethings.network/ and log in
  • You need an 'application', create a new one, or use an existing one
  • Within the application, ou need a 'device', create a new one, or use an existing one:
    • OTAA
    • Use the application keys as specified in my [[1]] page
    • Enter the device EUI as displayed on the display
  • You need an API key
    • Create this on the TTN console, for now just create a key that grants all rights
    • NOTE: you have only one chance to copy this key somewhere, so copy/paste it locally to a text file or something

This application

To configure the application:

  • Start the application without a configuration file, this will create a default template, stop the application again
 cd LoraLuftdatenForwarder
 bin/LoraLuftdatenForwarder
 (ctrl-C)
  • Edit the loraluftdatenforwarder.yaml file, example:
---
ttn:
  mqtt_url_v2: "tcp://eu.thethings.network"
  mqtt_url_v3: "tcp://eu1.cloud.thethings.network"
  identity_server_url: "https://eu1.cloud.thethings.network"
  identity_server_timeout: 20
  apps:
  - name: "particulatematter"
    version: "V3"
    key: "NNSXS......."
    encoding: "CAYENNE"
luftdaten:
  url: "https://api.sensor.community"
  timeout: 20
opensense:
  url: "https://api.opensensemap.org"
  timeout: 20
  ids:
    "0ttn-deveui-here": "put-opensense-boxid-here"
    "0004A30B001E00BE": "5eca4a0fd0545b001c0e5d46"

Sensor.community

TODO

  • Go to https://devices.sensor.community/ and log in
  • Register a node with id 'TTN-<device-EUI-as-shown-on-display>'
  • Register it with the proper configuration, e.g. SDS011 with BME280

Opensensemap

TODO

  • Create a node with the proper configuration
  • Copy the opensensenmap 'box id'
  • Add an attribute in the TTN console:
    • Go to the TTN console, General settings of the device
    • Add attribute, name = 'opensense-id', value = box id that you just copied
  • The boxid should be picked up automatically by the forwarder, within an hour