About Dragino LG01-P Rf distance


#1

Hi, i’m working on dragino lg01-p as a gateway and i’m testing the distence between gateway and node. My node is sx1272 mbed with arduino. When i’m testing Lora_Simple_Server_Yun and Lora_Simple_Client_Arduino examples, i can not get good results about distance.
Firstly, i cannot make a connection in 125kHz baudrate between gateway and node. Also 250kHz is same. Only 500kHz is good for communication but distance is too small as 20 mt, after 20 meters communication lost between gateway and node. That is the big problem for me.
Anyone has been faced that distance problem wih dragino lg01-p ?
With warmest regards.


#2

While this isn’t a LoRaServer issue probably, I have reliably gotten 2-3km distance at 125kHz baudrate from my old test gateway which was a Dragino LG01-P. So I would say that only getting 20m is probably pointing to some other underlying issue. What type of environment are you testing it in, only inside mixture of inside and out, and what type of building material are you trying to deal with the signal getting through?


#4

Hellow, my name is BoAn. I’m Taiwanese. It’s nice to hear your success in the testing. I’ve bought DRAGINO LoRa IOT Kit which is 915Hz. I’m also testing the simplest communication by upload LoRa_Simple_Client_Arduino to Arduino Uno with LoRa Shield and upload LoRa_Simple_Server_Yun to LG01-P.
However, When I upload the sketch to Arduino Uno, I got
“LoRa_Simple_Client_Arduino:804:16: error: expected primary-expression before ‘.’ token.”

When I upload the other sketch to LG01-P, I got
“‘class RH_RF95’ has no member named ‘setSpreadingFactor’”

It’s strange that how come it goes wrong while I using the sample code which frequency has been edit with the right one.
Please give me a hand. Thank you.

The following is my code.

LoRa_Simple_Server_Yun
/*
LoRa Simple Yun Server :
Support Devices: LG01.

Example sketch showing how to create a simple messageing server,
with the RH_RF95 class. RH_RF95 class does not provide for addressing or
reliability, so you should only use RH_RF95 if you do not need the higher
level messaging abilities.

It is designed to work with the other example LoRa Simple Client

User need to use the modified RadioHead library from:
https://github.com/dragino/RadioHead

modified 16 11 2016
by Edwin Chen support@dragino.com
Dragino Technology Co., Limited
*/
//If you use Dragino IoT Mesh Firmware, uncomment below lines.
//For product: LG01.
#define BAUDRATE 115200

//If you use Dragino Yun Mesh Firmware , uncomment below lines.
//#define BAUDRATE 250000

#include <Console.h>
#include <SPI.h>
#include <RH_RF95.h>

// Singleton instance of the radio driver
RH_RF95 rf95;

int led = A2;
float frequency = 915.0;

void setup()
{
pinMode(led, OUTPUT);
Bridge.begin(BAUDRATE);
Console.begin();
while (!Console) ; // Wait for console port to be available
Console.println(“Start Sketch”);
if (!rf95.init())
Console.println(“init failed”);
// Setup ISM frequency
rf95.setFrequency(frequency); //@THE BUG IS IN THIS LINE
// Setup Power,dBm
rf95.setTxPower(13);

// Setup Spreading Factor (6 ~ 12)
rf95.setSpreadingFactor(7);//@THE BUG IS IN THIS LINE

// Setup BandWidth, option: 7800,10400,15600,20800,31200,41700,62500,125000,250000,500000
rf95.setSignalBandwidth(125000);

// Setup Coding Rate:5(4/5),6(4/6),7(4/7),8(4/8)
rf95.setCodingRate4(5);

Console.print("Listening on frequency: ");
Console.println(frequency);
}

void loop()
{
if (rf95.available())
{
// Should be a message for us now
uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
if (rf95.recv(buf, &len))
{
digitalWrite(led, HIGH);
RH_RF95::printBuffer("request: ", buf, len);
Console.print("got request: ");
Console.println((char*)buf);
Console.print("RSSI: ");
Console.println(rf95.lastRssi(), DEC);

  // Send a reply
  uint8_t data[] = "And hello back to you";
  rf95.send(data, sizeof(data));
  rf95.waitPacketSent();
  Console.println("Sent a reply");
  digitalWrite(led, LOW);
}
else
{
  Console.println("recv failed");
}

}
}

LoRa_Simple_Client_Arduino
#include <SPI.h>
#include <RH_RF95.h>

// Singleton instance of the radio driver
// RH_RF95 rf95
float frequency = 915.0;

void setup()
{
Serial.begin(9600);
//while (!Serial) ; // Wait for serial port to be available
Serial.println(“Start LoRa Client”);
if (!RH_RF95.init())
Serial.println(“init failed”);
// Setup ISM frequency
rf95.setFrequency(frequency);
// Setup Power,dBm
rf95.setTxPower(13);

// Setup Spreading Factor (6 ~ 12)
rf95.setSpreadingFactor(7);

// Setup BandWidth, option: 7800,10400,15600,20800,31200,41700,62500,125000,250000,500000
//Lower BandWidth for longer distance.
rf95.setSignalBandwidth(125000);

// Setup Coding Rate:5(4/5),6(4/6),7(4/7),8(4/8)
rf95.setCodingRate4(5);
}

void loop()
{
Serial.println(“Sending to LoRa Server”);
// Send a message to LoRa Server
uint8_t data[] = “Hello, this is device 1”;
RH_RF95.send(data, sizeof(data));

RH_RF95.waitPacketSent();
// Now wait for a reply
uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);

if (RH_RF95.waitAvailableTimeout(3000))
{
// Should be a reply message for us now
if (RH_RF95.recv(buf, &len))
{
Serial.print("got reply: ");
Serial.println((char*)buf);
Serial.println("RSSI: ");
Serial.println(RH_RF95.lastRssi(), DEC); //@THE BUG IS IN THIS LINE
}
else
{
Serial.println(“recv failed”);
}
}
else
{
Serial.println(“No reply, is LoRa server running?”);
}
delay(5000);
}


#5

The error that you are getting from the Arduino Client is because you commented out rf95 when you shouldn’t have. The example that I just pulled up in the Arduino IDE doesn’t have it commented out, so I don’t know why if you said you didn’t change anything, that your code had it commented out. To help you understand better, the error is pointing you to the line rf95.setFrequency(frequency); and because you commented out the line where rf95 is set, the compiler is expecting something different here since the code is trying to call the rf95 class to set the Frequency. You would have gotten the same error for any other line that uses the same formatting but the compiler never got to them.

As for the other error:

I’m not really sure why you are getting that error, the copy of the RH_RF95.cpp file that I have on my own computer does have setSpreadingFactor. The best thing you could do there is double check the copy of the file that you have on your computer and see if that is in there. In my file it’s at line 367 and it should look like the following:

void RH_RF95::setSpreadingFactor(int8_t sf)

Also for the ease of people reading your posts in the future whether here or on another site that allows you to use Markdown to format your posts can you please learn how to share your code properly (by using Markdown to format it like I did above) instead of just copy and pasting it. It generally helps people who are reading the posts and are trying to help you, it looks nicer, and it’s really simple to do!

Either way, hopefully my response helps solve some of your problems and feel free to reach out if you have any other problems.