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.
Step 3. Install Raspberry Pi with OS
Install Raspberry Pi Imager Software by using this link to download the software for installation on Windows.
Click on ‘CHOOSE OS.’
Choose the OS Lite version (32-bit), and then choose the Storage Device option in the next step.
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.
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.
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.
Determining the IP address of the RPi is necessary for establishing a connection. To do so, download the Angry IP Scanner: link
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.
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.
Click on the ‘New Terminal Console.’
Afterward, you’ll be presented with the follow screen.
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”
Go to the ‘System Options’ and enable the SPI, Serial, and I2C.
Click ‘Yes.’
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…
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:
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:
Filed Under: Tutorials
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.