Hi everyone,
I’m trying to use two Grove Lora 868MHZ modules to communicate between two Arduino boards (link to product), but nothing seems to work.
Indeed, I tried sending single AT commands (es: “AT\r\n” and “AT”) via Serial communication, but I got no response.
Can anybody please help? It’s urgent.
My connections (module to arduino):
-
VCC to 3.3V
-
GND to GND
-
TX to pin5
-
RX to pin6
The code I’m using to send AT commands is:
include <SoftwareSerial.h>
SoftwareSerial ss(5,6);
void setup() {
ss.begin(9600);
Serial.begin(9600);
}
void loop() {
while(Serial.available() > 0){
ss.write(Serial.read());
}
while(ss.available() > 0){
Serial.write(ss.read());
}
}
I also tried the example from the libraries, but nothing seems to work. I just get the famous “init failed” error message
The code I also used for testing. I get “init failed” error message:
#include <RHRouter.h>
#include <RadioHead.h>
#include <RHUartDriver.h>
#include <RHDatagram.h>
#include <RHMesh.h>
#include <RHGenericDriver.h>
#include <RH_RF95.h>
#include <RHReliableDatagram.h>
// rf95_server.pde
// -*- mode: C++ -*-
// 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 rf95_client
// Tested with Anarduino MiniWirelessLoRa
#include <SoftwareSerial.h>
// Singleton instance of the radio driver
SoftwareSerial ss(5, 6);
RH_RF95 rf95(ss);
int led = 13;
void setup()
{
Serial.begin(115200);
Serial.println("RF95 server test.");
pinMode(led, OUTPUT);
while(!rf95.init())
{
Serial.println("init failed");
delay(100);
}
// Defaults after init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on
// The default transmitter power is 13dBm, using PA_BOOST.
// If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then
// you can set transmitter powers from 5 to 23 dBm:
//rf95.setTxPower(13, false);
rf95.setFrequency(868.0);
}
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);
Serial.print("got request: ");
Serial.println((char*)buf);
// Send a reply
uint8_t data[] = "And hello back to you";
rf95.send(data, sizeof(data));
rf95.waitPacketSent();
Serial.println("Sent a reply");
digitalWrite(led, LOW);
}
else
{
Serial.println("recv failed");
}
}
}