LoRa™ HAT, a low-power consumption data transmission module, comes with an onboard CH340 USB TO UART converter, Voltage Level Translator(74HC125V), E22-900T22S and E22-400T22S SMA antenna connector, IPEX antenna connector, LoRa™ Spread Spectrum Modulation technology with auto multi-level repeating.
Supported Frequencies:- 868 MHz
- 433 MHz
- 915 MHz
To get started with your LoRa™ HAT with your Raspberry Pi computer you’ll need the following accessories:
- Raspberry Pi Board (Standard 40 Pin GPIO)
- LoRa™ HAT
- Any standard USB keyboard and Mousewill work with your Raspberry Pi.
- Wireless keyboards and mouse will work if already paired.
- Power supply
Note: The official Raspberry Pi Power Supply is recommended since it is particularly engineered to provide +5.1V despite fast swings in current consumption. When you're utilising peripherals with the Raspberry Pi, such swings in demand are common, and it's something that other supplies—designed to give continuous power for charging mobile phones—don't always handle well. It also comes with a micro USB cable, ensuring that you don't use a low-quality cable by accident, which can be a problem.
For the Raspberry Pi 4, Model B and Raspberry Pi 400 you should use the type C power supply; for all other models you should use the micro USB power supply.
Setting up your LoRa™ HAT- Attach LoRa™ HAT at the top of the Raspberry Pi Board (on transmitter and receiver side)
- Connect the LoRa™ Antenna.
Using LoRa™ Module as a HAT - Connect LoRa™ HAT directly on the top, and then you can communicate the LoRa™ HAT with Raspberry Pi via UART Protocol. Then you need to enable serial port from settings.
or
You can also enable from "sudo raspi-config" as shown in the images below:
Transmitter & Reciever Code for LoRa HAT
You’ll see transmitter and receiver code as shown below and run the codes
Transmitter
import time
import serial
lora = serial.Serial(port='/dev/ttyS0',baudrate = 9600,parity=serial.PARITY_NONE,stopbits=serial.STOPBITS_ONE,bytesize=serial.EIGHTBITS,timeout=1)
while True:
n = input("Enter The Message = ")#input the string
b = bytes(n,'utf-8')#convert string into bytes
s = lora.write(b)#send the data to other lora
time.sleep(0.2)#delay of 200ms
Receiver
import time
import serial
lora = serial.Serial(port='/dev/ttyS0',baudrate = 9600,parity=serial.PARITY_NONE,stopbits=serial.STOPBITS_ONE,bytesize=serial.EIGHTBITS,timeout=1)
while True:
data_read = lora.readline()#read data from other lora
print(data_read)
time.sleep(0.2)
You’ll get the following output:
Using LoRa™ via USB - LoRa™ HAT can be used via USB connection to PC you just need to switch the jumper wire, Connect LoRa™ to the PC via USB cable as shown in image below.
Then open "Tera Term software", choose the port, for broadcast message you need to open tera term select the port then go to control->broadcast command as shown in figure(broad), write message then click submit. You can also make receiver from tera term, for this you need to open tera term, select the port and done.
- Air Pollution Monitoring
- Tracking
- Smart Lighting
- Water Flow Management
- Smart Parking
- Home Automation and much more
Enjoy LoRa HAT For Raspberry Pi!
Posts You May like:- NeoPixel Christmas Tree Lights Controlled by a Raspberry Pi
- What Type of LoRa Modules are Available?
- Introducing The VisionFive V1 is a RISC-V Based Raspberry Pi Replacement - Available Soon
- Raspberry Pi Zero 2 W Overclocking - Boost Up To 1.2GHz, or even 1.4GHz
- The Arduino UNO Mini Limited Edition is Now Available
- Scan QR Codes with Raspberry Pi Pico
- Create Barcodes with Pure Python
- The New Version of Raspberry Pi OS, Debian "Bullseye" is Now Available.
- The Raspberry Pi Zero 2 W Arrives Six Years After The First Pi Zero
- Raspberry Pi 4 Has Been Given Vulkan 1.1 Compliance by Khronos
- The Raspberry Pi Build HAT - Complete Guide
- Raspberry Pi Officialy Announced Build HAT For Raspberry Pi
- Installing Android on a Raspberry Pi 4 with Google Play Store
- Pop OS Linux is Coming to Raspberry Pi and Other ARM Devices Soon
- How to Immediately Upgrade to Windows 11
- A Secret Update for the Raspberry Pi 4 8GB
- Raspberry Pi Introduces a New Documentation Hub
- Quick start with ESP8266 based Pico WiFi HAT
- Capture local Real-Time Air Quality Data with Raspberry Pi Pico
Comments