868 MHz iC880a – LoRa Basics Station

TTN version: TTNv3
Frequency: Europe 863-870 MHz (SF9 for RX2 – recommended)
Classes: Ready for LoRaWAN Classes A, B and C
Using Docker: Yes
Last updated: July 5, 2024

This article provides instructions for making LoRa Basics Station using Raspberry Pi 3 or 4, iC880A-SPI LoRa Concentrator and GPS NEO-6M GYNEO6MV2.Two assembled LoRa Basics Stations

Note: A GPS module with PPS (Pulse Per Second) is required to support class B end devices.

 

Prepare

There are several ways to build a LoRa Basics Station. We have chosen two that we use, so here are two component lists.

Assembly 1
  • Raspberry Pi 3 or 4
  • Power Supply
  • microSD card
  • iC880A-SPI LoRa Concentrator
  • iC880A Backplane v1.5 (coredump.ch 2018)
  • GPS NEO-6M GYNEO6MV2
  • GPS antenna
  • Stacking Header for Pi A+/B+/Pi 2/Pi 3 – 2×20 Extra Tall Header
  • 2x SMA to uFL/u.FL/IPX/IPEX RF Adapter Cable
  • 5x jumper wire
  • PC
Assembly 2

 

iC880A-SPI LoRa Concentrator

The concentrator module iC880A is targeted for a huge variety of applications like Smart Metering, IoT and M2M applications. This concentrator module can be integrated into a gateway as a complete RF front end. It provides the possibility to enable robust communication between a LoRa gateway and a huge amount of LoRa end-nodes spread over a wide range of distance.

The iC880A is able to receive up to 8 LoRa packets simultaneously sent with different spreading factors and also on different channels. This unique capability allows to implement innovative network architectures advantageous over other short range systems.iC880A

For more information on iC880A-SPI LoRa Concentrator, see:

 

Assembly

Assembly 1

  1. Prepare all the components.All components
  2. Insert the iC880A-SPI LoRa Concentrator module into the iC880A Backplane v1.5.Concentrator on backplane
  3. Connect the Stacking Header for Pi to the GPIO on the Raspberry Pi.GPIO header on Raspberry Pi
  4. Connect the iC880A Backplane v1.5 to the Stacking Header for Pi.Backplane connected to GPIO header
  5. Finally, connect the SMA to uFL/u.FL/IPX/IPEX RF Adapter Cable to the iC880A-SPI LoRa Concentrator module and power supply to the iC880A Backplane v1.5.Connected power supply and antenna connector to modules
Class B support
  1. Connect the GPIO pins to the GPS NEO-6M GYNEO6MV2 according to the table, wiring diagram and image.
    GPS RPi pin Backplane pin
    VCC 4 x
    GND 9 x
    TXD 10 (GPIO 15) x
    RXD 8 (GPIO 14) x
    PPS x PPS

    GPS wiring diagramGPS wiring

Assembly 2

  1. Prepare all the components.All components
  2. Connect the GPIO pins to the iC880A-SPI LoRa Concentrator module according to the table and image below.
    iC880 pin Description RPi pin
    21 +5V 2
    22 GND 6
    13 Reset 22 (GPIO25) or 11 (GPIO17)
    14 SPI CLK 23 (GPIO11)
    15 MISO 21 (GPIO09)
    16 MOSI 19 (GPIO10)
    17 NSS 24 (GPIO08)
  3. Finally, connect the SMA to uFL/u.FL/IPX/IPEX RF Adapter Cable to the iC880A-SPI LoRa Concentrator module.iC880a and RPi wiring
  4. If you want, you can attach the components to the 3D printed holder with screws.holder

 

Class B support
  1. Connect the GPIO and iC880a pins to the GPS NEO-6M GYNEO6MV2 according to the table, wiring diagram and image.
    GPS RPi pin iC880A pin
    VCC 4 x
    GND 9 x
    TXD 10 (GPIO 15) x
    RXD 8 (GPIO 14) x
    PPS x 19

    GPS wiring diagramGPS wiring

 

