Random Robo Smith
Published

Getting Started with LoRa™ HAT for Raspberry Pi

LoRa™ HAT, a low-power consumption data transmission module

BeginnerFull instructions provided1 hour5,725
Getting Started with LoRa™ HAT for Raspberry Pi

Things used in this project

Hardware components

Raspberry Pi Zero Wireless
Raspberry Pi Zero Wireless
×1
SB Components LoRa HAT
×1

Software apps and online services

Tera term

Story

Read more

Code

Code snippet #1

Plain text
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)

Credits

Random Robo Smith

Random Robo Smith

93 projects • 58 followers
Electronic Enthusiast I do Projects, Tutorials, Reviews and more...
Thanks to Kamaluddin khan.

Comments