Sensors Connectivity

This Aira package allows you to read data from a SDS011 sensor and publish to different output channels. That said Aira is able to form a json formatted message with measurements and publish to a few channels. Also it includes Datalog feature which is still experimental. It could be used to publish data to Substrate based blockchain by Robonomics.

The last release is Sensors Connectivity v0.2

Sensor Connectivity Protocol :: v1

Sensor to Station

TCP Session diagram

HEADERDATA1DATA2DATA3...DATAN

where HEADER is 34 bytes

Name
0x00public_id
0x20codec_id
  • public_id - Public identifier, generated on sensor setup.
  • codec_id - Type of used data codec.

Data frame

Name
0x22payload
0xNNsignature
  • payload - Sensor measurements.
  • signature - Measurement Ed25519 signature, 64 bytes long. (pynacl)

For SDS011 sensor payload consists of 4 float numbers: PM2.5, PM10, GEO_LAT, GEO_LON

Station to Robonomics

The default output channel is Robonomics protocol over IPFS pubsub. For every measurement connectivity produces the following json formatted string:

{public_id: {"model": codec_id,"timestamp": unix_timestamp, "measurement": {"pm25": PM2.5, "pm10": PM10, "geo": "GEO_LAT,GEO_LON"}}}

Stations and Feeders

In Sensors Connectivity there are two entities: station and feeder.

Station

Station represents a source of data. The package can handle many inputs simultaneously:

station1 \                        / output1
station2 -  sensors-connectivity  - output2
station3 /                        \ output3

There are COM Station and TCP Station implemented. The first one reads data from a sensor that is connected to a serial port. TCP Station starts a tcp server and listens to incoming connections.

TCP Station can accept data from every sensor or you can specify an access control list (ACL) for known sensors only.

Feeder

Feeder is an output in terms of sensors connectivity:

input1 \                        / feeder1
input2 -  sensors-connectivity  - feeder2
input3 /                        \ feeder3

At current implementation the package can publish data to Luftdaten, Robonomics or Robonomics on Substrate (using Datalog feature).

Connectivity Configuration

The package is highly configurable. The default configuration file looks like:

# Please DO NOT edit this file
# Make a copy instead, make changes and pass the absolute path to the copy in arguments
general:
  publish_interval: 300 # time between two published messages
comstation:
  port: "/dev/ttyUSB0"  # COM port of the device
  work_period: 300      # time between two measurements in seconds
  geo: ""               # Geo coordinates as latitude,longitude
  public_key: ""        # If not provided, COMStation creates itself
tcpstation:
  address: ""           # IP and PORT to listen to, for example 0.0.0.0:31313
  acl:                  # list of known addresses. If not specified accepts from everyone
  # -
  # -
luftdaten:
  enable: true          # whether or not publish to https://luftdaten.info/
robonomics:
  enable: true          # enable use of Robonomics Network
  ipfs_provider: ""     # ipfs endpoint
  ipfs_topic: "airalab.lighthouse.5.robonomics.eth"
datalog:
  enable: false         # enable use of Datalog Robonomics subcommand
  path: ""              # path to Robonomics execution file
  suri: ""              # private key of publisher account
  remote: "wss://substrate.ipci.io"
  dump_interval: 3600   # time between two transactions in seconds
  temporal_username:    # set to pin files in Temporal.Cloud
  temporal_password:
dev:
  sentry: ""

To get familiar with all the options and launch scenarios check the README.md out.