Skip to content

Hung4865/SX1268-LoRa-HAT-Gateway-For-Raspberry-Pi-

Repository files navigation

Please leave a star if you find me useful!


In this repo I have uploaded the 3 folder that came from the waveshare demo from their website https://www.waveshare.com/wiki/SX1268_433M_LoRa_HAT and 1 additional demo (MyCode) made by me which is built upon their original code. For the waveshare tutorial, you can go to their website. I will only be explaining the setup for mine below.


Diagram This is the diagram for my gateway setup. There are 2 raspberry pi 4b, one is the end node that sent LoRa signal to the gateway.

The 2nd pi will be the gateway node that receives the signal from the end node and then send it to the internet using MQTT protocol. MQTT, which stands for Message Queuing Telemetry Transport, is a lightweight messaging protocol based on the publish-subscribe model that is ideal for connecting devices with limited bandwidth and low power.


Make sure you download these apps to run this project:

Raspberry Pi Imager - Help to install the Rasbian OS to your SDcard

Putty - Help connect the Rasbian OS terminal to your laptop screen

VNC - Help connect Rasbian OS GUI (sometimes you don't need Putty, VNC is enough, but if there is connection issues, you would need both)

RF_Setting - Help config our LoRa module (I put it in this repo already) (you could config the moudule using code in rasbian OS, but I'm having trouble doing it. In addition, there is a line in my code that prevent the code from overwriting the RF_setting config)

UART to USB Driver - Help LoRa Module communicate with LapTop

If putty or VNC suddenly disconnected, just pull the plug and put it in again.

Watch this video for the step by step setup for the Raspberry Pi: https://www.youtube.com/watch?v=F5OYpPUJiOw&t=239s (They don't include RF_Setting and the Driver part btw, it's a thing for LoRa)


M n We can change the mode that of our sx1268. Notice that there are 2 coloums and 6 rows. The first 3 row is for the UART Selection, conbine 2 rows will let you enter each A,B,C mode. The 3 rows below is for LoRa mode selection. The jumper will always be put vertically connecting 2 rows together.


First off, go to Rasbian Config by sudo raspi-config Choose interface setting -> Serial -> Press No -> Press Yes po


In Windows, open RF_Setting. Make sure the end node and gateway node address is different from each other. Everyother parameter must be the same between the 2 nodes. Otherwise, The trasmission will fail. po

Everytime you that you change the a parameter in RF_Setting, you need to adjust the jumpers to mode A (the first 2 rows) and short M0, open M1. Don't forget to press "set Para' button

ppng

Make sure you press Set Para button and it said that you succeed. If if it said you failed, Pull out all the cables, restart RF_Setting and try again.


To enter transmisson mode, you need to adjust the jumpers to mode B (the 2nd and 3rd rows) and short M0, short M1 (because my code will work with both M0,M1).

ppng


When trying out the demo, you first need to activate the gateway node sudo python3 mqtt_gateway.py

Then active the end node, it will send 100 packet sudo python3 sender.py

When 100 packets is sent, press Ctrl+C on the Gateway Pi and you will see the nmber of received packet, averaged RSSI & packet error rate.

Thank you and Good Luck!

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages