Hi,
I’m just getting started with implementing a simple p2p LoRa setup with a Wisblock 4631 and a Dragino LG01-N gateway.
I am aware that this gateway doesn’t support LoRaWAN.
I have the Arduino IDE configured and have uploaded the Rakwireless example TX sketch from here:
WisBlock/examples/RAK4630/communications/LoRa/LoRaP2P at master · RAKWireless/WisBlock · GitHub.
The LG01 gateway is running a simple P2P server sketch, as below:
/*
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 <[email protected]>
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.2;
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);
// 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
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");
}
}
}
I’m not seeing any data receiving on the gateway end, despite the 4631 sketch showing me onTxDone messages.
As I’m new to this, my assumption is that I’m missing something simple. I have checked the LoRa parameters and they seem to be fine.