NODE TO NODE COMMUNICATION ON LORA WITH RASPBERRY PI 4

NODE TO NODE COMMUNICATION ON LORA WITH RASPBERRY PI 4 - Robocraze

What is LoRa?

LoRa, short for long-range, is the physical layer or the wireless modulation utilized to create a long-range communication link. LoRa is based on Chirp Spread Spectrum (CSS) modulation, which maintains the same low power characteristics as FSK modulation but significantly increases the communication range.

Key Features of LoRa Technology

  • Long-range
  • Consumes low power
  • Connects millions of nodes
  • Availability of LoRaWAN networks for speedy deployment of IoT applications
  • Single Gateway can connect 10,000s of nodes
  • Simple Architecture, easy to deploy
  • Uses 863 MHz – 928 MHz ISM bands which are available worldwide
  • Supports 3 types of devices: Class A, B, and C

Material Required is as follows:

Circuit Diagram

 

Pin Details

LoRe Bee

LoRe Bee

physical pin

Raspberry Pi WiringPi

Raspberry Pi

physical pin

MISO

  4

MISO 13

21

 

RESET

 5

11

26

MOSI

11

MOSI 12

19

D0

 12

7

7

NSS

 17

22

31

SCK

 18

SCLK 14

23

3V3

  1

3V3

 

GND

 10

GND

 

NOTE - In code, we use wiring pin numbers and for circuit connection, we use physical pin numbers. For reference, the GPIO table is given below:

Now we are going to set up LoRa Node to Node communication using Raspberry Pi 4. In Node to Node communication, we use two nodes. One of the nodes we configure as Transmitter and another node as Receiver

Step 1: Libraries

For  LoRa communication we have to set up some libraries

Install wiringpi

SSH into the Raspberry Pi

In a terminal, run

sudo apt-get install wiringpi

Test wiringPi’s installation

$ gpio -v

$ gpio readall

If the gpio readall command does not output the reference of pin numbers, ensure you have installed the latest version.

Step 2: Download the Lora-transceiver code

In a terminal, run

$ wget https://codeload.github.com/dragino/rpi-lora-tranceiver/zip/master

Unzip the library

$ unzip master     

Step 3: Pin numbers update

Update the pin numbers by opening the main.c file. Change directory to go inside the folder with the main.c file using the command given below:

$ cd rpi-lora-transceiver-master/ dragino_lora_app

Then, using the nano editor, open the main.c file using the command below:

$ nano main.c

Scroll down in the main.c file to find the lines shown in the image below

 

Write the Pin numbers given above into the nano editor.

Press Ctrl+X to exit nano. Upon exiting, the save prompt will be displayed. Press Y and then press the Enter key.

Step 4: Rebuild the main.c file

Every time the code is edited, it needs to be rebuilt in order for the changes to take effect. Use the commands below to clean any previous build files present and to rebuild the source

$ make clean

$ make

Step 5: Running the sender

Run the sender code using the command below

$ ./dragino_lora_app sender

The output should be visible as shown in the image below

Step 6: Running the receiver

Run the sender code using the command below

$ sudo ./dragino_lora_app rec

Troubleshooting

After running the command for receiver and sender if you get the Unrecognized transceiver  error   on terminal

Check your connections, make sure the connections are correct and not loose. Also, check-in the code if all pin numbers are correct.  

Frequently Asked Questions

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.

Components and Supplies

    You may also like to read