Setup IC880A-SPI (LoRaWAN concentrator) on Raspberry Pi 3

From UNamur InfoSec
Jump to navigation Jump to search

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 on IC880A-SPI
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-SPI to Raspberry Pi
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