add gateway type

This commit is contained in:
Ray Ozzie 2016-04-16 15:05:52 -07:00
parent 4013303e60
commit 37e018d1ff
2 changed files with 41 additions and 5 deletions

View File

@ -2,10 +2,10 @@
Resin Dockerfile & scripts for [The Things Network](http://thethingsnetwork.org/) gateways based on the Raspberry Pi. Resin Dockerfile & scripts for [The Things Network](http://thethingsnetwork.org/) gateways based on the Raspberry Pi.
It supports two configurations: It supports two configuration types, based on the gateway hardware you're attaching to your Raspberry Pi:
1. A [LinkLabs Raspberry Pi "Hat"](http://link-labs.myshopify.com/products/lorawan-raspberry-pi-board) 1. "linklabs-dev", a [LinkLabs Raspberry Pi "Hat"](http://link-labs.myshopify.com/products/lorawan-raspberry-pi-board)
2. An [IMST iC880A-SPI](http://webshop.imst.de/ic880a-spi-lorawan-concentrator-868mhz.html) configured as described [here](https://github.com/ttn-zh/ic880a-gateway/tree/spi) 2. "imst-ic880a-spi", an [IMST iC880A-SPI](http://webshop.imst.de/ic880a-spi-lorawan-concentrator-868mhz.html) configured as described [here](https://github.com/ttn-zh/ic880a-gateway/tree/spi)
## PREREQUISITES ## PREREQUISITES
@ -24,12 +24,13 @@ It supports two configurations:
## PREPARING YOUR FIRST GATEWAY DEVICE FOR TTN ## PREPARING YOUR FIRST GATEWAY DEVICE FOR TTN
Click the "Environment Variables" section at the left side of the screen. This will allow you to configure environment parameters for this and only this device, and which will be appropriately inserted into this device's "local_conf.json" with lowercase tuple names derived from the appropriate uppercase environment names beginning with "GW_". For example, for an IMST gateway with no GPS, the MINIMUM environment variables that you should configure at this screen should look something like this. For the LinkLabs gateway, which has a built-in GPS, you only need REGION, CONTACT_EMAIL, and DESCRIPTION. Click the "Environment Variables" section at the left side of the screen. This will allow you to configure environment parameters for this and only this device, and which will be appropriately inserted into this device's "local_conf.json" with lowercase tuple names derived from the appropriate uppercase environment names beginning with "GW_". For example, for an IMST gateway with no GPS, the MINIMUM environment variables that you should configure at this screen should look something like this:
DEVICE ENVIRONMENT VARIABLES DEVICE ENVIRONMENT VARIABLES
Name | Value Name | Value
------------------|-------------------------- ------------------|--------------------------
GW_TYPE | imst-ic880a-spi
GW_REGION | EU GW_REGION | EU
GW_CONTACT_EMAIL | yourname@yourdomain.com GW_CONTACT_EMAIL | yourname@yourdomain.com
GW_DESCRIPTION | your-gateway-1 GW_DESCRIPTION | your-gateway-1
@ -38,6 +39,17 @@ GW_REF_LATITUDE | 52.376364
GW_REF_LONGITUDE | 4.884232 GW_REF_LONGITUDE | 4.884232
GW_REF_ALTITUDE | 3 GW_REF_ALTITUDE | 3
On the other hand, for the LinkLabs gateway, which has a built-in GPS, you only need TYPE, REGION, CONTACT_EMAIL, and DESCRIPTION.
DEVICE ENVIRONMENT VARIABLES
Name | Value
------------------|--------------------------
GW_TYPE | linklabs-dev
GW_REGION | EU
GW_CONTACT_EMAIL | yourname@yourdomain.com
GW_DESCRIPTION | your-gateway-1
## TRANSFERRING TTN GATEWAY SOFTWARE TO RESIN SO THAT IT MAY BE DOWNLOADED ON YOUR DEVICES ## TRANSFERRING TTN GATEWAY SOFTWARE TO RESIN SO THAT IT MAY BE DOWNLOADED ON YOUR DEVICES
1. On your Mac or PC, in terminal, change your working directory to the directory that is the clone of **this** git repo. 1. On your Mac or PC, in terminal, change your working directory to the directory that is the clone of **this** git repo.

26
run.sh
View File

@ -33,11 +33,19 @@ echo GW_REGION: $GW_REGION
if [[ $GW_DESCRIPTION == "" ]]; then if [[ $GW_DESCRIPTION == "" ]]; then
echo "ERROR: GW_DESCRIPTION required" echo "ERROR: GW_DESCRIPTION required"
echo "See https://github.com/rayozzie/ttn-resin-gateway-rpi/blob/master/README.md"
exit 1 exit 1
fi fi
if [[ $GW_CONTACT_EMAIL == "" ]]; then if [[ $GW_CONTACT_EMAIL == "" ]]; then
echo "ERROR: GW_CONTACT_EMAIL required" echo "ERROR: GW_CONTACT_EMAIL required"
echo "See https://github.com/rayozzie/ttn-resin-gateway-rpi/blob/master/README.md"
exit 1
fi
if [[ $GW_TYPE == "" ]]; then
echo "ERROR: GW_TYPE required"
echo "See https://github.com/rayozzie/ttn-resin-gateway-rpi/blob/master/README.md"
exit 1 exit 1
fi fi
@ -158,8 +166,10 @@ echo "******************"
echo "******************" echo "******************"
echo "" echo ""
# Reset iC880a PIN - this is necessary to reset its state # Reset the board to a known state prior to launching the forwarder
if [[ $GW_TYPE == "imst-ic880a-spi" ]]; then
echo "Resetting IMST iC880A-SPI"
gpio -1 mode 22 out gpio -1 mode 22 out
gpio -1 write 22 0 gpio -1 write 22 0
sleep 0.1 sleep 0.1
@ -167,6 +177,20 @@ gpio -1 write 22 1
sleep 0.1 sleep 0.1
gpio -1 write 22 0 gpio -1 write 22 0
sleep 0.1 sleep 0.1
if [[ $GW_TYPE == "linklabs-dev" ]]; then
echo "Resetting LinkLabs Raspberry Pi Development Board""
gpio -1 mode 29 out
gpio -1 write 29 0
sleep 0.1
gpio -1 write 29 1
sleep 0.1
gpio -1 write 29 0
sleep 0.1
else
echo "ERROR: unrecognized GW_TYPE=$GW_TYPE"
echo "See https://github.com/rayozzie/ttn-resin-gateway-rpi/blob/master/README.md"
exit 1
fi
# Fire up the forwarder. # Fire up the forwarder.