0

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)

Breakpoint
  • 151
  • 4
  • What Pi? What does "disabled my AMA0 using raspi-config" mean? Just enable serial and use `/dev/serial0` (on any model) – Milliways Mar 12 '19 at 04:27
  • Hi @Milliways thank you for the quick reply. According to the website https://www.instructables.com/id/Read-and-write-from-serial-port-with-Raspberry-Pi/ One should disable AMA0 before using it as serial port. It's Raspberry Pi 3B V1.2 – Breakpoint Mar 12 '19 at 04:31
  • @Milliways I should also mention that from my understanding both Tx Rx on Pi (Physical pins mentioned in question) together make AMA0. – Breakpoint Mar 12 '19 at 04:32
  • There are hundreds of tutorial on the web - many wrong (including the linked one). If you want to understand serial on current Raspbian [How do I make serial work on the Raspberry Pi3 , Pi3B+, PiZeroW](https://raspberrypi.stackexchange.com/a/45571/8697) explains. Unless you are trying to send data at very high speeds (which excludes LoRa) the mini UART works, and you don't need to disable Bluetooth. – Milliways Mar 12 '19 at 04:39

0 Answers0