I'm following this tutorial Insight Into How 433MHz RF Tx-Rx Modules Work & Interface with Arduino to set up two elegato boards (essentially arduino uno), one with an rf transmitter and one with a receiver. The issue is I'm not seeing anything being received. I'm wondering if this could be because of the elegato boards I'm using. Or if there's a good way to debug this. I've tried printing the serial output to make sure the message send request is being queued properly. I've switched out the transmitter and receiver units and tried sending data on different pins. I feel like I'm missing something obvious, but I'm just trying to follow the tutorial exactly. I've looked through the forum for similar problems, but I haven't been able to fix my issue. Any idea what I'm doing wrong?
Unfortunately you have chosen a very poor tutorial to follow.
Antennas are required on both transmitter and receiver. 17 cm of straight wire connected to ANT works well.
I would set this to be larger, to accommodate larger messages.
uint8_t buf[11]; //set 11 to 40 or larger.
The following line is guaranteed to lead to problems, with gibberish being printed on the serial monitor, because the received message is not properly zero terminated.
Serial.println((char*)buf);
AFTER increasing the input message buffer size, add a couple of lines to the receiver code as follows:
if (rf_driver.recv(buf, &buflen))
{
if (buflen < sizeof(buf)) buf[buflen]=0; //make sure the message is zero
terminated.
else buf[sizeof(buf) - 1]=0;
I bought a few pairs of cheap Tx/Rx modules, intending to dip my toes into the 433 MHz waters. Two days ago started trying to get them working. In vain. Studied dozens of threads and tutorials and tried many sketches but success remains elusive.
So as my next step it would be helpful if you could please share your final code, including the edits suggested by @jremington. I could not get my version of that working with Nanos today, and will next yet try UNO, or a mix.
On an associated point, like almost every 433 MHz sketch I've seen, your code appears to be using the RH.ASK library, with the ask_transmitter.ino and ask_receiver.ino examples.
So it dents my confidence if these widely used sketches are significantly flawed. Puzzling too, as I'd have expected them to be corrected by now?