Using LoRa to integrate a cat into IoT

Duivendrecht, farm and church view
Duivendrecht, farm and church view

I have always dreamed of living in a village - with greenery and birds chirping in the summer - but not far from the city and the choice of amenities. And finally, the dream came true - I settled in a house with a garden in Duivendrecht, a quiet village closer to the center of Amsterdam than half of its own districts.





And cats are a must for a house with a garden.





- , , , .





, .





Escobar is a British blue cat that fully justifies its name.  Able to find loopholes and escape from almost any situation.
- , . .

. , , . - .





. , - .





-. - , , , - , - , .





Invoxia, Findster, Tractive . Invoxia SigFox, Tractive - GPRS , Findster - .





  • , 5 . - IoT 2G connectivity. 1-2 .





  • SigFox - - , . .





  • Findster - . 900 , 100+ - . - , .





  • - GNSS 2-3 .





LoRa The Things Network

- , . , , LoRa, .





  • LoRa EU 868MHz , .





  • LoRa chirp , , - .





  • LoRa - , . KPN .





  • LoRa





LoRa - - ?





Gateway



The Things Network TTN Indoor gateway 70 . (gateway wifi TTN , ) 10 .







TTN console is made with love, everything is clear and convenient.
TTN , .

- gateway , .





- . , .





Aurel GP 868 roof antenna
Aurel GP 868





  • ground plane ( Aurel GP 868, EUR 40,-)





  • IPEX - ( Aurel IPEX-to-BNC-female, EUR 3,-)





  • gateway, IPEX





Probably it could have been done more accurately, but it works like that.
, .

LoRa . TTN - , , , TTN. - 100 , 100 , +10 , .





( SLA) . 100% , , ?





Free TTN coverage in Amsterdam
TTN

- 1 , 6 , . LoRa .





LoRa , -. BroWAN Object Locator, Browan. , LoRa , CO2 . , .





( ), , , TTN.





BroWAN tab
BroWAN tab

28 , 540mAh, 8 , , .





, . Findster BroWAN tab - TTN KPN, .





, , -.





, , .





- . , - , , . , , .





, , , .





, . , , . , , , .





Tile - GNSS Bluetooth. , 10 ( 30-40, 10 ). 6 , .





Escobar in combat gear

, . :





, . - gateway ( ) TTN.





50 , , , .





Application in TTN console
TTN

Gateway , / TTN. TTN (device) (application) - , + - MQTT, HTTP .





Device configuration

TTN application - JSON. BroWAN :






function Decoder(bytes, port) {
    var params = {
        "bytes": bytes
    };

    bytes = bytes.slice(bytes.length-11);

      if ((bytes[0] & 0x8) === 0) {
        params.gnss_fix = true;
      } else {
        params.gnss_fix = false;
      }

      // Mask off enf of temp byte, RFU
      temp = bytes[2] & 0x7f;

      acc = bytes[10] >> 5;
      acc = Math.pow(2, parseInt(acc) + 2);

      // Mask off end of accuracy byte, so lon doesn't get affected
      bytes[10] &= 0x1f;

      if ((bytes[10] & (1 << 4)) !== 0) {
        bytes[10] |= 0xe0;
      }

      // Mask off end of lat byte, RFU
      bytes[6] &= 0x0f;

      lat = bytes[6] << 24 | bytes[5] << 16 | bytes[4] << 8  | bytes[3];
      lon = bytes[10] << 24 | bytes[9] << 16 | bytes[8] << 8  | bytes[7];

      battery = bytes[1];
      capacity = battery >> 4;
      voltage = battery & 0x0f;

      params.latitude = lat/1000000;
      params.longitude = lon/1000000;
      params.accuracy = acc;
      params.temperature = temp - 32;
      params.capacity = (capacity / 15) * 100;
      params.voltage = (25 + voltage)/10;
      params.port=port;

      return params;

}
view rawttn-browan hosted with ❤ by GitHub
      
      



TTN HTTP, catracker, .





Scala/Akka , TypeScript, Azure DevOps CI Kubernetes .





https://github.com/jacum/catracker.





Today it was raining and Barsik did not walk far

The interface is minimalistic but quite MVP - it shows the battery percentage, the position of the cat and the time since the last position update, if more than two minutes have passed. The screenshot was taken after 1 hour and 53 hours after the cat came home - the tracker does not send events if the accelerometer does not show movement.





Many thanks to TTN for reliable and inexpensive equipment, and a solid console, and BroWAN for the best LoRa trackers.





And of course to the cat Barsik for his daily efforts to test the solution.





Meow!
Meow!

The original of (my own) article








All Articles