Topic: LoRaWAN

Hey,

have you ever thought about a LoRaWAN version for the scale?

Re: LoRaWAN

Currently, the board we prototyped is a single board with sigfox modem.
But as I started to think about having a GSM version, it appeared clear that the strategy will be to have on one side  a main board, (with esp8266 (main mcu+wifi), Power regulator, rtc, motor driver, and optical endstop entry), and "daughter" board plugged in. Kind of the idea of arduino and shields, but simplified. 

The interface between both would be simple : 
- tx/rx serial uart
- +3V3 regulated when board wake up
- +VBAT
- GND

Doing this way, it'll easy to make variants. We can produce the main board by hundreds, and make à single prototype with engraver to test this or that modem, including lorawan of course.

3 (edited by phisch92 2018-11-18 19:27:34)

Re: LoRaWAN

In order to share my experience with the LoRa-OpenHiveScale here are my lessons learned:

1)    Integration in TTN:
Once in config-mode you should be able to get the DEVICE EUI from the LoRa module.
To adjust the NETWORK SESSION KEY you will need to recompile the firmware and update it with for example Arduino IDE. For version openhivescale_v4.8 you can do the necessary changes in the file modem.ino in line 180 (appeui) and 182 (appkey). After compiling and uploading the .bin-file to the scale you should be able to receive messages via LoRa.

2)    Payload decoder:
In order to decode the payload I used the following payload decoder:

function Decoder(bytes, port) {

var steps = (bytes[0] << 32 ) + (bytes[1] << 16)  + (bytes[2] << 8)  + bytes[3];

var factor = 303.4; // steps per kg as a conversion factor
var offset = -12.2; // setps of offset

var mass = (steps-offset) / factor; //calculating the actual mass based on the amount of steps
mass = mass.toFixed(3); // rounded to 3 decimal places
mass = parseFloat(mass); //changing the format from string to float
return {
  scale: steps,
  mass: mass
};
}

I am happy for ideas to improve. This is a very basic decoder.

3)    The scale will perform an OTAA to communicate with TTN (or any other LoRaWAN). So each time the scale sends something it will first perform a activation and doesn’t store the credentials form TTN yet. This causes the capacity of the battery to decrease faster. I will try to suggest some code to improve the energy consumption in the near future.

4)    It is very helpful to add a manual switch to the casing to turn on and off config-mode from the outside of the box. This way you can change parameters and update firmware even with a load on the scale. Because it is hard to get the box out of the scale unscrew it and put the little jumper on the pins when there are 50 kg on it. Plus I am actually not a bee keeper so I was a little bit nervous doing this the first couple of times with bees next to my head.

5)    It would be great to adjust the sending interval of the scale via LoRa downlink. This way one could increase measurements during day, turn them off when its raining, etc… I will play around with the code and share it once it works. smile

6)    I recommend everyone to do a simple calibration of the scale. Due to modifications, different materials of the scales and different assembling methods the conversion factor (263 steps / kg) might be different to each scale. Mine got a little offset as well.

Best regards
Philipp