Nextion Screens PIC update

Yesterday I spent the better part of 4 hours trying to run down a problem on a Nextion display that is out in my garage. That display is controlled by a networked Arduino, but that gets data from the other side of the house.

Back and forth heaven know how many times. And the answer SHOULD have been so simple to find - and yes, I am sure Perry or some of the other regulars on here have already highlighted this, but the problem for me was that none of my Google searches actually located such information - and I'm not bad at using Google :slight_smile:

So, I figure that if I enter some of my search terms on here maybe it might save someone else some time in understanding what is really a very basic problem.

Search terms:

Nextion Pic does not update from serial port
Nextion Display Pic not changing
Nextion Pic update fails
Nextion Pic change does not happen
Nextion Pic update image does not change
Nextion pic update mostly fails

And the solution is...

When you update a picture control on a Nextion display via the serial port while the display is in sleep mode, the update does not happen - it's as simple as that!

I was fooling myself because when I kept the display awake by tapping on it every few seconds, the change happened, but when I went away and it blanked.... well, it took me four hours to make the connection, doh! Anyway, hope google finds this for anyone else who has this problem.

NOTES:
If you want the update to always work you need to either set the "usup" parameter on the display (which wakes up the display whenever a serial comm is received) OR send a "sleep=0" to wake up the display just before you send your picture command.

Code fragments below:


// Before the setup - global buffer.
char buff[132];

// In the SETUP 
sprintf(buff, "thsp=40"); // Display time out gets set to 40 seconds
sendToPanel(buff);

sprintf(buff,"usup=1"); // Display wakes up when serial communication comes.
sendToPanel(buff);
  
// In your loop or main program
sprintf(buff,"p%d.pic=%d", YOUR_PIC_NUMBER, THE_IMAGE_NUMBER);
// e.g. sprintf(buff,"p%d.pic=%d", 3, 12);

// Send functions
void sendToPanel(char* msg) {
    Serial.write(msg);
    doCodeEnd();
}

void doCodeEnd() {
  Serial.write(0xFF);
  Serial.write(0xFF);
  Serial.write(0xFF);
}

My solution is to dim the back-light when the display has not been used for a while so reducing power consumption but keeping the display active. I also have a small buck converter with serial connection pass through that can be put close to the display. The idea being to power with 12V over a long cable and reduce to 5V at the display.

Yep, that's a good solution too.

In my case though my Nextion display is simply a control panel - not a continuous indicator panel - so there's no real value to having it "on" at any brightness level unless someone is using it, or unless one of the buttons changes state due to some external event - and there's only one of those. So brighting it up for a short time when touched or when serial is received (as per "usup" in my example) is probably more suitable for my use case.

1 Like

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