Closed HamzaHajeir closed 3 years ago
Show us the photos of your LoRa modules. Esp. how you soldier the antenna. Some people may do it wrongly with ipex connector.
And use the default example below:
You need to wire the DIO0. Tell us your MCU (ESP32, Arduino...) and how you wire the pins. And make sure you use the correct frequency (433/868/915)
Hi, Thanks for your input
The LoRa Module is E19-433M20S2.
I've used the default examples, Does reset regularly because of default SS , RST , IRQ pins, After correction by LoRa.setPins(D1,D2,D0) it worked and passed the while(!LoRa.begin()) loop. Also changed Frequency to 433E6.
Pins wiring : NodeMCU | E19 D01 --> D0 NSS --> D1 RST --> D2 SCK --> D5 MISO--> D6 MOSI --> D7 VCC --> 3V3 Gnf --> Gnd
Well, Your input really helped to make one step further, I got aware of Antenna got 2 wires (Ant and Gnd), And soldered them separately.
#include <SPI.h>
#include <LoRa.h>
int counter = 0;
void setup() {
Serial.begin(115200);
while (!Serial);
Serial.println("LoRa Sender");
LoRa.setPins(csPin, resetPin, irqPin); // set CS, reset, IRQ pin
if (!LoRa.begin(433E6)) {
Serial.println("Starting LoRa failed!");
while (1);
}
}
void loop() {
Serial.print("Sending packet: ");
Serial.println(counter);
// send packet
LoRa.beginPacket();
LoRa.print("hello ");
LoRa.print(counter);
LoRa.endPacket();
counter++;
delay(5000);
}
#include <SPI.h>
#include <LoRa.h>
#ifdef ARDUINO_SAMD_MKRWAN1300
#error "This example is not compatible with the Arduino MKR WAN 1300 board!"
#endif
void onReceive(int packetSize);
void setup() {
Serial.begin(115200);
while (!Serial);
Serial.println("LoRa Receiver Callback");
LoRa.setPins(csPin, resetPin, irqPin); // set CS, reset, IRQ pin
if (!LoRa.begin(433E6)) {
Serial.println("Starting LoRa failed!");
while (1);
}
// Uncomment the next line to disable the default AGC and set LNA gain, values between 1 - 6 are supported
// LoRa.setGain(6);
// register the receive callback
LoRa.onReceive(onReceive);
// put the radio into receive mode
LoRa.receive();
}
void loop() {
// do nothing
}
void onReceive(int packetSize) {
// received a packet
Serial.print("Received packet '");
// read packet
for (int i = 0; i < packetSize; i++) {
Serial.print((char)LoRa.read());
}
// print RSSI of packet
Serial.print("' with RSSI ");
Serial.println(LoRa.packetRssi());
}
I've confirmed pins are correctly connecting to both sides (NodeMCU and E19) with continuity check. Also there's no short in both sides.
The same issue goes for this module : Ra-01
Same code.
Images : Sender :
Receiver :
confirmed the connections as described before : NodeMCU | Ra-01 D01 --> D0 NSS --> D1 RST --> D2 SCK --> D5 MISO--> D6 MOSI --> D7 VCC --> 3V3 Gnf --> Gnd
Strange. You never define csPin, resetPin and irqPin?
LoRa.setPins(csPin, resetPin, irqPin);
Your board is NodeMCU esp8266?
Seems you use non-default SPI pins for LoRa.
You can try to set the pin for SPI before LoRa.begin for both nodes.
SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_SS); LoRa.setPins(LORA_SS, LORA_RESET, LORA_DIO0);
Ofcourse I've defined them. Sorry it was as shared code just before #ifdef preprocessing code block :
#ifdef SENDER
*sender code*
#else
*receiver code*
#endif
You can find the code here.
Yes, It's ESP8266 NodeMCU. I've used this map for reference (Used the right side SPI Pins except CS) :
I'll do try your suggestion and keep this thread updated.
Seems you use non-default SPI pins for LoRa.
You can try to set the pin for SPI before LoRa.begin for both nodes.
SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_SS); LoRa.setPins(LORA_SS, LORA_RESET, LORA_DIO0);
There's no improvements of what I actually got, still not receiving messages
I've tested RadioLib, And it worked well, with adding DIO1 to the connection.
I don't know what happened here, But it seems software issue.
Dio1 is not used for sending or receiving.
If got free time this weekend, I will try my esp8266 with ra01.
Great,
For DIO1, It's just used in that library.
esp8266 + ra01/02 are confirmed working at https://github.com/sandeepmistry/arduino-LoRa/issues/419#issuecomment-747509424
Hi,
I'm testing out my LoRa connectivity using duplex example.
It seems everything up to sending is great! But I can't receive from both modules.
Both modules run this code :
Output (mainly for
LoRa.dumpRegisters(Serial);
: dev1 :dev2 :
By comparing, it seems 2 modules differs in 3 registers :
What might be my problem ?
could it be the soldered antenna ? 433Mhz antenna. but originally ipx terminal, I've cut it and soldered it to the pin.
Any ideas ?
UPDATE : I've checked out antenna, There's one antenna was shorted to gnd, I've fixed it. But until now, No module is receiving a message.