GPS Tracker with LoRa

Hi everyone :slight_smile: :slight_smile:
I have a project that i call “GPS Tracker”. In my project, i’m want to tracking vessel using GPS UBLOX neo, LoRa RFM95 and microcontroller arduino uno. For data transmission, i used multi-hop transmission using LoRa that has a purpose for increase data transmission distance.
I’m used 3 node which one for source node, one for intermediate node and last for destination node.I already made code for all three, but when I did a trial by entering the code into the device, it didn’t produce any results on the serial monitor on Arduino
I’m pretty sure about the code that I made because there aren’t any errors that come out when I compile it but to be sure I want to ask for suggestions or improvements from all of you for the project that I made
This my code for source node

#include <RHRouter.h>
#include <RH_RF95.h>
#include <SPI.h>
#include <TinyGPS++.h>
#include <SoftwareSerial.h>

#define RADIO_FREQUENCY 915.0
#define RADIO_TX_POWER 6 
#define RADIO_SPREADFACTOR 8
#define CLIENT_ADDRESS 1
#define SERVER1_ADDRESS 2
#define SERVER2_ADDRESS 3
#define SERVER3_ADDRESS 4

RH_RF95 driver;
//RH_RF95 (CLIENT_ADDRESS); 
// Class to manage message delivery and receipt, using the driver declared above
RHRouter manager(driver, CLIENT_ADDRESS);

static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600;
TinyGPSPlus gps;
SoftwareSerial ss(RXPin, TXPin);

void setup() 
{
  Serial.begin(115200);
  ss.begin(GPSBaud);
  Serial.println(F("A simple demonstration of TinyGPS++ with an attached GPS module"));
  Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
  if (!manager.init())
    Serial.println("init failed");
  // Defaults after init are 434.0MHz, 0.05MHz AFC pull-in, modulation FSK_Rb2_4Fd36

    // Setup ISM frequency
    driver.setFrequency(RADIO_FREQUENCY);

    // Setup Power,dBm
    driver.setTxPower(RADIO_TX_POWER);
    
  // Manually define the routes for this network
  manager.addRouteTo(SERVER1_ADDRESS, SERVER1_ADDRESS);  
  manager.addRouteTo(SERVER2_ADDRESS, SERVER1_ADDRESS);
 // manager.addRouteTo(SERVER3_ADDRESS, SERVER3_ADDRESS);
}  
//uint8_t data[] = "Hallo ini dari kapal 1 !";
// Dont put this on the stack:
/*struct{
  double lat;
  double lng;
      }  data;*/
//uint8_t buf[RH_ROUTER_MAX_MESSAGE_LEN];

void loop()
{
  if (driver.available())
  {
  while(ss.available() > 0)
  if (gps.encode(ss.read()))
    Serial.print(F("Location: ")); 
      if (gps.location.isValid())
        {
           Serial.print("Latitude= "); 
           double lat=gps.location.lat();
           Serial.print(lat, 6);
           Serial.print(" Longitude= ");
           double lng=gps.location.lat(); 
           Serial.print(lng, 6);
           uint8_t data[2*sizeof(double)];
           data[0]=lat;
           data[sizeof(double)]=lng;
           Serial.println("Sending to rf22_router_server3");
                 if (manager.sendtoWait((uint8_t)data, sizeof(data), SERVER2_ADDRESS) != RH_ROUTER_ERROR_NONE)
                      Serial.println("sendtoWait failed");
                 else
                    {
                      uint8_t buf[RH_ROUTER_MAX_MESSAGE_LEN];
                      uint8_t len = sizeof(buf);
                      uint8_t from;    
                 if (manager.recvfromAckTimeout(buf, &len, 3000, &from))
                    {
                       Serial.print("got reply from : 0x");
                       Serial.print(from, HEX);
                       Serial.print(": ");
                       Serial.println((char*)buf);
                    }
                      else
                        {
                           Serial.println("No reply, is rf22_router_server1, rf22_router_server2 and rf22_router_server3 running?");
                        }   
                    }
        }
      else
        {
          Serial.print(F("INVALID"));
        }
  if (millis() > 5000 && gps.charsProcessed() < 10)
  {
    Serial.println(F("No GPS detected: check wiring."));
    while(true);
  } 
  }
}

and this is for intermediate node

