Lora gateway raspberry pi

Bulding a gateway with Raspberry Pi and IC880A

This guide can help you build your own LoRaWAN gateway using a Raspberry Pi and an iC880A LoRa concentrator board, and run LoRa Basics™ Station on it.

Requirements

For building this gateway you will need the following hardware elements:

  1. iC880A-SPI concentrator board
  2. 3.5dBi — 7.5dBi antenna
  3. iC880A pigtail for antenna
  4. Raspberry Pi Model 2 or newer
  5. 2.5A power supply with micro USB connector
  6. MicroSD Card with minimum 4GB of storage
  7. 7x dual female jumper wires
  8. Ethernet cable or WiFi dongle (if using Raspberry PI 3+ this isn’t required, because it has an integrated WiFi interface)

Gateway Assembly

First, attach the antenna on the iC880A board using the pigtail cable.

Then use jumper cables to connect the iC880A pins to Raspberry Pi pins. Refer to the table below for connections between pins:

iC880A pin Raspberry Pi pin Description
21 2 5V power supply
22 6 GND
13 22 Reset
14 23 SPI Clock
15 21 MISO
16 19 MOSI
17 24 NSS

Your assembled gateway should look like on the image below.

Warning:

Install Raspberry Pi OS on Raspberry Pi

In this step, you need to insert your Raspberry PI’s SD card into your computer. Check out the official Raspberry Pi documentation for steps to install the Raspberry Pi 0S on the SD card. The most common method to install the Raspberry Pi OS is using the Raspberry Pi Imager.

We also recommend to enable a default SSH access on your Raspberry Pi, in order to avoid connecting it to an external screen for the initial setup. Just mount the boot partition of your Raspberry Pi’s SD card and create an empty file called ssh . For example, if using Linux:

Visit the official Raspberry Pi documentation page on detailed guide for enabling remote access.

Boot and Configure Your Raspberry Pi

Plug the SD card back into your Raspberry Pi and power it up.

If you haven’t enabled SSH access to your Raspberry Pi, you will need to connect an external screen and an external keyboard to it in order to configure it.

If you enabled SSH in the previous step, you can connect to your Raspberry Pi remotely from your computer — find out your Raspberry Pi’s IP address by listing devices on your local network (for example with nmap ) and connect via SSH. The default username is pi and the default password is raspberry .

After logging in in your Raspberry Pi, upgrade the system packages to the latest versions:

Enable the SPI interface by running the raspi-config tool:

A raspi-config wizard will appear, so use the arrow keys and the Enter key to navigate through it. Choose Interface Options → SPI, then select to enable the SPI interface. After enabling the SPI interface, hit the Escape key to exit the raspi-config tool.

Now install packages needed to build the packet forwarder:

Build the LoRa Basics™ Station Packet Forwarder

First, clone the The Things Stack repository:

Then build the LoRa Basics™ Station binary:

Make sure the binary was successfully built:

The binary was successfully built if you see something like this:

Now install the LoRa Basics™ Station binary:

Derive the Gateway EUI

To derive the gateway EUI, you can use a combination of the gateway’s MAC address and FFFE , as follows:

The output will look something like:

Make sure you write it down for further steps.

Register the Gateway on The Things Stack

To register your gateway on The Things Stack, follow the process described in the Adding Gateways section. For the Gateway EUI, use the EUI that was derived in the previous step.

While registering, it is also recommended to enable the Require authenticated connection option.

Create an API Key

Next, you need to create an API key for your gateway on The Things Stack, which will be used for your gateway’s authentication.

Follow the instructions in the LNS section to create an API key with the Link as Gateway to a Gateway Server for traffic exchange, i.e. write uplink and read downlink right. Make sure to copy the key as you will not be able to see it again.

Configure LoRa Basics™ Station

The next step is to create the configuration files required for LoRa Basics™ Station gateway to connect to The Things Stack.

On your Raspberry Pi, create a new directory:

Create a configuration file tc.uri containing an LNS server address. For example, if using eu1 cluster of The Things Stack Community Edition:

See Server Addresses if you are not sure which server address to use. See also LNS Server Address for info about LNS server address format.

Next, create the tc.key configuration file containing an authorization header. This header will contain the API Key you created in the previous step, and it will be used to authenticate your gateway’s connection.

Create the tc.trust configuration file that will be the root CA used to check your LNS server’s certificates. You can use the system CA certificates:

Now, create the station.conf configuration file containing configuration options for your concentrator:

Finally, create the start.sh script, that will be used to reset the iC880A via its reset pin and start the packet forwarder:

You can check if your start.sh script is executable with:

Test the Packet Forwarder

Start the packet fowarder with:

This will initialize the concentrator board, connect your gateway to The Things Stack, fetch the configuration based on your frequency plan and start listening for packets. If you notice something like:

in the packet forwarder logs, it means your gateway has started picking up messages, Of course, this is possible if there are end devices transmitting data within the gateway’s reach.

If you go to The Things Stack Console and navigate to your gateway’s Live Data view, it will appear as connected and you will see uplink messages arriving.

Run the Packet Forwarder as a System Service

The only thing left to do is to configure the packet forwarder to run as a system service on Raspberry Pi. This ensures that the forwarder will start automatically after the Raspberry Pi boots.

First, create the systemd service configuration file:

Enable the service with:

Start the service:

You can observe the packet forwarder logs using the following command:

Voilà! Your gateway is now fully functional and you can start developing your IoT use case.

Источник

hallard/RPI-Lora-Gateway

Use Git or checkout with SVN using the web URL.

Work fast with our official CLI. Learn more.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Raspberry PI Lora Gateway/Node for RFM92/95/96/98/69HCW Modules

This shield is used to hold one or two HopeRF Lora module Software with Raspbery PI plus one FM12B/RFM69CW/RFM69(H)W. it’s the parent of the small LoRasPi, so please look at LoRasPi readme to see features and software links.

This board has been mainly inspired from Uptronics expansion board on which I added some features but it’s not a real LoraWAN concentrator, if you need a real concentrator with multiple channels and fully compliant to LoraWan stack capabilities, please see thethingsnetwork wiki dedicated to gateways.

By the way, with Lora modules installed on this board you can have it working as a Single Channel Gateway or a LoraWan node. For testing, demo or small projects, it can be enought.

  • Placement for two RFM92/95/96/98 Lora module (IE one 868MHz and one 433MHz, or 2 channels 868MHz)
  • Placement for one RFM12B/RFM69CW/RFM69(H)W classic module
  • Placement for choosing single Wire, SMA, u-FL or Thru Hole PCB Mount (Right Angle Tor straight) by Eightwood Antenna type
  • Vertical Antenna placement is possible (easier to drill RPI top enclosure)
  • 4 x LED for visual indication
  • Each Module reset pin can be connected to a RPI GPIO

Boards arrived from ElectroDragon, all is working as expected.

Look at the schematics for more informations.

SPI connexion is classic (MOSI/MISO/CLK), Chip Select is CE0 for Module 1 and CE1 for Module 2. Module 3 can be choosen between CE0 and GPIO26 with on board jumper switch.

Nothing really complicated, you can wire Reset of each module on a GPIO pin if you want to be able to hardware reset then using software, in this case put jumper on JP5 for Module 1, JP6 for Module 2 and JP13 for Module 3. JPx number is the GPIO so JP5 is for GPIO5 ;-)

If you want to use Module 1 and Module 3 you need to set JP1 (Chip Select of module 3) to IO26 since CE0 is used by Module 1.

I’m working on two libraries port and Single Channel Gateway to work on Raspberry PI, links are here

  • LMIC to be LoraWan compliant. This LMIC is working with this shield, see readme of repo.
  • Excellent RadioHead twekaed library for RFM69, RFM9x modules (and lot of others). This version is working with this shield, see readme of library.
  • The Things Network Single Channel Gateway packet forwarder

I forked all repos to tweak them, but since I’m not sure original authors would like to merge my changes just use my forks.

You can order the PCB of this board PCBs.io. PCBs.io give me some reward when you order my designed boards from their site. This is pretty good, because I can use these rewards to create and design new boards and order boards for a discounted price and share new boards.

Assembled and mounted board

Here is my testing board, as you can see, 3 modules on it

  • Module 1 (top left) Lora RFM95 868MHz
  • Module 2 (bottom left) Lora RFM98 433MHz
  • Module 3 (right) RFM69HW 433MHz

You can do whatever you like with this design.

##Misc See news and other projects on my blog

About

Raspberry PI Lora Gateway/Node for RFM92/95/96/98/69HCW Modules

Источник

4refr0nt/lora-gw

Use Git or checkout with SVN using the web URL.

Work fast with our official CLI. Learn more.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Node.js LoRa Gateway For Raspberry Pi

1. Supported LoRaWAN Networks

2. Supported devices

  • List of supported board
  • Supported transceivers (without MCU): NiceRF LoRa1276, HopeRF SX1276-based modules
  • I2C LCD SSD1306-based
  • multiplatforms
  • objects-based model
  • coffee-script fast and easy developing
  • 2 UDP servers supporting (main and debug)
  • MQTT monitoring server supporting
  • unlimited RF frontend devices supported
  • display statistics on I2C LCD
  • receiving unconfirmed messages from nodes
  • periodically send statistics info to servers
  • receiving messages from nodes with confirmation
  • mobile app for monitoring

5. Pre-Requirements & Build on Raspberri Pi

  • 5.2 Install latest SWIG from source code(swig-3.0.9)
  • 5.3 Build hardware level MRAA library from source code

Comment out the following from src/spi/spi.c

  • 208 row for Raspberri Pi comment out the following from src/spi/spi.c
  • // if (ioctl(dev->devfd, SPI_IOC_RD_MAX_SPEED_HZ, &speed) != -1) <
  • // if (speed clock = speed;
  • // syslog(LOG_WARNING, «spi: Selected speed reduced to max allowed speed»);
  • // >
  • // >
  • 5.4 Build UPM library from source code (build may be more than 1 hrs)

Ignore all errors, but check for existing file node_modules/mraa/build/Release/mraa.node

Edit config.js and check settings

Raspberry Pi Pin Transceiver
MOSI 19 MOSI
MISO 21 MISO
CLK 23 SCK
CS0 24 NSS

About

LoRaWAN Gateway for Raspberry Pi

Resources

Stars

Watchers

Forks

Releases

Packages 0

Contributors 3

Languages

© 2022 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

Adblock
detector