Need help Grove LoRa 433mhz

@tiwari73rajesh can you share the full error log!

@salman sir, this is the error I’m getting displayed on the serial monitor, despite unplugging the RX and TX cables before uploading the sketch and then again plugging them in after the sketch has been uploaded:

And, these are the error logs (or messages) I’m getting during upload failure, despite connecting the RX of radio to the TX of arduino, and the TX of radio to the RX of arduino:

Error messages of rf95_client: Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: “Arduino Uno”

Sketch uses 5778 bytes (17%) of program storage space. Maximum is 32256 bytes.
Global variables use 753 bytes (36%) of dynamic memory, leaving 1295 bytes for local variables. Maximum is 2048 bytes.
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x52
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x46
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x39
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x35
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x20
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x63
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x6c
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x69
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x65
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x6e
An error occurred while uploading the sketch

Error messages of rf95_server: Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: “Arduino Uno”

Sketch uses 5716 bytes (17%) of program storage space. Maximum is 32256 bytes.
Global variables use 719 bytes (35%) of dynamic memory, leaving 1329 bytes for local variables. Maximum is 2048 bytes.
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x52
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x46
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x39
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x35
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x20
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x73
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x65
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x72
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x76
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x65
An error occurred while uploading the sketch

Could there be a fault in the sketch?

No, Since the compilation completed successfully, there is less chance of bug in sketch.

Can you share the serial monitor Screen Shots?

This error due to the IDE can’t upload the code on Arduino,

  1. Check your USB Cable
  2. Check your Arduino with the example blink sketch
  3. Disconnect all wire and try uploading the sketch only

try these steps and let me know.

My USB Cables are working perfectly, because I’m able to successfully upload sketches on my board.
As directed by you, I also uploaded the the blink sketch on both of my boards, and the LEDs are also finely glowing.

I uploaded the sketches of rf_95 client and server on both of my Arduino Boards, with all the wires disconnected and then again plugged in all the wires after uploading of sketch. But still the same error is being displayed on the serial monitor - “init failed” …

@tiwari73rajesh In the code, the software serial is used pin digital pin 5 and 6, so can you try to connect the Rx and Tx on the digital pin 5 and 6!

1 Like

Okay… Let me try… This

Oh… Communication got established.

1 Like

Great. what was the problem?

Actually, everytime I was connecting the radio modules to the RX and TX Pins and sometimes, to Digital pins 2 and 3. It was mentioned as SoftwareSerial ss (5,6); in the sketch. When I connected the RX of my Radio to Digital 5 and the TX of my Radio to Digital 6, then also it didn’t work. But when I interchanged the connection and connected the RX of my Radio to Digital 6, and the TX of my Radio to Digital 5, then… it did work. And I got -----!!! " Hello World " displaying on my Serial Monitor.
Thanks a lot to you… Your suggestions on Connecting to Digital pins 5 and 6 really worked. You’re great… :vulcan_salute:t2: :ok_man:t2:

Now, I just need this last help.

How can I send the readings/measurements of a Grove Vibration Sensor (SW-420) fitted on one of my Arduinos, using (or through) the LoRa Radio Transmitter (fitted on the same Arduino), to the LoRa Radio Receiver that is fitted on the second (separate) Arduino?
This is very important for me. Kindly guide me…

Could you help me out?

you can add your sensor data here and send.

But how?
Where? What to write?

@salman sir, I have made the LoRa sender and receiver sketches for vibration sensor, and I’m attaching them with this message. The good thing is that I have successfully established communication between the two radios, along with vibration sensor and when the vibration sensor (on the first arduino, with transmitter) is getting any jerk or vibration, the led (on the second Arduino, with receiver) is lighting up. I am able to get the measurements of vibrations on the serial monitor of radio transmitter, but I need them on the serial monitor of the radio receiver also, then only a transmission will be taking place.

It took me 3.2 hours to prepare these two sketches. Kindly guide me, I’ll provide you with every required information.

LoRa_Sender (Vibration Sensor)

#include <SoftwareSerial.h>
#include <RH_RF95.h>
int EP = 2;

// Singleton instance of the radio driver
SoftwareSerial ss(5, 6);
RH_RF95 rf95(ss);

void setup() {
pinMode(EP, INPUT); //set EP input for measurment
Serial.begin(115200); //init serial 9600
Serial.println("----------------------Vibration demo------------------------");

if (!rf95.init())
{
Serial.println(“init failed”);
while(1);
}

rf95.setFrequency(434.0);
}

void loop() {
long measurement = TP_init();
delay(10);
Serial.print("measurment = ");
Serial.println(measurement);
if (measurement > 50) {
delay(200);
// Send a message to rf95_server
uint8_t data[] = “measurement”;
rf95.send(data, sizeof(data));
delay(6000);

rf95.waitPacketSent();

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

if(rf95.waitAvailableTimeout(3000))
{
    // Should be a reply message for us now   
    if(rf95.recv(buf, &len))
    {
        Serial.print("got reply: ");
        Serial.println((char*)buf);
    }
    else
    {
      digitalWrite(ss, LOW);
    }

}
}

long TP_init() {
delay(10);
long measurement = pulseIn (EP, HIGH); //waits for the pin to get HIGH and returns measurement
return measurement;
}

LoRa_Receiver (Vibration Sensor)

#include <SoftwareSerial.h>
#include <RH_RF95.h>

// Singleton instance of the radio driver
SoftwareSerial ss(5, 6);
RH_RF95 rf95(ss);

int ledPin = LED_BUILTIN;

void setup()
{
pinMode(ledPin, OUTPUT);
Serial.begin(115200); //init serial 115200
Serial.println("-----------------------Pole - Urban Area - GHY_1---------------");

if(!rf95.init())
{
    Serial.println("init failed");
    while(1);
} 

rf95.setFrequency(434.0);

}

void loop()
{
long measurement = TP_init();
delay(10);
Serial.print("measurment = ");
Serial.println(measurement);
if(rf95.available())
{
delay(200);
// 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))
{
Serial.print("GOT VIBRATION: ");
Serial.println((char*)buf);
digitalWrite(ledPin, HIGH);
delay(6000);

// Send a reply
    uint8_t data[] = "Thanks for the Data";
    rf95.send(data, sizeof(data));
    rf95.waitPacketSent();
    Serial.println("Sent a reply");
    
    digitalWrite(ledPin, LOW);
}
else
{
    Serial.println("recv failed");
}

}
}

long TP_init() {
delay(10);
long measurement = pulseIn (ss, HIGH); //wait for the pin to get HIGH and returns measurement
return measurement;
}

Kindly help as soon as possible sir…
Please detect my fault, for which the vibration measurement from the first arduino is not going to the second arduino.

Hi @tiwari73rajesh:
we can use sprintf function to make the number to string.like this:

  char *str = NULL;
  str = (char*)malloc(20);
  int number = 1;
  sprintf(str,"nubmer is %d\r\n",number);
  free(str);

Thanks @Hansen sir.
But where and how to insert this code?

Hi @tiwari73rajesh:

uint8_t data[20] = {0};
int measurement= 1;
sprintf(data,"measurementis %d\r\n",measurement);
rf95.send(data, sizeof(data));
1 Like

The code said by you is to be put in place of this (in the Transmitter Sketch)?