#include <RHRouter.h>
#include <RH_RF95.h>
#include <SPI.h>

#define CLIENT_ADDRESS 1
#define SERVER1_ADDRESS 2
#define SERVER2_ADDRESS 3
#define SERVER3_ADDRESS 4
#define RADIO_FREQUENCY 915.0
#define RADIO_TX_POWER 6
#define RADIO_SPREADFACTOR 8

// Singleton instance of the radio
RH_RF95 driver;

// Class to manage message delivery and receipt, using the driver declared above
RHRouter manager(driver, SERVER1_ADDRESS);

void setup() 
{
  Serial.begin(9600);
  if (!manager.init())
    Serial.println("init failed");
  // Defaults after init are 434.0MHz, 0.05MHz AFC pull-in, modulation FSK_Rb2_4Fd36

      // Setup ISM frequency
    driver.setFrequency(RADIO_FREQUENCY);

    // Setup Power,dBm
    driver.setTxPower(RADIO_TX_POWER);
    
  // Manually define the routes for this network
  manager.addRouteTo(CLIENT_ADDRESS, CLIENT_ADDRESS);  
  manager.addRouteTo(SERVER2_ADDRESS, SERVER2_ADDRESS);
 // manager.addRouteTo(SERVER2_ADDRESS, SERVER1_ADDRESS);
}

void loop()
{
  if (driver.available())
  {
  uint8_t buf[RH_ROUTER_MAX_MESSAGE_LEN];
  uint8_t len = sizeof(buf);
  uint8_t from;
  if (manager.recvfromAck(buf, &len, &from))
  {
    Serial.print("got request from : 0x");
    Serial.print(from, HEX);
    Serial.print(": ");
    Serial.println((char*)buf);
    Serial.print("RSSI: ");
    Serial.println(driver.lastRssi(), DEC);

    
    // Send a reply back to the originator client
    uint8_t data[] = "And hello back to you from server1";
    if (manager.sendtoWait(data, sizeof(data), from) != RH_ROUTER_ERROR_NONE)
      Serial.println("sendtoWait failed");
  }
  }
}

this’s for destination node

#include <RHRouter.h>
#include <RH_RF95.h>
#include <SPI.h>

// In this small artifical network of 4 nodes,
// messages are routed via intermediate nodes to their destination
// node. All nodes can act as routers
// CLIENT_ADDRESS <-> SERVER1_ADDRESS <-> SERVER2_ADDRESS<->SERVER3_ADDRESS
#define CLIENT_ADDRESS 1
#define SERVER1_ADDRESS 2
#define SERVER2_ADDRESS 3
#define SERVER3_ADDRESS 4
#define RADIO_FREQUENCY 915.0
#define RADIO_TX_POWER 6
#define RADIO_SPREADFACTOR 8

// Singleton instance of the radio
RH_RF95 driver;

// Class to manage message delivery and receipt, using the driver declared above
RHRouter manager(driver, SERVER2_ADDRESS);

void setup() 
{
  Serial.begin(9600);
  if (!manager.init())
    Serial.println("init failed");
  // Defaults after init are 434.0MHz, 0.05MHz AFC pull-in, modulation FSK_Rb2_4Fd36

    // Setup ISM frequency
    driver.setFrequency(RADIO_FREQUENCY);

    // Setup Power,dBm
    driver.setTxPower(RADIO_TX_POWER);
    
  // Manually define the routes for this network
  manager.addRouteTo(CLIENT_ADDRESS, SERVER1_ADDRESS);  
  manager.addRouteTo(SERVER1_ADDRESS, SERVER1_ADDRESS);
  //manager.addRouteTo(SERVER3_ADDRESS, SERVER2_ADDRESS);
}
void loop()
{
  if (driver.available())
  {
  uint8_t buf[RH_ROUTER_MAX_MESSAGE_LEN];
  uint8_t len = sizeof(buf);
  uint8_t from;
  if (manager.recvfromAck(buf, &len, &from))
  {
    Serial.print("got request from : 0x");
    Serial.print(from, HEX);
    Serial.print(": ");
    Serial.println((char*)buf);
    Serial.print("RSSI: ");
    Serial.println(driver.lastRssi(), DEC);

    
    // Send a reply back to the originator client
    uint8_t data[] = "And hello back to you from server2";
    if (manager.sendtoWait(data, sizeof(data), from) != RH_ROUTER_ERROR_NONE)
      Serial.println("sendtoWait failed");
  }
}
}

