Getting Max2275 Thermocouple to work with NRF24L01 and Arduino Uno /Mega

Hello All,

This is my first post so I hope I am posting this correctly.

I am working on a very basic project to connect a type K thermo couple to an Arduino UNO/Mega and have it transmit the temp data to another UNO/Mega by using the NRF24L01. I have had great success with the NRF boards in the past and enjoy using them.

I have hooked everything up and am able to read the thermocouple on the transmitting UNO. The issue arises when I try to transmit that temp to the receive UNO/Mega. It is returning a "nan" statement in the serial.println. I do know that my wiring and transmitting properties are ok as I am transmitting a "Hello World" message along side the temps and that works each time. I've been working on this for some time and would really appreciate any help you could give.

//Transmit

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

#include <MAX6675_Thermocouple.h>

RF24 radio(7, 8);
MAX6675_Thermocouple ktemp1 (6, 5, 4);// Create a Module (CLK, CS, SO)

const byte rxAddr[6] = "00001";


//int soPin = 4;
//int csPin = 5;
//int sckPin = 6;

void setup()//***********************************************setup
{

  Serial.begin(9600);
  
  radio.begin();
  radio.setRetries(15, 15);
  radio.openWritingPipe(rxAddr);
  
  radio.stopListening();
}

void loop()
{
   double jobTemp = ktemp1.readCelsius();
  Serial.println(jobTemp);
  radio.write(&ktemp1, sizeof(ktemp1));
  
  const char text[] = "Hello World";
  radio.write(&text, sizeof(text));


  
  delay(3000);
}
//Recieve Code

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>


#include <MAX6675_Thermocouple.h>

RF24 radio(46, 47);
MAX6675_Thermocouple ktemp1 (6, 5, 4);// Create a Module (CLK, CS, SO)


const byte rxAddr[6] = "00001";

void setup()
{
  while (!Serial);
  Serial.begin(9600);
  
  radio.begin();
  radio.openReadingPipe(0, rxAddr);
  
  radio.startListening();
}

void loop()
{
  if (radio.available())
  {
    char text[32] = {0};
    radio.read(&text, sizeof(text));
    Serial.println(text);
   radio.read(&ktemp1, sizeof(ktemp1));
  Serial.println(ktemp1.readCelsius()); 


  }
}

Hi

nan means that the data you try to print has a wrong format.

On transmitter side you print a double jobTemp
On receiver side you print &text (address of pointer ?)

If that could help....

I've a question about NRF24L01 module : How far do you keep a good link ? How fast ?

Thx

Shouldn't this

radio.write(&ktemp1, sizeof(ktemp1));

be sending jobTemp rather than ktemp1

ktemp1 is almost certainly the address in memory where the thermocouple library resides.

...R

I've deleted your other cross post @Randwulfm.

Cross posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes writing a detailed answer on this thread, without knowing that someone else already did the same in the other thread.

Repeated cross posting will result in a suspension from the forum.

In the future, please take some time to pick the forum section that best suits the topic of your question and then only post once to that forum section. This is basic forum etiquette, as explained in the sticky "How to use this forum - please read." post you will find at the top of every forum section. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.