No reception on MKRWAN 1300 with P2P 915Mhz communication

I have two MKRWAN 1300s.

I used the MKRWAN library and updated both to the latest version which is 1.2.1 (or something like that, it's the latest one in the MKRWAN library). Simple send/receive doesn't work. "Modem.endPacket()" always returns -2 using the DumbModemLoraSenderwhich means some error is happening. I assume this is because this library wants to join a full network instead of just do P2P.

I used MKRWAN_v2, updated to the latest version in that library which is version 1.3.0, and had the same issue.

So I downloaded the arduino_LoRa library from github because it seemed like that was specifically designed for P2P communication. Didn't work with version 1.3.0 so I reverted to version 1.2.1. I got both working and running. I have no issues sending packets, although I looked at the library "endPacket" function and it is only possible for it to return 1 so maybe that doesn't mean much.

But I can't seem to receive anything. I'm using the LoRaSender and LoRaReceiver that come with the library so they should basically work out of the box. The only thing that isn't standard that I'm using is my antenna and antenna connector.

I do have two standard antennas coming in the mail but it seems odd this wouldn't work. I know for a fact the antenna works for 915mhz communication because I used this exact antenna with a rfm69 transceiver on a Raspberry Pi and had no issues with it at all.

1 Like

I don't have a solution, just saying that I'm having the same problem. I need P2P comms between two MKRWAN 1310s. I'm not getting any errors with LoRaSender and LoRaReceiver but also no success.

I managed to get mine working. I will consult my files again when I’m near them but I remember the solution made me feel foolish.

If I’m recalling correctly, the result was that both boards needed to be updated to the latest version using the MKRWAN library OR the MKRWAN_V2 library then have the arduino_lora dumb sender added to one and dumb receiver to the other. I believe the successful version was the original MKRWAN library. I had simply neglected some crucial step

1 Like

the documention for the github arduino-LoRa library states it does support the MKR1300 board but does mention some requirements
it is possible the library does not support the MKR1310
I have used the library with a number of LoRa modules for P2P communication and it worked OK

Trust me, it does work. I’ve used both the 1300 and the 1310, it’s worked on both.

I’ve confirmed it was the MKRWAN update script that worked for me.

Upload the update script on one and wait till it says it’s finished, then upload the sender. Do the same on the second Arduino but upload the receiver.

Be mindful that if you try to start LoRa without an antenna connected the program will fail to start.

What I like to do when I’m stumped like this is attach a buzzer, insert some beeps at crucial steps, and keep track of how many beeps there are to see where/how my program is failing.

1 Like

I just remembered what the issue was.

You probably still have some Serial print statements somewhere.

If you try to use LoRa without an antenna, the whole program fails. Likewise, if you try to use Serial without an open Serial port, the whole program fails.

The dumb sender and receiver have built in Serial print statements that you have to delete or comment out for the programs to run.

Also, if you used Serial print statements to try and troubleshoot the LoRa library, make sure you remove those as well.

You sure about that ?

The reality is, that whilst its not recommended to operate a LoRa device with no antenna connected for the obvious reasons, the LoRa device will initialise if there is no antenna connected.

Thank you, everyone! The sandeepmistry repo does have some support for MKRWAN boards now. As for libraries, I'm working with MKRWAN_v2 ver. 1.3.2 and the Sandeep Mistry LoRa library ver. 0.8.0. I have antennas on my two MKRWAN 1310s and I'm in Canada, so using 915MHz.

Here's the code that I'm using for sending from one MKRWAN:
#include <SPI.h>
#include <LoRa.h>
#include <MKRWAN.h>

/* LoRaModem modem; */

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

while (!Serial);
Serial.println("LoRa Sender");
if (!LoRa.begin(915E6)) {
Serial.println("Starting LoRa failed!");
while (1); {}
}
delay(1000);
}

