The first node already running nonstop for about one year.
PCB added into repo, enjoy! Build your sustainable node now!
Downlink commands supported
- Reset the device via sending downlink on Port2:
FF FF FF FF FF FF
- Set transmit period (in milliseconds) via downlink on Port2:
01 00 XX XX XX XX
(XX XX XX XX - milliseconds coded in hex (big endian), ex. for 5 minutes = 300,000 ms = 00 04 93 E0) - Set measuring period (in minutes) via downlink as for now provided with LED_ON command in one 2-bytes downlink message on Port2: 01 XX - LED ON and measuring period = XX minutes, 00 XX - LED is OFF and measuring period = XX minutes This LED enhanced with FET transistor, so you may connect some load to be switched ON/OFF (see the schematic in PCB folder)
The node uplink data packet containing 13 payload bytes with following data - PM1 concentration, PM2.5 concentration, PM10 concentration, temperature, humidity, volatile organic compound index (VOC), battery level related to volts, status of LED output. Decoder for payload on server side (uplink):
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]*0.0238).toFixed(2);//battery , volts decoded.LEDON = bytes[13]; decoded.RSSI = normalizedPayload.gateways[0].rssi.toFixed(0); decoded.SNR = normalizedPayload.gateways[0].snr.toFixed(0); decoded.FREQUENCY = normalizedPayload.frequency; return decoded; }
Downlink payload encoder example:
function Encoder(measurements, port) { if(measurements.LED_ON.value) return [1]; else return [0];
}
Before compile please edit comissioning in CubeMX (.ioc). Network ID may be left 0, if you are connecting to any first public network available (may be useful if you planning to transfer to a different LoRaWAN network lately, then you may set the nodes commisionings on other's network console, reset the node and delete commisionings on old networks console, following the second reset of the node)