orb:fieldbasestation

This is an old revision of the document!


Octanis 1 Field Basestation

This system is comprised of a Raspberry Pi connected to a LoRaWAN Shield and the dGPS Base station. An operator can connect to the system via Ethernet, after which they will be assigned an IP address by the Raspberry Pi. The operator then opens APM Planner, which will start receiving MAVLink packages automatically. The operator can also use APM Planner to send commands to the rover. Theses commands will be relayed by the Field Base Station using a “MAVLink to MQTT Bridge” which we still have to code.

Raspberry Pi 1 running:

  • Linklabs LoRa Gateway Service (packet_forwarder)
  • Brocaar's loraserver & lora-gateway-bridge (in /opt/brocaar), which require:
    • Redis (sudo apt-get install redis-server)
    • Postgresql (sudo apt-get install postgresql)
    • Mosquitto (sudo apt-get install mosquitto)
    • packet_forwarder
  • MAVLink to MQTT bridge (TODO)
  • DHCP Server (TODO, as last task only)

How to run manually (only necessary if Monit didn't do it's job):

  • If running for the first time, create a new postgres user and db for loraserver:
    • $ sudo su - postgres
      $ psql template1
      template1=# CREATE USER linklabs WITH PASSWORD 'linklabs';
      template1=# CREATE DATABASE loraserver;
      template1=# GRANT ALL PRIVILEGES ON DATABASE loraserver to linklabs;
      template1=# \q
      $ exit
  • If all prerequisites are installed, lora-gateway-bridge can be run with no arguments.
  • Then you can run
 ./loraserver --net-id 747474 --band EU_863_870 --postgres-dsn "postgres://linklabs:linklabs@localhost/loraserver?sslmode=disable" --db-automigrate

Setting up nodes

  • On the RN2483:
    • mac get deveui → write down somewhere
    • mac set appeui 70b3d57ed0000172 → Octanis 1 App on the Field Station
    • mac set appkey 01020304050607080910111213141516 → arbitrary key (must be same as on loraserver!)
    • mac join otaa → join the network, loraserver on Field Station will accept if OK
      • as a response, RN2483 will output ok and then after a few seconds accepted

Subscribing to nodes

  • mosquitto_sub -h 192.168.174.1 -t “application/70b3d57ed0000172/node/+/rx” -v more here
  • mosquitto_pub -h 192.168.174.1 -t “application/70b3d57ed0000172/node/f03d291000000046/tx” -m '{“reference”:“mavlink”,“devEUI”:“f03d291000000046”,“fPort”:1,“confirmed”: false,“data”:“3q2+796tvu8=”}' -q 0 → base64 encoded data (plaintext) - more here

Setting up LinkLabs Concentrator

  • Add kernel.sysrq=0 to /etc/sysctl.conf
  • Run sudo systemctl mask serial-getty@ttyAMA0.service

Example of received data from mosquitto_sub. Data is base64 encoded.

  <code>
   {"devEUI":"f03d291000000046","fPort":1,"gatewayCount":1,"rssi":-72,"data":"/gkAGQAAAAAAAAoAQAMDG0A="}

{“devEUI”:“f03d291000000046”,“fPort”:1,“gatewayCount”:1,“rssi”:-72,“data”:“/gkCGQAAAAAAAAoAQAMDz70=”} {“devEUI”:“f03d291000000046”,“fPort”:1,“gatewayCount”:1,“rssi”:-69,“data”:“/gkEGQAAAAAAAAoAQAMDorM=”} {“devEUI”:“f03d291000000046”,“fPort”:1,“gatewayCount”:1,“rssi”:-69,“data”:“/gkJGQAAAAAAAAoAQAMDktE=”} {“devEUI”:“f03d291000000046”,“fPort”:1,“gatewayCount”:1,“rssi”:-72,“data”:“/gkKGQAAAAAAAAoAQAMDrFI=”} {“devEUI”:“f03d291000000046”,“fPort”:1,“gatewayCount”:1,“rssi”:-70,“data”:“/gkNGQAAAAAAAAoAQAMDKyI=”} {“devEUI”:“f03d291000000046”,“fPort”:1,“gatewayCount”:1,“rssi”:-70,“data”:“/gkOGQAAAAAAAAoAQAMDFaE=”} {“devEUI”:“f03d291000000046”,“fPort”:1,“gatewayCount”:1,“rssi”:-69,“data”:“/gkSGQAAAAAAAAoAQAMDGGs=”} {“devEUI”:“f03d291000000046”,“fPort”:1,“gatewayCount”:1,“rssi”:-71,“data”:“/gkTGQAAAAAAAAoAQAMD8hU=”} {“devEUI”:“f03d291000000046”,“fPort”:1,“gatewayCount”:1,“rssi”:-70,“data”:“/gkWGQAAAAAAAAoAQAMDoZg=”} {“devEUI”:“f03d291000000046”,“fPort”:1,“gatewayCount”:1,“rssi”:-70,“data”:“/gkXGQAAAAAAAAoAQAMDS+Y=”} {“devEUI”:“f03d291000000046”,“fPort”:1,“gatewayCount”:1,“rssi”:-70,“data”:“/gkbGQAAAAAAAAoAQAMDkfo=”} {“devEUI”:“f03d291000000046”,“fPort”:1,“gatewayCount”:1,“rssi”:-71,“data”:“/gkcGQAAAAAAAAoAQAMDFoo=”} {“devEUI”:“f03d291000000046”,“fPort”:1,“gatewayCount”:1,“rssi”:-71,“data”:“/gkgGQAAAAAAAAoAQAMDpOU=”} {“devEUI”:“f03d291000000046”,“fPort”:1,“gatewayCount”:1,“rssi”:-70,“data”:“/gkhGQAAAAAAAAoAQAMDTps=”} {“devEUI”:“f03d291000000046”,“fPort”:1,“gatewayCount”:1,“rssi”:-71,“data”:“/gklGQAAAAAAAAoAQAMD92g=”} {“devEUI”:“f03d291000000046”,“fPort”:1,“gatewayCount”:1,“rssi”:-70,“data”:“/gkmGQAAAAAAAAoAQAMDyes=”} {“devEUI”:“f03d291000000046”,“fPort”:1,“gatewayCount”:1,“rssi”:-72,“data”:“/gknGQAAAAAAAAoAQAMDI5U=”} </code>

  • orb/fieldbasestation.1467923421.txt.gz
  • Last modified: 5 years ago
  • by sam