For handling the generated data and the LoRaWAN gateways, i decided to use ChirpStack
Chirpstack is an open source LoRaWAN Network Server. For a gateway, i use a raspberry pi with a concentrator card.
Chirpstack also decodes the data and sends it to my storage and visualisation server, i will show in another post.
The decoder for my data is written in java script and looks something like this.
// v3 to v4 compatibility wrapper
function decodeUplink(input) {
return {
data: Decode(input.fPort, input.bytes, input.variables)
};
}
function encodeDownlink(input) {
return {
bytes: Encode(input.fPort, input.data, input.variables)
};
}
function Decode(fPort, bytes, variables) {
var devtype = "be";
var rawhex = toHexString(bytes);
var t1 = ((bytes[0]*256 + bytes[1]) / 100);
var t2 = ((bytes[2]*256 + bytes[3]) / 100);
var t3 = ((bytes[4]*256 + bytes[5]) / 100);
var t4 = ((bytes[6]*256 + bytes[7]) / 100);
var t5 = ((bytes[8]*256 + bytes[9]) / 100);
var t6 = ((bytes[10]*256 + bytes[11]) / 100);
var t7 = ((bytes[12]*256 + bytes[13]) / 100);
var t8 = ((bytes[14]*256 + bytes[15]) / 100);
return {
rawhex: rawhex,
devtype: devtype,
t1: t1,
t2: t2,
t3: t3,
t4: t4,
t5: t5,
t6: t6,
t7: t7,
t8: t8,
};
}
function toHexString(byteArray) {
var s = '';
byteArray.forEach(function(byte) {
s += ('0' + (byte & 0xFF).toString(16)).slice(-2);
});
return s;
}