Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lora Range SX1278
#1
Hello everyone ! especially to Hificat... I am developing a project where we are using Lora SX1278 in the KC868-A6 module, according to the characteristics of the Lora the device has a range of 1 km - 5 km, the code used by the sender is the following :

Code:
#include "Arduino.h"
#include "PCF8574.h"
#include <RTClib.h>
#include <Wire.h>
#include <LoRa.h>
#include <SPI.h>
#include <WiFi.h>

#define ss 5
#define rst 21
#define dio0 2

void setup() {

  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
 
  while (!Serial);
  Serial.println("LoRa Sender");

  LoRa.setPins(ss, rst, dio0);    //setup LoRa transceiver module

  while (!LoRa.begin(433E6))     //433E6 - Asia, 866E6 - Europe, 915E6 - North America
  {
    Serial.println(".");
    delay(500);
  }
  LoRa.setSyncWord(0xA5);
  Serial.println("LoRa Initializing OK!");
  Dwin_hmi.begin(115200);
  LoRa.setPins(ss, rst, dio0);

  pcf8574.pinMode(P0, OUTPUT);
  pcf8574.pinMode(P1, OUTPUT);
  pcf8574.pinMode(P2, OUTPUT);
  pcf8574.pinMode(P3, OUTPUT);
  pcf8574.pinMode(P4, OUTPUT);
  pcf8574.pinMode(P5, OUTPUT);

  Serial.print("Init pcf8574...");

  if (pcf8574.begin()){
    Serial.println("OK");
  }else{
    Serial.println("NO");
  }

  pcf8574.digitalWrite(P0, HIGH);
  pcf8574.digitalWrite(P1, HIGH);
  pcf8574.digitalWrite(P2, HIGH);
  pcf8574.digitalWrite(P3, HIGH);
  pcf8574.digitalWrite(P4, HIGH);
  pcf8574.digitalWrite(P5, HIGH);

}

void loop() {

  LoRa.beginPacket();   //Send LoRa packet to receiver
  LoRa.print("LP01");
  LoRa.endPacket();
  Serial.println("Sending packet LP0: 1 ");

}


And the code for the receiver is the following

Code:
#include "Arduino.h"
#include "PCF8574.h"
#include <RTClib.h>
#include <Wire.h>
#include <LoRa.h>
#include <SPI.h>
#include <MCP23017.h>

#define ss 5
#define rst 14
#define dio0 21

void setup() {

  Serial.begin(115200);
  Serial1.begin(9600,SERIAL_8N1,13,12);

  while (!Serial);
  Serial.println("LoRa Receiver");

  LoRa.setPins(ss, rst, dio0);    //setup LoRa transceiver module

  while (!LoRa.begin(433E6))     //433E6 - Asia, 866E6 - Europe, 915E6 - North America
  {
    Serial.println(".");
    delay(500);
  }
  LoRa.setSyncWord(0xA5);
  Serial.println("LoRa Initializing OK!");

}

void loop() {

  //Serial1.write(0x01);
  //delay(20);
  //Serial1.flush();
  //delay(15);

  int packetSize = LoRa.parsePacket();    // try to parse packet
  if (packetSize)
  {
  
    Serial.print("Received packet '");

    while (LoRa.available())              // read packet
    {
      String LoRaData = LoRa.readString();
      Serial.print(LoRaData);

      if (LoRaData == "LP01") {
        pcf8574.digitalWrite(P0, HIGH);
      }

      if (LoRaData == "LP00") {
        pcf8574.digitalWrite(P0, LOW);
      }
     
    }
    Serial.print("' with RSSI ");         // print RSSI of packet
    Serial.println(LoRa.packetRssi());
  }

}

I have soldered the antenna on the correct pin and have done some tests, the communication works fine up to 3 meters, but when I move the modules further than 3 meters the communication fails ... maybe you could help me a little, we require a range of more than 200 meters... can you help me and tell me if I'm making a mistake in programming or installing the hardware? Or if I need to buy another Lora module maybe...?


Attached Files Image(s)
           
Reply
#2
here have LoRa sender and receiver arduino source code.
https://www.kincony.com/forum/forumdisplay.php?fid=22
what power supply you have used?
Reply
#3
(04-18-2023, 06:27 AM)admin Wrote: here have LoRa sender and receiver arduino source code.
https://www.kincony.com/forum/forumdisplay.php?fid=22
what power supply you have used?

Of course I have used the example codes from the following links:

sender ->

https://www.kincony.com/forum/showthread.php?tid=1871

Receiver ->

https://www.kincony.com/forum/showthread.php?tid=1870

We are using the 12V 2A supply that comes with the KC868 module and for the other module we are using a 12V 150watt converter for the car.
Reply
#4
ok, we will test it as your way these days.
Reply
#5
Post the picture of the signal.like my photo.


Attached Files Image(s)
   
Reply
#6
(04-20-2023, 01:02 AM)KinCony Support Wrote: Post the picture of the signal.like my photo.
works ! We have only changed the antenna and we have more range! it's great ! Now we just need to know if there is any way for the receiving module to confirm the reception of data to the transmitting module or if there is communication between the LoRa modules! ... we are configuring a main module as a transmitter and 2 other modules as receivers! Is it possible to do this ?
Reply
#7
sure, that can be done.
Reply
#8
(05-02-2023, 05:09 AM)admin Wrote: sure, that can be done.

Is there a demo where Lora is configured as Half duplex or full duplex?
Reply
#9
sorry , no this demo now, you can search by Google.
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)