Sending DS18B20 Temperature values to Nextion HMI Display


I am currently working on a project that will show the temperature of a hot water tank on the nextion display wirelessly and I am struggling to make the temperature readings to show on the nextion display. I would like the readings to be updated on the nextion display automatically without any user input. So far I have the the 2 temperature readings showing on the serial monitor on my receiver part. All i need to do is send the received temperature readings which i see on the serial monitor on Arduino IDE to the nextion display in text format.

The setup :

Transmitter Part: arduino uno connected to 2 DS18B20 Temperature probes and an RFM69 radio transmitter that sends the 2 temperature values wirelessly to the receiver.

Receiver Part: arduino uno connected to RM69 radio receiver which receives the 2 temperature readings from the transmitter and also nextion display connected to the to display the data.

The Temperature values are sent in a structure represented by:

//——–structure for Temperature sensor variables transmitter ——–//
typedef struct
int nodeId; //store this nodeId
unsigned long uptime; //uptime in ms
float temp1; //temperature sensor1
float temp2; //temperature sensor2
} Payload;
Payload theData;

and are received at the Receiver:

//——–structure for Temperature sensor being received at the receiver ——–//
typedef struct
int nodeId; //store this nodeId
unsigned long uptime; //uptime in ms
float temp1; //temperature1
float temp2; //temperature2
} Payload;

Displaying the Temperature values on serial monitor:

if (radio.DATALEN != sizeof(Payload))
Serial.print(“Invalid payload received, not matching Payload struct!”);
theData = (Payload)radio.DATA; //assume radio.DATA actually contains our struct and not something else
Serial.print(” nodeId=”);
Serial.print(” uptime=”);
Serial.print(” temp1=”);
Serial.print(theData.temp1); //temperature 1
Serial.print(” temp2=”);
Serial.print(theData.temp2); //temperature 2

I have attached both the transmitter code and receiver code below . I have tried looking at the examples on forums but I had no luck with getting the values to be sent to the nextion display. If anyone can recommend a simple solution to just send the received temperature values to the nextion display I will be very happy as this is the last thing im stuck at.

Feel free to use my arduino code if you are working on a wireless project.


Sending_Temperature_Transmitter_withATC.ino (5.82 KB)

Receiving_Temperature_withATC.ino (3.82 KB)