LoRa EU Rx
This sample demonstrates receiving packets over the LoRaWAN protocol. (For EU version.)
- 2.Copy the sample code to a folder on the Raspberry Pi.
- 3.Open terminal, and then go to the folder you copied the sample.
- 4.Run the sample with the following command:
#This sample demonstrates receiving packets over the LoRaWAN protocol. (For EU version.)
#Install LoRa HAT library with "pip3 install turta-lorahat"
#Raspberry Pi Configuration
# - You should enable SPI and I2C from the Raspberry Pi's configuration.
# To do so, type 'sudo raspi-config' to the terminal, then go to 'Interfacing Options' and enable both SPI and I2C.
# - You should swap the serial ports of the Raspberry Pi.
# Set "/dev/ttyAMA0" to 'serial0'. Also, disable the console on 'serial0'.
# For a how-to, visit our documentation at https://docs.turta.io/how-tos/raspberry-pi/raspbian/swapping-the-serial-ports
from time import sleep
from turta_lorahat import Turta_LoRa
lora = Turta_LoRa.RN2XX3(region = Turta_LoRa.REGIONS.EU_RN2483, auto_config = Turta_LoRa.CONFIG_MODES.LORA_RX)
print("Radio is set to receive.")
#Check for serial port buffer
buffer = lora.check_data()
#If data is received, print it
if buffer is not None:
#Exit on CTRL+C
When you run the sample, it prints the incoming data, if any, from the default radio frequency. When incoming data is captured, the example output should be like this:
LoRa board temp: 28.0C
To stop the Python script, just press CTRL + C.