can anyone help me? Is there something wrong with my code so no results come out on the serial monitor on the source node? I really appreciate your help!

Have You tested parts of the proj? Like running first node versus the middle node, getting signs of life from it?

You really do need to check individual bits of this setup.

So number one, is the source node actually transmitting the location ?

Have checked with some simple standalone code that you can actually read the postion from the GPS ?

yes I have tried sending data in the form of sentences through the source node to the destination node but must go through the intermediate node first and succeeded well.
But when I try to send GPS data in the form of coordinates, I don’t even get any results on the serial monitor on the source node.
I have also tried to use the GPS code itself and I get the coordinate data but when I combine it with the code on LoRa I don’t even get GPS coordinates anymore.
I suspect I have an error code on my source node. I hope you can check it out and make suggestions or corrections

Have you tried the example sketch that comes with the TinyGPSPlus library to check the GPS is actually working ?

And of course you do have the GPS outdoors with a good view of the sky ?

Incidently when you are after help with your programs include as much detail as you can in the first post, include things like;

I have tried sending data in the form of sentences through the source node to the destination node but must go through the intermediate node first and succeeded well

Yes I have tried using sketch examples from TinyGPSPlus and it worked well, I also did this project outdoors.
And this is the code at the source node that I use to send data in the form of sentences, and this code works well.
This’s the code :

#include <RHRouter.h>
#include <RH_RF95.h>
#include <SPI.h>

#define RADIO_FREQUENCY 915.0
#define RADIO_TX_POWER 6
#define RADIO_SPREADFACTOR 8
#define CLIENT_ADDRESS 1
#define SERVER1_ADDRESS 2
#define SERVER2_ADDRESS 3
#define SERVER3_ADDRESS 4

RH_RF95 driver;
//RH_RF95 (CLIENT_ADDRESS); 

// Class to manage message delivery and receipt, using the driver declared above
RHRouter manager(driver, CLIENT_ADDRESS);

void setup() 
{
  Serial.begin(115200);
  if (!manager.init())
    Serial.println("init failed");
  // Defaults after init are 434.0MHz, 0.05MHz AFC pull-in, modulation FSK_Rb2_4Fd36

    // Setup ISM frequency
    driver.setFrequency(RADIO_FREQUENCY);

    // Setup Power,dBm
    driver.setTxPower(RADIO_TX_POWER);
    
  // Manually define the routes for this network
  manager.addRouteTo(SERVER1_ADDRESS, SERVER1_ADDRESS);  
  manager.addRouteTo(SERVER2_ADDRESS, SERVER1_ADDRESS);
 // manager.addRouteTo(SERVER3_ADDRESS, SERVER3_ADDRESS);
}

void loop()
{
  while(1)
  {
 Serial.println("Sending to rf22_router_server2");
 uint8_t data[] = "Hallo ini dari kapal 1 !";
  if (manager.sendtoWait(data, sizeof(data), SERVER2_ADDRESS) != RH_ROUTER_ERROR_NONE)
    Serial.println("sendtoWait failed");
   else
  {
    uint8_t buf[RH_ROUTER_MAX_MESSAGE_LEN];
    uint8_t len = sizeof(buf);
    uint8_t from;    
    if (manager.recvfromAckTimeout(buf, &len, 3000, &from))
    {
      Serial.print("got reply from : 0x");
      Serial.print(from, HEX);
      Serial.print(": ");
      Serial.println((char*)buf);
    }
    else
    {
      Serial.println("No reply, is rf22_router_server1, rf22_router_server2 and rf22_router_server3 running?");
    }
  }
  /*else
    Serial.println("sendtoWait failed. Are the intermediate router servers running?");*/
  }
}

for the code at the intermediate node and destination node is almost the same as the code that I attached above

is there anyone who can help me? what's wrong with this project so it doesn't work well?

study APRS and think twice about reinventing the wheel.

what do you mean "reinventing the wheel"?. What's the correlation between ARPS and the project that I am working on?

You need to making sure that the GPS part of the code works properly.

Have the GPS part of the code printing out latitude, longitude neatly to the serial monitor, your current code wont do that, you appear not to have checked it.

You might want to provide the forum with an overview of what you are actually trying to track and where, you might get some helpful pointers.

