My objective is to connect a LoRa module with RPi and send data using it.
So I made the connection:(Rpi to LoRa)
3v3 (Physical Pin 1) to Power Source (Pin 1)
Tx (Physical Pin 8) to Rx (Pin 3)
Rx (Physical Pin 10)to Tx (Pin 2)
Ground(Physical Pin 6) to Ground (Pin 10)
Then I disabled my AMA0
using raspi-config
I read and understood a couple of programs on how to control Raspberry Pi input and output (Like, LED turn on-off program)
Then I read this program:
import time
import serial
ser = serial.Serial(
port = '/dev/ttyAMA0',
baudrate = 9600,
parity = serial.PARITY_NONE,
stopbits = serial.STOPBITS_ONE,
bytesize = serial.EIGHTBITS,
timeout = 1
)
counter = 0
while 1:
ser.write('Write counter: %d \n'%(counter))
time.sleep(1)
counter += 1
Kind of understood it.
But I have to give AT Commands to LoRa to send data to another LoRa. Right now(to warm up and get understanding), the only command I'm giving is AT+VER which should return the version of LoRa hardware (back to the pi it is connected).
Neither do I have any sample code nor can I find a program on internet that can help me understand how to write a code for the same. I'm totally new so have no idea how to even proceed after this.
To make the question more precise, how to write a program to send AT Commands to LoRa module? (and receive the input on same pi, just for now)
/dev/serial0
(on any model)