Setup IC880A-SPI (LoRaWAN concentrator) on Raspberry Pi 3
Configure Raspberry Pi
1. Install Rasbian OS on Raspberry Pi
The official installation guide is available at: https://www.raspberrypi.org/documentation/installation/installing-images/README.md
- First, we download the image file from: https://www.raspberrypi.org/downloads/ - Once we have the image file, we can install it into Raspberry Pi SD card with “Etcher”: . Etcher is a graphical SD card writing tool. . Download and install Etcher from: https://etcher.io/ . Connect an SD card reader with the SD card inside. . Open Etcher and select from your hard drive the Raspberry Pi “.img” or “.zip” file you wish to write to the SD card. . Select the SD card you wish to write your image to. . Review your selections and click 'Flash!' to begin writing data to the SD card. - Once we wrote the image file into the SD card. We can mount the SD card into Raspberry Pi. And boot up the OS by connecting the power supply to power socket.
2. Configure Local time
We need to configure the Raspberry Pi local. So that the LoRaWAN software is can access to the correct time.
- Type sudo raspi-config - Choose Internationalisation Options - And configure your local time and time zone
3. Enable SPI Interface
- sudo raspi-config - Select “Advanced Options” - Select the “SPI” option - Set the option to “Yes”
Connect IC880A-SPI to Raspberry Pi
Additional document: https://github.com/ttn-zh/ic880a-gateway/wiki
In order to connect the IC880A-SPI to Raspberry Pi the following PIN on IC880A-SPI have to be connected.
PIN | PIN Name | PIN Type | Description |
21 | VDD | Power | "+5 V Supply Voltage(>700mA)" |
22 | GND | Power | |
14 | CLK | Input | Sx1301 SPI-Clock |
15 | MISO | Output | Sx1301 SPI-MISO |
16 | MOSI | Input | Sx1301 SPI-MOSI |
17 | NSS | Input | Sx1301 SPI-NSS |
13 | Reset | Reset | Sx1301 SPI-reset |
12 | GND | Power |
We use the LoRaWAN software from GitHub and the PIN we need to connect to on Raspberry Pi is the following:
IC880A | Name | Raspberry Pi (Physical PIN) |
21 | Supply 5V | 2 |
22 | GND | 6 |
13 | Reset | 22 |
14 | SPI CLK | 23 |
15 | MISO | 21 |
16 | MOSI | 19 |
17 | NSS | 24 |
Once we have connect the PIN to Raspberry Pi. We can start installing the LoRaWAN software onto the Raspberry Pi.
Prepare IC880A-SPI reset script
Once we have connect the board to Raspberry Pi we can create the following script and execute, in order to reset the board.
Note: We need to reset the board every time the Raspberry Pi restart. In order to be able to run the package LoRaWAN software.
Create a script file with the following code. And save it as ic880a_reset.sh
#!/bin/bash echo "25" > /sys/class/gpio/export echo "out" > /sys/class/gpio/gpio25/direction echo "1" > /sys/class/gpio/gpio25/value sleep 5 echo "0" > /sys/class/gpio/gpio25/value sleep 1 echo "0" > /sys/class/gpio/gpio25/value
Set the file permission to executable, and execute the file to reset the board.
Install LoRaWAN software on Raspberry Pi
First, we need to install git to clone the software from source code from GitHub
sudo apt-get install git
Then go to the directory we want to store the lora_gateway. For example
cd ~/Desktop
Then clone the lora_gateway
git clone https://github.com/Lora-net/lora_gateway.git
Compile the library:
cd lora_gateway make
Once we successfully build the software. We can install the package forwarder software to forward the LoRaWAN package to the network server
Back to the folder where we store the lora_gateway folder
cd ~/Desktop
Clone the package forwarder
git clone https://github.com/Lora-net/packet_forwarder.git
Compile the package forwarder
cd package_forwarder make
Once we successfully make the package forwarder. We can go the the lora_pkt_fwd folder to configure the network server's IP address and Ports, And start the package forwarder to listen and forward LoRaWAN package
cd lora_pkt_fwd sudo nano local_conf.json
Example local_conf.json configure to forward the package to thethingsnetwork LoRaWAN network server
{ "gateway_conf": { "gateway_ID": "b827ebFFFE7f3677", "server_address": "router.eu.thethings.network", "serv_port_up": 1700, "serv_port_down": 1700 } }
Finally, We can start the LoRaWAN the software to listen and forward our package
sudo ./lora_pkt_fwd
Note: Always execute the ic880a reset script to reset the board every time the Raspberry Pi is restart
Additional documents
IC880A-SPI official Quick start guide: https://wireless-solutions.de/images/stories/downloads/Radio%20Modules/iC880A/iC880A-SPI_QuickStartGuide.pdf
IC880A-SPI on Raspberry Pi tutorial: https://github.com/ttn-zh/ic880a-gateway/wiki
LoRa net GitHub link: https://github.com/Lora-net