-
Notifications
You must be signed in to change notification settings - Fork 3
RAK831
This tutorial will show you how to add a LoRa Gateway using a RAK831 LoRa Gateway Concentrator Module and a Raspberry Pi 3 to OpenChirp. You need to get a RAK831 board as well as a RPI adapter that can usually be purchased together. This gateway is based on the Semtech AP1 design (not quite as good as the AP2, but fine for most purposes) and has worked quite well for us in testing. We did however replace the stock antenna with a larger one.
You can also buy a kit with adapter boards at [AliExpress] [with RPI] [with GPS].
.
Please follow the Devices Tutorial to create an OpenChirp Device and Generate a Device Token.
You will need the device id
, endpoint
, and the device token
later for configuring the lora-gateway-bridge. Use the LoRa Gateway Template
when making your device so you have all of the standard transducers. After you are done setting up your RPI, you will install a LoRaWAN Gateway Service
which will take a gateway_ID
that is generated from the software running on your PI.
Use the Raspbian website to download the latest Raspbian Stretch Lite operating system and flash it to the SD card. Plug in a monitor and USB keyboard to the PI. After booting into the operating system used the raspi-config
command to enable the SPI interface (under "Interface Options" menu). Reboot the OS. While in raspi-config
and under "Interface Options" you might want to also enable ssh for remote access. You can run ifconfig
to see your IP address.
Login and setup user accounts: Linux Users
Setup wireless: CLI WiFi Config
You likely want to run "sudo apt-get update" to update the latest package list.
# Setting the Time Zone, Date, and Time
sudo ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
# Install the NTP package
sudo apt install ntp ntpstat
# Add local ntp servers to /etc/ntp.conf and restart the service
# (Use a list of ntp server close the LoRa Gateway)
server 0.debian.pool.ntp.org iburst preempt
server 1.debian.pool.ntp.org iburst preempt
server 2.debian.pool.ntp.org iburst preempt
server 3.debian.pool.ntp.org iburst preempt
server new-parsley.srv.cs.cmu.edu iburst preempt
server new-sage.srv.cs.cmu.edu iburst preempt
server new-rosemary.srv.cs.cmu.edu iburst preempt
server coriander.srv.cs.cmu.edu iburst preempt
server fennel.srv.cs.cmu.edu iburst preempt
server paprika.srv.cs.cmu.edu iburst preempt
server time.nist.gov preempt
server time1.google.com iburst preempt
server time2.google.com iburst preempt
server time3.google.com iburst preempt
server time4.google.com iburst preempt
server time1.apple.com preempt
server time2.apple.com preempt
server time3.apple.com preempt
server time4.apple.com preempt
server time5.apple.com preempt
server time6.apple.com preempt
server time7.apple.com preempt
# Restart the service
sudo systemctl restart ntp
# Check if the servers are used and if the time has been adjusted
ntpq -pn
date
# Update the hardware clock (if present)
hwclock -u -w
Download the latest release of the precompiled Packet Forwarder installer (.deb) from the Openchirp repo.
For example:
wget https://github.com/OpenChirp/lora_gateway_pf/releases/download/v1.0.6/lora-gateway-pf_1.0.6_armhf.deb
Install the package
sudo dpkg -i lora-gateway-pf_1.0.6_armhf.deb
edit lora-gateway-pf config
sudo nano /opt/lora-gateway-pf/scripts/gwrst.sh
change RESET_PIN to 17 instead of 7 and save
Copy the right region file
cd /etc/lora-gateway-pf/
sudo cp aux/global_conf_[_REGION_].json global_conf.json
Start the service
sudo systemctl start lora-gateway-pf
Confirm that the service is running
systemctl status lora-gateway-pf
Download the latest release of the precompiled LoRa Gateway Bridge (lora-gateway-bridge_x.x.x-x_armhf.deb
) from the OpenChirp lora-gateway-bridge releases page.
wget https://github.com/OpenChirp/lora-gateway-bridge/releases/download/OC-2.1.5-23/lora-gateway-bridge_2.1.5-23-gdc983b1_armhf.deb
Install the package
sudo dpkg -i lora-gateway-bridge_2.1.5-23-gdc983b1_armhf.deb
Configure the gateway bridge service by modifying /etc/default/lora-gateway-bridge
.
Please set the following parameters as indicated:
-
MQTT_SERVER
="tls://mqtt.openchirp.io:8883" -
MQTT_PREFIX
="<your_openchirp_device_endpoint> available on the OC website for your device" -
MQTT_USERNAME
="<your_openchirp_device_id> which is the last 24 digits, number part, of the endpoint" -
MQTT_PASSWORD
="<your_openchirp_device_generated_token>"
<your_openchirp_device_endpoint>
, <your_openchirp_device_id>
, and <your_openchirp_device_generated_token>
should be replaced based on your OpenChirp device you created earlier.
Start the service and confirm that it is running properly
sudo systemctl start lora-gateway-bridge
sudo systemctl status lora-gateway-bridge
After starting the service a gateway ID is composed from the Ethernet MAC address. It is stored in the local configuration file (/etc/lora-gateway-pf/local_conf.json
) as gateway_ID
. This ID is needed by OpenChirp. To get it run:
cat /etc/lora-gateway-pf/local_conf.json
Using the OpenChirp.io website, navigate to your previously created OpenChirp Device. Navigate to the Services
tab and click Link Service
. Select LoRaWAN Gateway
, input your gateway_ID
, and click Save
. After refreshing the page, you should see a status that indicates your gateway was registered with the provided ID.
You may also want to add the TimeSeries
service for visualizing debug data over time.
Edit /etc/lora-gateway-pf/local_conf.json
add fake_GPS options:
{
"gateway_conf": {
"gateway_ID": "xxxxxxxxxxx",
"autoquit_threshold": 5,
//"gps_tty_path": "/dev/ttyAMA0",
"server_address": "localhost",
"serv_port_up": 1700,
"serv_port_down": 1700,
"fake_gps": true,
"ref_latitude": 40.244362,
"ref_longitude": -79.519109,
"ref_altitude": 0
}
}
OpenChirp is a research project started by the WiseLab at Carnegie Mellon University.
- Simple Device Tutorial
- PubSub Overview
- Time Series Data
- Device Tutorial
- Generate User Token Tutorial
- LoRaWAN Specific
-
Services
- Byte Translator
- Easybits
- Time Series Storage
- Event Trigger
- LoRaWAN Gateway
- GPS Mapper
- Custom Service
- Openchirp Packages
- REST API