Hackster is hosting Hackster Holidays, Finale: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Tuesday!Stream Hackster Holidays, Finale on Tuesday!
ZenoModiff
Published © LGPL

How To Use Lora With Arduino

Basic Interface Of Lora With Arduino

AdvancedFull instructions provided25,413
How To Use Lora With Arduino

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×2
AdaCore LORA RFM95
×2
Dot Pcb
×1
I2C 16x2 Arduino LCD Display Module
DFRobot I2C 16x2 Arduino LCD Display Module
×1
5 mm LED: Red
5 mm LED: Red
×1
5 mm LED: Green
5 mm LED: Green
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
PCB Holder, Soldering Iron
PCB Holder, Soldering Iron

Story

Read more

Schematics

Schematics

Lora Reciever

Schematics

Lora Sender

Code

Reciever Code For Lora

C/C++
Reciever Code For Lora Module
/*feel free to contact
 * sreeramaj53@gmail.com
 * www.youtube.com/ZenoModiff
 * last updated - time 07:43 PM - date 27 may 2021
 Github Link :-- https://github.com/Zenomodiff/RFM95-LoRa-Module-Interfacing
 */

#include <Wire.h> 
#include <SPI.h>
#include <LoRa.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {
  Serial.begin(9600);
  while (!Serial);

  lcd.begin();
  lcd.setCursor(0,0);
  lcd.print("LoRa Receiver");
  delay(2500);
  lcd.clear();

  Serial.println("LoRa Receiver");

  if (!LoRa.begin(915E6)) {
  Serial.println("Starting LoRa failed!");
  lcd.setCursor(0,0);
  lcd.print("LoRa Receiver");
    while (1);
  }
}

void loop() {
lcd.clear();
  int packetSize = LoRa.parsePacket();
  if (packetSize) {

    Serial.print("Received packet '");

    while (LoRa.available()) {
      Serial.print((char)LoRa.read());
    }
    
    lcd.print(packet);

    Serial.print("' with RSSI ");
    Serial.println(LoRa.packetRssi());
    delay(2000);
  }
}

Lora Sender Code

C/C++
Lora Sender Code
/*feel free to contact
 * sreeramaj53@gmail.com
 * www.youtube.com/ZenoModiff
 * last updated - time 07:45 PM - date 27 may 2021
 Github Link :-- https://github.com/Zenomodiff/RFM95-LoRa-Module-Interfacing
 */

#include <SPI.h>
#include <LoRa.h>

int counter = 0;
int Senderled = 5;
int Errorled = 6;


void setup() {
  Serial.begin(9600);
  while (!Serial);

  Serial.println("LoRa Sender");
  pinMode(Senderled, OUTPUT);
  pinMode(Errorled, OUTPUT);
  digitalWrite(Senderled, LOW);
  digitalWrite(Errorled, LOW);

  if (!LoRa.begin(915E6)) {
    Serial.println("Starting LoRa failed!");
    digitalWrite(Errorled, HIGH);
    delay(2000);
    while (1);
  }
}

void loop() {
  digitalWrite(Senderled, LOW);
  digitalWrite(Errorled, LOW);
  
  Serial.print("Sending packet: ");
  Serial.println(counter);

  LoRa.beginPacket();
  LoRa.print("Hello From LoRA");
  digitalWrite(Senderled, HIGH);
  delay(500);
  digitalWrite(Senderled, LOW);
   
  LoRa.print(counter);
  LoRa.endPacket();

  counter++;

  delay(2000);
}

Credits

ZenoModiff
17 projects • 10 followers

Comments