void loop() {
Serial.println();
Serial.println("Enter a message to send to network");
// Serial.println("(make sure that end-of-line 'NL' is enabled)");

while (!Serial.available());
String msg = Serial.readStringUntil('\n');

Serial.println();
Serial.print("Sending: " + msg + " - ");
for (unsigned int i = 0; i < msg.length(); i++) {
Serial.print(msg[i] >> 4, HEX);
Serial.print(msg[i] & 0xF, HEX);
Serial.print(" ");
}
Serial.println();

// send packet
Serial.print("Sending packet: ");
LoRa.beginPacket();
for (unsigned int i = 0; i < msg.length(); i++) {
LoRa.print(msg[i] >> 4, HEX);
LoRa.print(msg[i] & 0xF, HEX);
LoRa.print(" ");
}
LoRa.endPacket();
delay(500);
}

And the code for receiving on my other MKRWAN:
#include <SPI.h>
#include <LoRa.h>
#include <MKRWAN.h>
String contents = "";

/* LoRaModem modem; */

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

while (!Serial);
Serial.println("LoRa Receiver");
if (!LoRa.begin(915E6)) {
Serial.println("Starting LoRa failed!");
while (1); {}
}
delay(1000);

}

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

// read packet
while (LoRa.available()) {  
  contents += (char)LoRa.read();
}

// print RSSI of packet
Serial.print("' with RSSI ");
Serial.println(LoRa.packetRssi());
Serial.println(contents);

}
LoRa.endPacket();
delay(500);
}

I’m quite positive and I’ve tested it with both Serial and a buzzer. Without the antenna, running the LoRa library has frozen my program every single time.

Regardless, the important part is that the same is true for a nonexistent Serial port.

As I mentioned before, the MKRWAN update script l is what worked for me. Not the MKRWAN_v2. Then use the dumb LoRa sender-receiver from the Arduino-LoRa library.

Your code has tons of print statements. Do you have both Arduinos connected to a serial monitor? If not, then the Arduino without a Serial monitor will crash the moment you run the program.

I just got it to work. I can't thank you both enough.

Would be helpful to others if you explained how you got it to work.

The first step was to update the firmware for both of my MKRWAN 1310s using the online library (MKRWAN/examples/MKRWANFWUpdate_standalone at master · arduino-libraries/MKRWAN · GitHub). The second step was to download Sandeep Mistry's [repo] and use the "examples". I used LoRaSender for sending text and LoRaReceiver for getting the text. I set the baud at 9600 and I'm sending across a room with both Arduinos connected to PCs via USB, and with serial ports open. I've tried it with and without antennas connected and both work, but the signal is barely usable without the antennas even in my little workshop.

Next, I'll try to send sensor data instead of just text, and I'll also try sending to a Seeed LoRaWAN gateway.

You tried it without antennas, really ?

Thats not good, you can destroy the LoRa part of the module.

And a small point, you might expect a radio device not to work without an antenna.

1 Like

Really? Good to know. I put the antennas back on.

My goal is to build a device for measuring water quality in rivers. The sensor unit will be anchored to the shoreline using aircraft cable, and I'm hoping to also use the cable as an antenna. I haven't tested it yet, and I don't even know the resistance of the cable so there's still stuff to work out. If LoRa doesn't work for the "river-to-shoreline" communication, I'll try to use some type of coax cable and 2-wire comms.

What do you mean, 'Good to know' ?

In post #7 I said;

"The reality is, that whilst its not recommended to operate a LoRa device with no antenna connected for the obvious reasons"

Good luck.

This is a joke, right? How much cable does it take to make 1/4 wavelength at 915 mHz? Perhaps 2 inches?

some time back I implemented a river monitoring system using The Things UNO with a BMP280 temperature/pressure sensor, a SR04M ultrasonic transducer and a DS18B20 DallasTemperature sensor uploading data over LoRaWAN to the myDevices/cayenne desktop
image

I was reading the sensors and uploading data every 10 minutes

you can see the river is tidal – rise and fall of about 10cm

also experimented with turbidity, pH and DO sensors

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.