Re: Node MCU ESP8266 RF RadioHead not working

Follow up to: Node MCU ESP8266 RF RadioHead not working

I have used send and receive data (a String) from a Node MCU ESP8266 to another Node MCU ESP8266 through the RF module using the RadioHead library.
After uploading the sample code of the RadioHead lib to the Node MCU ESP8266 and opening the SerialMonitor, I can not see the log, i.e the RadioHead lib does not work with ESP8266.

Since I can't reopen that thread, I thought I'd start a new one about what I learned working with the RadioHead library and ASK (RH_ASK.h). I have a few tips for those trying to get the ASK library working with Node MCU ESP8266, Arduino Nano, and ATtiny84...

  • Add more logging to the RadioHead example transmitter/receiver code to see what's going on, e.g. Serial.println("init ok"); (you'll need to save your own version of the file)
  • Try tweaking the bits per second rate slightly, e.g. RH_ASK driver(190); (if your MCU has an internal crystal, due to temperature changes, the clock signal might be slightly too fast or slow to get an accurate bit rate)
  • Try lowering the bit rate, e.g. RH_ASK driver(200); instead of RH_ASK driver(2000); (also check out the transmission signal using an oscilloscope to see if the bit pulses are the expected width and timing)
  • You can print the buffer in the receiver example by casting it to a char string, e.g. Serial.println((char*)buf); (though this isn't totally necessary, since the function should only return a valid message, it removes any doubt that it's the message you expected)

Also, as for all Arduino projects, I recommend adding while(!Serial) { delay(1); } after Serial.begin and before your first log line, to make sure the log line doesn't send before the UART interface is ready (this will make it more obvious if the init has failed).

Oh, and one final tip: if you're struggling with timing problems due to internal crystal inaccuracies, then perhaps try an external oscillator or crystal.

"The most effective debugging tool is still careful thought, coupled with judiciously placed print statements." — Brian W. Kernighan

FYI
while(!Serial) does absolutely nothing on boards that don't have native USB so that delay will be skipped.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.