Pollutants.eu Monitor kvality ovzduší v České republice

1. Our LoRaWAN payload settled by following fragment of code:

  AppData.Port = LORAWAN_USER_APP_PORT;
  AppData.Buffer[i++] = (PM1) >> 8;
  AppData.Buffer[i++] = (PM1)%256;
  AppData.Buffer[i++] = (PM2_5)>>8;
  AppData.Buffer[i++] = (PM2_5)%256;
  AppData.Buffer[i++] = (PM10)>>8;
  AppData.Buffer[i++] = (PM10)%256;
  int16_t tempVar;
  tempVar = ((int16_t)(temperatureTX*100.0)) + 10000;
  AppData.Buffer[i++] = tempVar/100;
  AppData.Buffer[i++] = tempVar%100;
  tempVar = ((int16_t)(humidity*100.0));
  AppData.Buffer[i++] = tempVar/100;
  AppData.Buffer[i++] = tempVar%100;
  AppData.Buffer[i++] = VOC/256;
  AppData.Buffer[i++] = VOC%256;
  AppData.Buffer[i++] = extBattery;
  AppData.Buffer[i++] = LEDON;

 here you may see, than first 2 bytes in payload occupied by PM1 data (ultradisperse particles), next 2 bytes: PM2.5, then next 2 bytes: PM10, next 2 bytes by temperature, next 2 bytes by humidity, next 2 bytes by VOC (volatile organic compounds index), next byte by battery charge and the last one is LED status on/off.

2. In helium console we need to create decoder function (menu Functions), example flow:

decoder function may look like:

 

 
function Decoder(bytes, port, uplink_info) {

var decoded = {};
    decoded.PM1 = ((bytes[0]*256 +  bytes[1])/10.0).toFixed(2);
    decoded.PM2_5 = ((bytes[2]*256 +  bytes[3])/10.0).toFixed(2);
    decoded.PM10 = ((bytes[4]*256 +  bytes[5])/10.0).toFixed(2);
    decoded.T = (-100.0 + bytes[6] +  bytes[7]/100.0).toFixed(2);
    decoded.RH = (bytes[8] +  bytes[9]/100).toFixed(2);
    decoded.VOC = ((bytes[10]*256 + bytes[11])/10.0).toFixed(2);
    decoded.Battery = (bytes[12]*(2.82/76)).toFixed(2);//52.08;//31.06;
    decoded.LEDON = bytes[13];
  return decoded;
}

 

3. After decoder next step to pass (see flow above)  webhook to devices.sensor.community with your node tag . Particulate matter (PM10 and PM2.5) and (temperature and humidity) separately.

These webhooks in helium console created like integrations:

 

HTTP webhooks integrations:

 1.a) set the header, for PM particles as following (this node001_PM webhook):

* sensor ID =

 

Sensor UID

below is printscreen from sensor.community:

 

1.b) set the Advanced - JSON Message Template on the same page as follow (TEMPLATE BODY) - will be available then you press "ADD INTEGRATION" on the bottom :

{
  "software_version": "1",
  "sensordatavalues": [
      {"value_type": "P1","value": "{{decoded.payload.PM10}}"},
      {"value_type": "P2","value": "{{decoded.payload.PM2_5}}"}
  ]
}
 

2.a) Next webhook dedicated to temperature and humidity (node001_TH webhook):

* sensor ID =

  Sensor UID

 

2.b) set the Advanced - JSON Message Template on the same page as follow (TEMPLATE BODY) - will be available then you press "ADD INTEGRATION" on the bottom:

 

{
  "software_version": "1",
  "sensordatavalues": [
      {"value_type":"temperature","value": "{{decoded.payload.T}}"},
      {"value_type":"humidity","value": "{{decoded.payload.RH}}"}
  ]
}