srnet:
Have you tried the example sketch that comes with the TinyGPSPlus library to check the GPS is actually working ?

And of course you do have the GPS outdoors with a good view of the sky ?

Being outside, in the free air, has never been needed for my NEO-6M. It starts up indoors a few meters away from windows and the outer wall.

Railroader:
Being outside, in the free air, has never been needed for my NEO-6M. It starts up indoors a few meters away from windows and the outer wall.

Your lucky.

Mine might get a fix eventually when they are indoors a few metres away from windows. In some locations indoors it can take 10-15 minutes or more, but that is as expected.

However, the ones that are not faulty, always get a fix in typically 40 seconds, when they are outside and a clear view of the sky.

I admit that passing in a tunnel of tree branches. especially whet trees, the readings get corrupted.

Railroader:
I admit that passing in a tunnel of tree branches. especially whet trees, the readings get corrupted.

And that happens when your indoors ?

Most odd.

Indoors it works, as I se it, really well. Walking speed of 5 mph is the most I can read, height above see level, but that parameter has no good precision anywhere. Number of sattelites…. Eventual variation of longitud and lattide has not been monitored.

hi I just changed some parts of my code, but I still can’t get the results I want. I have also tried the code for the GPS itself and I got the coordinate data. But when I combined the GPS code with LoRa that I made, the GPS coordinate data did not appear, but LoRa still sent the data. On the serial monitor at the destination node, it receives data sent by the source node but only the blank results are displayed on the serial monitor.
I attach the following code with the results that I got on the source node and destination node
Code on source node :

#include <RHRouter.h>
#include <RH_RF95.h>
#include <SPI.h>
#include <TinyGPS++.h>
#include <SoftwareSerial.h>

#define RADIO_FREQUENCY 915.0
#define RADIO_TX_POWER 6
#define RADIO_SPREADFACTOR 8
#define CLIENT_ADDRESS 1
#define SERVER_ADDRESS 2

static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600;
TinyGPSPlus gps;
SoftwareSerial ss(RXPin, TXPin);
double LAT;
double LNG;

#define VEHICLE 1

#if VEHICLE == 1
    #define SEND_TO 3
#endif

RH_RF95 driver;

// Class to manage message delivery and receipt, using the driver declared above
RHRouter radioManager(driver, VEHICLE);

// define buf - don't put this on the stack:
uint8_t buf[RH_ROUTER_MAX_MESSAGE_LEN];

void setup() {
    Serial.begin(115200);
    ss.begin(GPSBaud);

    // initiate radio
    if (!radioManager.init()){
        Serial.println("radio init failed");
    } 
    // Setup ISM frequency
    driver.setFrequency(RADIO_FREQUENCY);

    // Setup Power,dBm
    driver.setTxPower(RADIO_TX_POWER);

    // Manually define the routes for this network
    radioManager.addRouteTo(3, 2);  
    radioManager.addRouteTo(2, 2);  

    // Just to be sure... delete any routes to self?!
    radioManager.deleteRouteTo(VEHICLE);

}

void loop() {
  // This sketch displays information every time a new sentence is correctly encoded.
    while (ss.available() > 0)
    if (gps.encode(ss.read()))
      displayInfo();

    if (millis() > 5000 && gps.charsProcessed() < 10)
    {
    Serial.println(F("No GPS detected: check wiring."));
    while(true);
    }

    #if VEHICLE == 1
    
          uint8_t data[2*sizeof(double)];
          data[0]=LAT;
          data[sizeof(double)]=LNG;

        Serial.println("Sending... ");
            
        // Send a message to a rf22_router_server
        // It will be routed by the intermediate
        // nodes to the destination node, accorinding to the
        // routing tables in each node
        if (radioManager.sendtoWait(data, sizeof(data), SEND_TO) == RH_ROUTER_ERROR_NONE) {
            // It has been reliably delivered to the next node.
            // Now wait for a reply from the ultimate server


            uint8_t len = sizeof(buf);
            uint8_t from;    
            if (radioManager.recvfromAckTimeout(buf, &len, 3000, &from)) {
                Serial.print("got reply from : 0x");
                Serial.print(from, HEX);
                Serial.print(": ");
                Serial.println((char*)buf);
            }
            else {
                Serial.println("No reply, are there elpNodes and elpRelays available?");
            }
        }
        else {
            Serial.println("sendtoWait failed. Are the intermediate router servers running?");
        }

        delay(6000);

    #else
        uint8_t data[] = "And hello back to you from server1";
        uint8_t len = sizeof(buf);
        uint8_t from;
        if (radioManager.recvfromAck(buf, &len, &from))  {
            Serial.print("got request from : 0x");
            Serial.print(from, HEX);
            Serial.print(": ");
            Serial.println((char*)buf);
        }
        // Send a reply back to the originator client
        if (radioManager.sendtoWait(data, sizeof(data), from) != RH_ROUTER_ERROR_NONE){
            Serial.println("sendtoWait failed");
        }     


    #endif
}

