368 views|1 replies

143

Posts

0

Resources
The OP
 

How to build a LoRa gateway using Raspberry Pi? [Copy link]

As the name suggests, Long Range Wide Area Network or LoRaWAN technology is widely used for long-range, low-power communications in the Internet of Things (IoT).

In this article, we will guide you on how to connect a SX130x 868M LoRaWAN Gateway Module to a Raspberry Pi 4 via a Hardware Attached On Top (HAT). This setup creates a LoRaWAN Gateway, allowing the Raspberry Pi (RPi) to communicate with LoRaWAN enabled devices.

Materials Needed:

Step 1. Gather the hardware

Before you get started, you need to prepare all the required hardware components, including a Raspberry Pi4, a SX130x 868M LoRaWAN gateway module, a LoRa antenna, and a working MicroSD card with Raspbian OS.

Step 2. Assemble the hardware

Insert the MicroSD card into the Raspberry Pi (after the RPi has been installed - see instructions in step 3)

Connect the SX130x LoRaWAN Gateway module to the GPIO pins of the Raspberry Pi. Make sure the pins are aligned correctly and the module is securely connected. It is a HAT so it should fit perfectly.

Figure 1. Assembled hardware between the SX130x LoRaWAN gateway module and the Raspberry Pi’s GPIO pins

Step 3. Install the operating system for the Raspberry Pi

Use this link to download and install the Raspberry Pi Imaging Software.

https://www.raspberrypi.com/software/

Figure 2: Raspberry Pi software

Click Select Operating System.

Figure 3: Select OS in Imager software

Select the 32-bit OS Lite version and then select the storage device option in the next step.

Figure 4: Select the storage device option

Next, insert your SD card into your computer using an SD card reader. Select the SD card that appears. Be sure to click the gear icon before clicking the “Write” button.

Figure 5. Use the gear button to change Wi-Fi settings and other options.

Then, click Write Image.

Now, change the WiFi settings and other options. Then, click "Enable SSH" and set your username and password. Click "Configure Wireless LAN" and enter the SSID and password for your WiFi. This allows the RPi to boot without being connected to the desktop screen.

Figure 6, add your Wi-Fi SSID and password.

Click on “Save” and then click on the “Write” button. Wait for the process to complete and once it is finished, remove the SD card from its current device and insert it into your Raspberry Pi.

Step 4. Connect to the Raspberry Pi using SSH

After assembly and inserting the SD card, power on the Raspberry Pi. Follow the instructions below to establish an SSH connection.

Figure 7. After connecting to the RPi using SSH, the power is turned on.

Make sure the IP address of the Raspberry Pi is correct for establishing a connection. To do this, download the Angry IP Scanner software : https://angryip.org/

Figure 8, Angry IP software.

After clicking "Start", the following screen will appear. Once the process is complete, find the IP address for the hostname "Raspberry pi". You can also find the correct information in the DHCP section of your router's configuration page.

Figure 9, IP scanning process.

In our example, the IP address is 192.168.1.4. However, your situation may be different. Next, download the bitvise ssh software: https://bitvise.com/ssh-client-download

Launch the software and log into the IP address using the username and password you set during the SD card flash process.

Figure 10. The process of transferring SSH to the RPi.

Click "New Terminal Console"

Figure 11, click “New Terminal Console”.

After that, you will see the following screen.

Figure 12. The Terminal screen after logging in.

We have successfully established an SSH connection to the Raspberry Pi.

Step 5. Configure the RPi

Enable SPI, Serial and I2C using this command: "raspi-config"

Figure 13. The System Options window for configuring the RPi.

Go to System Options and enable SPI, Serial, and I2C.

Figure 14. Configuring the RPi by enabling SPI, I2C, and Serial on the Interfaces window.

Click "Yes".

Figure 15. Click “Yes” for all three options.

It will then ask to reboot.

Step 6. Connect SX1302

Install the SX1302 gateway binary file by following the steps below

  • sudo apt update

  • sudo apt install git

  • cd

  • git clone

    链接已隐藏,如需查看请登录或者注册

  • 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 is necessary to verify that the hardware is properly connected.

  • Cd sx1302_hal/util_chip_id/- ./chip_id

Once a connection is made to the hardware, you will observe output similar to this…

Figure 16, “Get Chip ID” command.

Your EUI ID is the MAC address of your gateway, so be sure to write it down. Start the LoRa Concentrator shield with this command and provide any configuration files in 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 has started and successfully established a connection with the LoRa concentrator

At this point, any data sent via the EU868 profile will be received on this screen.

Conclusion

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

1.jpg (203.84 KB, downloads: 0)

1.jpg

7.jpg (2.59 MB, downloads: 0)

7.jpg

Latest reply

Where to download the installed SX1302 gateway binary file   Details Published on 2024-9-6 07:44
Personal signature

WX:上海晶珩电子科技

 
 

6570

Posts

0

Resources
2
 

Where to download the installed SX1302 gateway binary file

 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list