Raspberry Pi OS setup

  1. From https://www.raspberrypi.com/software/ download Raspberry Pi Imager and install it.
  2. Insert the microSD card into the computer.
  3. Run Raspberry Pi Imager.
  4. Click on CHOOSE OS.
  5. Click on Raspberry Pi OS (other).
  6. Click on Raspberry Pi OS Lite (32-bit).
  7. Click on CHOOSE STORAGE.
  8. Select the inserted microSD card on which you want to install Raspberry Pi OS.
  9. Click on Next.
  10. Would you like to apply OS customisation settings? – EDIT SETTINGS.
  11. Set hostname.
  12. Set username and password. (we recommend a 17-digit password containing lower and upper case letters, numbers and symbols)
  13. If you will use WiFi – Configure wireless LAN. (optional)
  14. Set locale settings.
  15. Click on tab SERVICES.
  16. If you will be connecting remotely via SSH – Enable SSH – Use password authentication. (optional)
  17. Click on SAVE.
  18. Click on YES.
  19. Click on YES.
  20. Click on CONTINUE.
  21. Insert the microSD card into the Raspberry Pi.
  22. Turn on the Raspberry Pi.

 

Remote connection via SSH (optional)
  1. Connect to your router and find the IP address of your Raspberry Pi.
  2. From a Windows PC, you can connect using Command Prompt (CMD) or PuTTY.
  3. On Windows PC open Command Prompt (CMD).
  4. Type ssh -port username@IP_Address (for example: ssh -p 22 loravsb@192.168.1.120).
  5. Type your password.

 

Post-installation steps
  1. Update, upgrade and reboot Raspberry Pi. This will ensure that any security vulnerabilities are patched:
    $ sudo apt update
    $ sudo apt full-upgrade
    $ sudo reboot
  2. Connect again via SSH.
  3. Use a different port for SSH and disable root login. First, open the SSH configuration file with a text editor:
    $ sudo nano /etc/ssh/sshd_config
    
  4. Locate the line with Port 22 and change it to the desired port number (for example, change the port to 2222). Locate the line with PermitRootLogin and change its value to no (this will disable root login via SSH):
    Port 2222
    PermitRootLogin no
    
    
  5. Save the changes and exit the text editor.
  6. Restart the SSH service to apply the changes:
    $ sudo systemctl restart ssh
    
  7. Log out and connect again via SSH on the new port.
  8. Install and configure the built-in firewall, ufw, to limit incoming network connections. In the sudo ufw limit 2222/tcp rule, change port 2222 to port you have chose for SSH above.
    $ sudo apt install ufw
    $ sudo ufw default deny incoming
    $ sudo ufw limit 2222/tcp
    $ sudo ufw enable
    

    Note: Firewall rules will have no effect on ports opened by Docker.

  9. Reboot Raspberry Pi:
    $ sudo reboot

 

Docker
  1. Connect again via SSH.
  2. Install the latest Docker version using the convenience script provided by docker:
    $ curl -fsSL https://get.docker.com -o get-docker.sh
    $ sudo sh get-docker.sh
    $ sudo groupadd docker
    $ sudo usermod -aG docker $USER
    $ newgrp docker
    $ sudo systemctl enable docker.service
    $ sudo systemctl enable containerd.service

For more information on Docker installation, see https://docs.docker.com/engine/install/.

 

LoRa Basics Station setup

  1. First, get the Gateway EUI by running the following command:
    $ cat /sys/class/net/eth0/address | awk -F\: '{print toupper($1$2$3"FFFE"$4$5$6)}'

 

The Things Stack

  1. Create an account on The Things Network if you don’t have one.
  2. Login on The Things Network.
  3. Click on your username and choose Console.
  4. Select a network cluster.
  5. Go to gateways.RAK5146_KIT_LBS_1
  6. Click on button + Register gateway.
  7. Write the previously detected Gateway EUI in the Gateway EUI field.RAK5146_KIT_LBS_3
  8. Click on button Confirm.
  9. Write something into Gateway ID.
  10. Write something into Gateway name.
  11. Frequency plan – Europe 863-870 MHz (SF9 for RX2 – recommended)
  12. Click on button Register gateway.RAK5146_KIT_LBS_4
  13. In API keys click on button +Add API key.RAK5146_KIT_LBS_5
  14. Write something into Name.
  15. Click on Grant individual rights.
  16. Select Link as Gateway to a Gateway Server for traffic exchange, i.e. write uplink and read downlink.
  17. Click on button Create API key.RAK5146_KIT_LBS_6
  18. Click the Copy to clipboard button and paste the key into some text document for future use.
  19. Click on button I have copied the key.RAK5146_KIT_LBS_7

 

Raspberry Pi’s Interfaces

  1. Run the following command to configure the Raspberry Pi’s Interfaces:
    $ sudo raspi-config

    RAK5146_KIT_LBS_8

  2. In 3 Interface Options -> I4 SPI.RAK5146_KIT_LBS_9
  3. Would you like the SPI interface to be enabled? -> Yes.RAK5146_KIT_LBS_10
  4. Ok.
  5. In 3 Interface Options -> I5 I2C.RAK5146_KIT_LBS_11
  6. Would you like the ARM I2C interface to be enabled? -> Yes.RAK5146_KIT_LBS_12
  7. Ok.
  8. In 3 Interface Options -> I6 Serial Port.RAK5146_KIT_LBS_13
  9. Would you like a login shell to be accessible over serial? -> No.RAK5146_KIT_LBS_14
  10. Would you like the serial port hardware to be enabled? -> Yes.RAK5146_KIT_LBS_15
  11. Ok.RAK5146_KIT_LBS_16
  12. Finish.RAK5146_KIT_LBS_17
  13. Would you like to reboot now? -> Yes.RAK5146_KIT_LBS_18

 

LoRa Basics Station

  1. Connect again via SSH.
  2. Clone the repository with LoRa Basics Station and go to the created directory:
    $ git clone https://github.com/RAKWireless/basicstation.git
    $ cd basicstation
  3. Run this command to overwrite the station.v2.conf file with a new file containing the PPS settings:
    $ curl -L https://raw.githubusercontent.com/OndrejKnebl/gateway-patch/main/station.v2.conf > runner/station.v2.conf
  4. Build the image by using the buildx extension of docker. If you are not using a 64-bit ARMv8 computer (like Raspberry Pi 4), you can change aarch64 to armv7hf(ARMv7) or amd64 (AMD64):
    $ VARIANT=std docker buildx bake --load aarch64
  5. Return to the parent folder:
    $ cd ..
  6. Run this command to create and edit the docker-compose.yml file:
    $ sudo nano docker-compose.yml
  7. Copy and paste the configuration below into your docker-compose.yml file. Copy and paste the API key you got previously saved to the TC_KEY variable. If you are not using a 64-bit ARMv8 computer (like Raspberry Pi 4), you can change aarch64 to armv7hf(ARMv7) or amd64 (AMD64).
    version: '2.0'
    services:
      basicstation:
          image: xoseperez/basicstation:aarch64-latest  # If not using a 64-bit ARMv8 computer, change aarch64
          container_name: basicstation
          restart: unless-stopped
          privileged: true
          network_mode: host
          environment:
            MODEL: "IC880A"
            SPI_SPEED: 2000000      # If using backplane = 2000000, if wired and not working properly = 1000000
            GW_RESET_GPIO: 25       # If using backplane = 25, otherwise define your GPIO reset
            TC_KEY: "NNSXS...."     # Copy here your API key from the TTS
  8. Now, you can start it running in the background with the following command:
    $ sudo docker compose up -d
  9. Finaly, check that the gateway status is Connected in the TTS console.

 

For more information on LoRa Basics™ Station for Docker, see: