Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

How to build a LoRa gateway using Raspberry Pi

By Ayush Jain September 15, 2024

As its name suggests, long-range wide-area network or LoRaWAN technology is widely used for long-range, low-power communication in Internet-of-things (IoT) applications.

In this article, we’ll guide you through the process of connecting an SX130x 868M LoRaWAN Gateway Module to a Raspberry Pi 4 using hardware attached on top (HAT). This setup creates a LoRaWAN gateway, allowing Raspberry Pi (RPi) to communicate with LoRaWAN-enabled devices.

 What’s required

  • Raspberry Pi 4 (Model B or higher is recommended) – link
  • The SX130x 868M LoRaWAN Gateway Module – link
  • A LoRa antenna that’s compatible with the module – and comes with SX1302
  • A MicroSD card with Raspbian OS installed (instructions below) – 32 GB
  • An SD card reader
  • Power supply for Raspberry Pi – Link
  • An Internet connection

Step 1. Gather the hardware
Before starting, You’ll need all required hardware components, including Raspberry Pi 4, the SX130x 868M LoRaWAN Gateway Module, a LoRa antenna, and a functional MicroSD card with Raspbian OS.

Step 2. Assemble the hardware
Insert the MicroSD card into Raspberry Pi (after RPi is installed — see Step 3 for instructions)

Attach the SX130x LoRaWAN Gateway Module to Raspberry Pi’s GPIO pins. Make sure the pins align correctly and the module is securely attached. It’s a HAT, so it should fit perfectly. 

Figure 1. The assembled hardware between the SX130x LoRaWAN Gateway Module and the Raspberry Pi’s GPIO pins.

Step 3. Install Raspberry Pi with OS
Install Raspberry Pi Imager Software by using this link to download the software for installation on Windows.

Figure 2. The Raspberry Pi Imager Software

Click on ‘CHOOSE OS.’

Figure 3. Select ‘OS’ from the Imager Software.

Choose the OS Lite version (32-bit), and then choose the Storage Device option in the next step.

Figure 4. Select the Storage Device option.

Next, insert the SD card into your computer using the SD card reader. Select the displayed SD card. Be sure to click on the gear icon before clicking on the ‘Write’ button.

Figure 5. Use the gear button to change the Wi-Fi setting and other options. Then, click on the ‘Write’ image.

Now, change the settings to Wi-Fi and other options. Then, click on ‘Enable SSH’ and set your username and password. Click on the ‘Configure wireless LAN,’ and enter your Wi-Fi’s SSID and password. This allows RPi to boot without connecting it to a desktop screen.

Figure 6. Add your Wi-Fi’s SSID and password.

Click on the ‘Save’ and then the ‘Write’ buttons. Wait for the process to complete, and once finished, remove the SD card from your current device and insert it into Raspberry Pi.

Step 4. Connect Raspberry Pi using SSH
After assembling and inserting the SD card, power on the Raspberry Pi. Follow the following instructions to establish an SSH connection.

Figure 7. The power is on after connecting RPi using SSH.

Determining the IP address of the RPi is necessary for establishing a connection. To do so, download the Angry IP Scanner: link

Figure 8. The Angry IP software.

After clicking on ‘Start,’ the below screen will appear. Once the process is complete, locate the IP address with the host name “Raspberry pi.” You can also find the proper information in the DHCP section of your router’s configuration page.

Figure 9. The IP scanning process.

In our case, the IP address is 192.168.1.4. However, in your case, it will be different. Next, download the software bitvise ssh: link

Launch the software and login to the IP address using the username and password set during the SD card flashing process.

Figure 10. The process of moving SSH into RPi.

Click on the ‘New Terminal Console.’

Figure 11. Click on the ‘New Terminal Console.’

Afterward, you’ll be presented with the follow screen.

Figure 12. The ‘Terminal’ screen after logging in.

We’ve successfully established an SSH connection with Raspberry Pi.

Step 5. Configure RPi
Enable the SPI, Serial, and I2C using this command: “Raspi-config”

Figure 13. The ‘System Options’ window for configuring RPi.

Go to the ‘System Options’ and enable the SPI, Serial, and I2C.

Figure 14. Configure RPi by enabling SPI, I2C, and Serial on the interface window.

Click ‘Yes.’

Figure 15. Click ‘Yes’ for all three options.

It will then ask to reboot.

Step 6. Connecting SX1302
Install the SX1302 binaries for the gateway by following these steps:

  • sudo apt update
  • sudo apt install git
  • cd
  • git clone https://github.com/Lora-net/sx1302_hal.git
  • cd sx1302_hal
  • make clean all
  • make all
  • cp tools/reset_lgw.sh util_chip_id/
  • cp tools/reset_lgw.sh packet_forwarder/

Next, it’s necessary to verify if the hardware is properly connected.

  • Cd sx1302_hal/util_chip_id/-   ./chip_id

Once there’s an established connection with the hardware, you’ll observe output similar to this…

Figure 16. The ‘Get Chip ID’ command.

Your EUI ID is the gateway’s MAC address, so be sure to make a note of it. Initiate the LoRa concentrator shield using this command, providing any configuration file from the folder.

  • cd sx1302_hal/packet_forwarder/-
  • ./lora_pkt_fwd -c global_conf.json.sx1250.EU868

A successful connection to the LoRa concentrator will look similar to this:

Figure 17. The gateway is UP and a connection is successfully established to the LoRa concentrator

At this point, any data sent over the EU868 profile will be received by this screen.

Conclusion
Sending data through this gateway will enable data reception. The next step involves connecting to, configuring, and managing the gateway using Chirpstack.

 

You may also like:


  • Understanding LoRa architecture: nodes, gateways, and servers

  • What is Chirpstack?

  • How communication works between two LoRa end-node devices

  • How to integrate modules and smart meters with LoRa node-to-gateway…

  • How LoRa enables long-range communication

  • What is LoRa and LoRaWAN?

  • What are LoRa gateways and what types are available?

  • How does LoRa modulation enable long-range communication?

Filed Under: Tutorials
Tagged With: antenna, chirpstack, concentrator, gateway, lora, lorawan, nodes, raspberrypi, raspberrypi4, rpi, sx130x
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Reducing "shoot-through" in offline Full Bridge SMPS?
  • High Side current sensing
  • How to simulate power electronics converter in PSpice?
  • Voltage mode pushpull is a nonsense SMPS?
  • Layout IRN reduction in Comparator

RSS Electro-Tech-Online.com Discussions

  • Back to the old BASIC days
  • Parts required for a personal project
  • PIC KIT 3 not able to program dsPIC
  • Failure of polypropylene motor-run capacitors
  • Siemens large industrial PLC parts

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC
  • Infineon’s inductive sensor integrates coil system driver, signal conditioning circuits and DSP
  • Arm Cortex-M23 MCU delivers 87.5 µA/MHz active mode
  • STMicroelectronics releases automotive amplifiers with in-play open-load detection

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe