Kamaluddin Khan
Published

Getting Started with LoRa™ HAT for Raspberry Pi

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

BeginnerFull instructions provided1 hour4,732
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

Kamaluddin Khan

Kamaluddin Khan

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

Comments