Having Trouble Using RF Modules

Hello all,
I am having trouble getting RF modules to work using the RadioHead library. I cannot find the error for the life of me. There are no compilation errors, but when running the code I am not getting the expected serial communication.

The transmitter code:

#include <RH_ASK.h>
#include <SPI.h>

RH_ASK rf_driver(2000,11,7);

//Transmit Pin 7

void setup() {
  rf_driver.init();
}

void loop() {
  const char *msg = "Hello World!";
  rf_driver.send((uint8_t)msg, strlen(msg));
  rf_driver.waitPacketSent();
  delay(50);
}

The reciever code:

#include <RH_ASK.h>
#include <SPI.h>

RH_ASK rf_driver(2000,11,7);

//Recieve Pin 11

void setup() {
  rf_driver.init();
  Serial.begin(9600);
  
}

void loop() {
  uint8_t buf[12];
  uint8_t buflen = sizeof(buf);

  if (rf_driver.recv(buf, &buflen)) {
    Serial.print("Message Revieved: ");
    Serial.println((char*)buf);
  }
}

When running this code with all modules connected to corect pins the attached image shows what is recieved by serial.

I cant seem to figure out why this is not working. Any help would be greatly appreciated!

Thanks, Sam

Do you have antennas soldered to the modules? They are required.

You can prove that the issue is on the radio side by connecting the Tx pin to the Rx pin with a jumper wire. That will verify the code.

I just tried wiring the TX pin directly to the RX pin, as well as sharing a ground between the arduinos. Nothing has changed, so something is wrong with the RF modules. I know that the recieving arduino is recieving some sort of signal, because if the RX pin is disconnected nothing is printed to serial at all. I tried to add a String() conversion before the actua printing of the message but this did not alleviate the issue either.

Which transceiver modules are you using?

Transmitter code line "rf_driver.send((uint8_t)msg, strlen(msg));" should be "rf_driver.send((uint8_t *)msg, strlen(msg));"

I am using these modules:

The code change worked. Now that I have this working, I am going to try to transition to sending analog data read from the esplora's joysticks. Hopefully I can then use the data transmitted from the esplora to run servos.

Thanks for all your help! Sam