Chis Dorin
Published

Determining heat loss

Monitoring the temperature in a building using IoT and displaying it on a web page, to determine the efficiency of insulation.

BeginnerFull instructions provided4 hours69
Determining heat loss

Things used in this project

Hardware components

WisGate Edge Lite 2 RAK7268\RAK7268C  Gateway for LoRaWAN
RAKwireless WisGate Edge Lite 2 RAK7268\RAK7268C Gateway for LoRaWAN
×1
WisBlock Base Board 2nd Gen | RAK19007
RAKwireless WisBlock Base Board 2nd Gen | RAK19007
×1
WisBlock LPWAN Module RAK4631
RAKwireless WisBlock LPWAN Module RAK4631
×1
WisBlock Temperature and Humidity Sensor RAK1901
RAKwireless WisBlock Temperature and Humidity Sensor RAK1901
×2
RAKwireless RAK11310 WisBlock LoRaWAN Module
×1
RAKwireless RAK19003 WisBlock Mini Base Board
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

RAKwireless WisBlock Mini Screwdriver

Story

Read more

Code

Cod for payload

C/C++
Since we have two "end devices", each one must transmit on a different port, so as not to overlap the data. I used port 10 for "device-1" and port 20 for "device-2".
function decodeUplink(input) {
  if (input.fPort === 10) {
    return {
      data: {
        temperature: ((input.bytes[0] << 8) | input.bytes[1]) / 100,
        humidity:    ((input.bytes[2] << 8) | input.bytes[3]) / 100
      },
      warnings: [],
      errors: []
    };
  }
  if (input.fPort === 20) {
    return {
      data: {
        temperature2: ((input.bytes[0] << 8) | input.bytes[1]) / 100,
        humidity2:    ((input.bytes[2] << 8) | input.bytes[3]) / 100
      },
      warnings: [],
      errors: []
    };
  }
  return {
    data: {
      bytes: input.bytes
    },

Code C++

Codes for two Lora thermometers, indoor/outdoor

Credits

Chis Dorin
1 project • 4 followers

Comments