NanodeRF serial comms sensitivities

Hi. Strange issue here. 

I've adjusted the NanodeRF standard sketch "NanodeRF_Power_RTCrelay_GLCDtemp" to control a HomeEasy remote wall plug using the Arduino Homeeasy library. i have set it to transmit using Digital Pin 7 to a 433Mhz am transmitter. 

The plan is to automatically switch on the socket when the solar energy excess over energy consumption is high enough, and then switch it off when consumption exceeds generation. 

It works. However, when I add a simple Serial.print("TEST"); message into the sketch loop, the Nanode RF sketch plays up. It outputs "Webcms" repeatedly down the Serial monitor window or refuses to receive EmonTX data from the RFM12B wireless receiver. 

Can anyone advise what may be going on here? Does the amount of data handled by the Serial output interface over FTDI when connected to the PC change the running of the ethernet interface? should I be avoiding using digital Pin 7?

Robert Wall's picture

Re: NanodeRF serial comms sensitivities

The Serial output is interrupt-driven, I think it is likely that the serial output string is still being sent while the main loop is trying to carry on and do other things. It is a common problem. If timing is not an issue, you can usually mitigate, if not remove, the problem by adding a short delay immediately after the Serial.print statement to give it time to finish before moving on.

If that isn't the problem, it might be that you have run out of memory. There is no stack checking, so if your program gets too large (it grows upwards in memory) and the stack is too large (it grows downwards from the top of memory), they can meet in the middle and your program is corrupted.

Ruchir's picture

Re: NanodeRF serial comms sensitivities

Sounds like it was a memory issue. 

I commented out the code that relates to temperature monitoring which I'm not using. It's now working correctly. 

I guess the serial output when using new text (as opposed to reporting the content of existing variables) seems to use up enough memory to create problems. Even a single letter was causing problems. I tried adding a short delay but it didn't help. 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.