void displayInfo()
{
  Serial.print(F("Location: ")); 
  if (gps.location.isValid())
  {
    Serial.print(gps.location.lat(), 6);
    Serial.print(F(","));
    Serial.print(gps.location.lng(), 6);
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.println();
}

and this result that i got on source node

12:53:52.434 → Sen
12:53:53.637 → Sending…
12:53:54.450 → Sending…
12:53:54.658 → got reply from : 0x3: And hello back to you from Heltec ESP32 Lora
12:54:00.663 → Sending…
12:54:03.432 → Sending…
12:54:03.684 → got reply from : 0x3: And hello back to you from Heltec ESP32 Lora
12:54:09.687 → Sending…
12:54:11.458 → Sending…
12:54:11.883 → got reply from : 0x3: And hello back to you from Heltec ESP32 Lora
12:54:17.895 → Sending…

and this’s code on destination node

#include <RHRouter.h>
#include <RH_RF95.h>
#include <SPI.h>

#define RADIO_FREQUENCY 915.0
#define RADIO_TX_POWER 6
#define RADIO_SPREADFACTOR 8

#define GATEWAY 3

#if VEHICLE == 1
    #define SEND_TO 3
#endif

double LAT;
double LNG;
RH_RF95 driver;

// Class to manage message delivery and receipt, using the driver declared above
RHRouter radioManager(driver, GATEWAY);

// define buf - don't put this on the stack:
uint8_t buf[RH_ROUTER_MAX_MESSAGE_LEN];

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

    // initiate radio
    if (!radioManager.init()){
        Serial.println("radio init failed");
    } 
    // Setup ISM frequency
    driver.setFrequency(RADIO_FREQUENCY);

    // Setup Power,dBm
    driver.setTxPower(RADIO_TX_POWER);

    // You can optionally require this module to wait until Channel Activity
    // Detection shows no activity on the channel before transmitting by setting
    // the CAD timeout to non-zero:
    // radioDriver.setCADTimeout(10000);
        
    // Manually define the routes for this LEG OF THE network
    radioManager.addRouteTo(1, 2);
    radioManager.addRouteTo(2,2);
        
    // Just to be sure... delete any routes to self?!
    radioManager.deleteRouteTo(GATEWAY);

    
    Serial.println("-------------------");
    Serial.println("ROUTING TABLE");
    radioManager.printRoutingTable();
    Serial.println("-------------------");

    Serial.println("Relaying & listening now...");
  
}

void loop() {


    #if VEHICLE == 1

          uint8_t data[2*sizeof(double)];
          data[0]=LAT;
          data[sizeof(double)]=LNG;
        Serial.println("Sending to rf22_router_server3");
            
        // Send a message to a rf22_router_server
        // It will be routed by the intermediate
        // nodes to the destination node, accorinding to the
        // routing tables in each node
        if (radioManager.sendtoWait(data, sizeof(data), SEND_TO) == RH_ROUTER_ERROR_NONE) {
            // It has been reliably delivered to the next node.
            // Now wait for a reply from the ultimate server
            uint8_t len = sizeof(buf);
            uint8_t from;    
            if (radioManager.recvfromAckTimeout(buf, &len, 3000, &from)) {
                Serial.print("got reply from : 0x");
                Serial.print(from, HEX);
                Serial.print(": ");
                Serial.println((char*)buf);
            }
            else {
                Serial.println("No reply, is rf22_router_server1, rf22_router_server2 and rf22_router_server3 running?");
            }
        }
        else {
            Serial.println("sendtoWait failed. Are the intermediate router servers running?");
        }


    #else
        uint8_t data[] = "And hello back to you from Heltec ESP32 Lora";
        uint8_t len = sizeof(buf);
        uint8_t from;
        if (radioManager.recvfromAck(buf, &len, &from))  {
            Serial.print("got request from : 0x");
            Serial.print(from, HEX);
            Serial.print(": ");
            Serial.println((char*)buf);

            // Send a reply back to the originator client
            if (radioManager.sendtoWait(data, sizeof(data), from) != RH_ROUTER_ERROR_NONE){
                Serial.print("Delivery receipt sent...");
            }     
        }
    #endif

    // delay(100);

}

and this’s result that i got on dest node

ROUTING TABLE
0 Dest: 1 Next Hop: 2 State: 2
1 Dest: 2 Next Hop: 2 State: 2
2 Dest: 0 Next Hop: 0 State: 0
Relaying & listening now…
got request from : 0x1:
got request from : 0x1:
got request from : 0x1:
got request from : 0x1:

I don’t know where I made a mistake, but I’m pretty sure if the fault is in changing the data type on the GPS coordinate. Is the code in my destination node correct in receiving the data? or is there something wrong with my source code in sending data? I hope someone helps me improve my code. I really appreciate that

this’s code on intermediate node

#include <RHRouter.h>
#include <RH_RF95.h>
#include <SPI.h>

#define RADIO_FREQUENCY 915.0
#define RADIO_TX_POWER 6
#define RADIO_SPREADFACTOR 8


#define SERVER 2

#if VEHICLE == 1
    #define SEND_TO 3
#endif

double LAT;
double LNG;

RH_RF95 driver;
// Class to manage message delivery and receipt, using the driver declared above
RHRouter radioManager(driver, SERVER);

// define buf - don't put this on the stack:
uint8_t buf[RH_ROUTER_MAX_MESSAGE_LEN];


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

    // initiate radio
    if (!radioManager.init()){
        Serial.println("radio init failed");
    } 
    // Setup ISM frequency
    driver.setFrequency(RADIO_FREQUENCY);

    // Setup Power,dBm
    driver.setTxPower(RADIO_TX_POWER);

        
    // Manually define the routes for this LEG OF THE network
    radioManager.addRouteTo(1, 1);
    radioManager.addRouteTo(3, 3);
    
    // Just to be sure... delete any routes to self?!
    radioManager.deleteRouteTo(SERVER);

    
    Serial.println("-------------------");
    Serial.println("ROUTING TABLE");
    radioManager.printRoutingTable();
    Serial.println("-------------------");

    Serial.println("Relaying & listening now...");
  
}

void loop() {

    #if VEHICLE == 1

          uint8_t data[2*sizeof(double)];
          data[0]=LAT;
          data[sizeof(double)]=LNG;

        Serial.println("Sending to rf22_router_server3");
            
        // Send a message to a rf22_router_server
        // It will be routed by the intermediate
        // nodes to the destination node, accorinding to the
        // routing tables in each node
        if (radioManager.sendtoWait(data, sizeof(data), SEND_TO) == RH_ROUTER_ERROR_NONE) {
            // It has been reliably delivered to the next node.
            // Now wait for a reply from the ultimate server
            uint8_t len = sizeof(buf);
            uint8_t from;    
            if (radioManager.recvfromAckTimeout(buf, &len, 3000, &from)) {
                Serial.print("got reply from : 0x");
                Serial.print(from, HEX);
                Serial.print(": ");
                Serial.println((char*)buf);
            }
            else {
                Serial.println("No reply, is rf22_router_server1, rf22_router_server2 and rf22_router_server3 running?");
            }
        }
        else {
            Serial.println("sendtoWait failed. Are the intermediate router servers running?");
        }

    #else
        uint8_t data[] = "And hello back to you from piggie in the middle - aka Talk2_#2";
        uint8_t len = sizeof(buf);
        uint8_t from;
        if (radioManager.recvfromAck(buf, &len, &from))  {
            Serial.print("got request from : 0x");
            Serial.print(from, HEX);
            Serial.print(": ");
            Serial.println((char*)buf);

            // Send a reply back to the originator client
            if (radioManager.sendtoWait(data, sizeof(data), from) != RH_ROUTER_ERROR_NONE){
                Serial.print("Delivery receipt sent...");
            }     
        }
    #endif

    // delay(100);

}

should I ask this question in the programming questions forum?