# Nextion display rtc problem

**URL:** <https://forum.arduino.cc/t/nextion-display-rtc-problem/674807>\
**Category:** Displays\
**Created:** [September 16, 2020, 8:41pm UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807 "2020-09-16T20:41:30Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![robotronico](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@robotronico](https://forum.arduino.cc/u/robotronico)\
**Post date:** [September 16, 2020, 8:41pm UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807/1 "2020-09-16T20:41:30Z")

</div>

Hi guys.  
I have a problem with the rtc. I'm using the nextion display NX8048K050\_011. I have a page where i can see the data and time. Everything works fine in the software simulator but when I download the project i see always weird numbers in my variables. i don't understand where they come from. I added in the same page a buton to set a correct data and time but it doesn't work. it works only in the software simulator again. what's wrong?

In this page i added a timer. "tm0" with this script:

```cpp
year.val=rtc0
month.val=rtc1
day.val=rtc2
hours.val=rtc3
minutes.val=rtc4
// Day of the week is stored as 0 (Sunday) to 6 (Saturday).
// For that reason we are going to write the corresponding text:
if(rtc6==0)  // if day of the week is 0
{
  tDay.txt="SUNDAY"  // write to the text the word "SUNDAY"
}else if(rtc6==1)  // if day of the week is 1
{
  tDay.txt="MONDAY"  // write to the text the word "MONDAY"
}else if(rtc6==2)  // if day of the week is 2
{
  tDay.txt="TUESDAY"  // write to the text the word "TUESDAY"
}else if(rtc6==3)  // if day of the week is 3
{
  tDay.txt="WEDNESDAY"  // write to the text the word "WEDNESDAY"
}else if(rtc6==4)  // if day of the week is 4
{
  tDay.txt="THURSDAY"  // write to the text the word "THURSDAY"
}else if(rtc6==5)  // if day of the week is 5
{
  tDay.txt="FRIDAY"  // write to the text the word "FRIDAY"
}else if(rtc6==6)  // if day of the week is 6
{
  tDay.txt="SATURDAY"  // write to the text the word "SATURDAY"
}

```

to set the correct values I have a button with this script:

```cpp
rtc0=2017 //year
rtc1=8 //month
rtc2=28 //day
rtc3=16 //hour
rtc4=50 //minute
rtc5=36 //second

```

why the simulator works fine? I added the battery. nothing changed.

I see always these values:  
year.val=2165  
month.val=25  
day.val=45  
hours.val=45  
minutes.val=85  
tDay.txt="MONDAY"

---

<div class="post-metadata">

**Author:** ![PerryBebbington](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/perrybebbington/32/238766_2.png) [@PerryBebbington](https://forum.arduino.cc/u/PerryBebbington)\
**Post date:** [September 17, 2020, 7:16am UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807/2 "2020-09-17T07:16:08Z")

</div>

Hello robotronico  
Please can you put your HMI file into a zip file and upload it please? I'll try it on one of my Nextion displays for you. Might be a couple of days before I get time though.

Thanks,

---

<div class="post-metadata">

**Author:** ![robotronico](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@robotronico](https://forum.arduino.cc/u/robotronico)\
**Post date:** [September 17, 2020, 4:42pm UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807/3 "2020-09-17T16:42:39Z")

</div>

Hi and thanks for your answer.  
this is the file: [link](https://drive.google.com/file/d/1sCq0xZrlOIsAuiECyAHpGgUO13jLKYjN/view?usp=sharing)

it's okay take a look when you have time. it would be really kind of you.  
Grazie 🙂

---

<div class="post-metadata">

**Author:** ![robotronico](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@robotronico](https://forum.arduino.cc/u/robotronico)\
**Post date:** [September 17, 2020, 5:14pm UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807/4 "2020-09-17T17:14:43Z")

</div>

I want to share also the video where i saw how to use the RTC.  
I think it's a great project: [Nextion+Arduino Tutorial #3 RTC and EEPROM (Enhanced Version) - YouTube](https://youtu.be/7Dkn3t_jjN8)  
I trid this project in local and it works. i downloaded in into my panel. i cas see always the same data and time

year=2165  
monthl=25  
day=45  
hours=45  
minutes=85

I'm wonderinf where are these numbers 😕

---

<div class="post-metadata">

**Author:** ![CrossRoads](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/crossroads/32/214033_2.png) [@CrossRoads](https://forum.arduino.cc/u/CrossRoads)\
**Post date:** [September 17, 2020, 6:26pm UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807/5 "2020-09-17T18:26:31Z")

</div>

Doesn't look like the clock is enabled to run.  
There is a bit in register 0 I think that enables time to run.  
And then other registers where the data is maintained and updated immediately following it.

[https://datasheets.maximintegrated.com/en/ds/DS3231-DS3231S.pdf](https://datasheets.maximintegrated.com/en/ds/DS3231-DS3231S.pdf)

---

<div class="post-metadata">

**Author:** ![robotronico](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@robotronico](https://forum.arduino.cc/u/robotronico)\
**Post date:** [September 18, 2020, 7:14am UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807/6 "2020-09-18T07:14:53Z")

</div>

> CrossRoads:  
> Doesn't look like the clock is enabled to run.
> 
> [https://datasheets.maximintegrated.com/en/ds/DS3231-DS3231S.pdf](https://datasheets.maximintegrated.com/en/ds/DS3231-DS3231S.pdf)

Hi and thanks for your answer. I'm not using the module DS3231. I'm trying to use the internal RTC. it's integrated into the display actually. and I don't think it needs an abilitation or something

---

<div class="post-metadata">

**Author:** ![PerryBebbington](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/perrybebbington/32/238766_2.png) [@PerryBebbington](https://forum.arduino.cc/u/PerryBebbington)\
**Post date:** [September 19, 2020, 6:46am UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807/7 "2020-09-19T06:46:58Z")

</div>

I've tried to download from the link but nothing happens. Please can you do as I asked and put the HMI file into a zip file and upload to this discussion. I don't usually go off this site to find stuff for answering questions.

Thanks.

---

<div class="post-metadata">

**Author:** ![robotronico](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@robotronico](https://forum.arduino.cc/u/robotronico)\
**Post date:** [September 19, 2020, 8:08am UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807/8 "2020-09-19T08:08:24Z")

</div>

Hi,  
I didn't know I could attach something here.  
anyway the file is here. you should reach the page 6 and see what happens. unfortunately to reach this page you should have my arduino connected to the display... i think you can set page 6 as the first page at the power on.

Let me know if you are able to try the RTC... or I'll modify the HMI file to let you test it.  
thanks a lot for your time.

[GAZEBO\_800X480\_9.zip](https://forum.arduino.cc/uploads/short-url/IoSaNHup3dDcV4bSe3bWouuXVE.zip) (764 KB)

---

<div class="post-metadata">

**Author:** ![PerryBebbington](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/perrybebbington/32/238766_2.png) [@PerryBebbington](https://forum.arduino.cc/u/PerryBebbington)\
**Post date:** [September 19, 2020, 7:09pm UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807/9 "2020-09-19T19:09:25Z")

</div>

Hello robotronico,

I have modified your configuration, see attached.

**Page 0, home**  
Added a button to change the page to page 6 for testing.

**Page 6, time**  
Added a seconds display for testing, remove it later if you don't want / need it.  
Changed set1 to the current time and date for me now while I did the tests.  
Removed from set 2 rtc6=0, you can't change rtc6, it's read only  
Changed tmr0 from 50ms to 1000ms.

With those changes the seconds counts up as expected and the time and date are correct.

I suspect, but I don't know, that the problem was having tmr0 set to 50ms. I suspect it can't update the display fast enough if you are trying to update the display every 50ms. If you want to display seconds then probably try setting it to 200ms or maybe 500ms. If you don't want seconds then try 1000ms for the update. I suggest you experiment with different times to see what difference they make on the display.

[GAZEBO\_800X480\_9\_PB\_Edited.zip](https://forum.arduino.cc/uploads/short-url/jSDmfJKeWjEt6RR4ZQuoICCCZxQ.zip) (737 KB)

---

<div class="post-metadata">

**Author:** ![robotronico](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@robotronico](https://forum.arduino.cc/u/robotronico)\
**Post date:** [September 19, 2020, 8:40pm UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807/10 "2020-09-19T20:40:08Z")

</div>

Hi PerryBebbington and thanks for your help really.  
I tried what you said. the simulator works perfectly. when I download the project the values are fixed as before.  
always the same numbers.  
year=2165  
monthl=25  
day=45  
hours=45  
minutes=85

Is it a curse?

I have noticed another weird things. when I'm in the simulator software I can send the commands to my nextion device. Well if I push page 6 on the simulator nothing happens on the panel. is it normal?  
I can only reboot the device from the simulator.  
I don't know what else I can do.

If you have some other ideas i'm here othewise thanks anyway for your help and your time.

---

<div class="post-metadata">

**Author:** ![PerryBebbington](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/perrybebbington/32/238766_2.png) [@PerryBebbington](https://forum.arduino.cc/u/PerryBebbington)\
**Post date:** [September 20, 2020, 8:29am UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807/11 "2020-09-20T08:29:59Z")

</div>

I tested your configuration on an NX8048K070\_11, which means I had to change the device from the NX8048K050\_11 that I think you have. I changed it back before sending to you.

The configuration worked perfectly on mine for everything I tried.

To be clear when you say:

> Well if I push page 6 on the simulator nothing happens on the panel. is it normal?

you mean the Page 6 button I added? That button should take you to page 6, Time in both the simulator and on the actual display. It works for me on both.

Your 'Time' button does not take you to page 6.

When I tested it I had no link to any Arduino or other host processor, so there was nothing sending data to the Nextion. All I had was power connected to with the configuration. If you've not tried that then try it to see what happens.

---

<div class="post-metadata">

**Author:** ![robotronico](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@robotronico](https://forum.arduino.cc/u/robotronico)\
**Post date:** [September 20, 2020, 8:46am UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807/12 "2020-09-20T08:46:40Z")

</div>

in order to erase all doubts i have created a simple page with tm0 and some fields to display the data and time. one button to change it.  
the same result. It works only in the software simulator.

I think my hardware is not working ☹

[test rtc\_1.zip](https://forum.arduino.cc/uploads/short-url/nwFk67FoFigJ8xxsHYAkOysc1qp.zip) (6.74 KB)

---

<div class="post-metadata">

**Author:** ![PerryBebbington](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/perrybebbington/32/238766_2.png) [@PerryBebbington](https://forum.arduino.cc/u/PerryBebbington)\
**Post date:** [September 20, 2020, 9:18am UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807/13 "2020-09-20T09:18:21Z")

</div>

> robotronico:  
> I think my hardware is not working ☹

I fear you may be correct. Are you sure you have a NX8048K050\_11 and not a NX8048T050\_11, which does not have an RTC?

---

<div class="post-metadata">

**Author:** ![robotronico](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@robotronico](https://forum.arduino.cc/u/robotronico)\
**Post date:** [September 20, 2020, 2:15pm UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807/14 "2020-09-20T14:15:33Z")

</div>

Sure I have the enhanced version. There is also a battery.  
I'll try to use EEPROM... Just to see if something works or it's a normal version trapped in a enhanced body

---

<div class="post-metadata">

**Author:** ![PerryBebbington](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/perrybebbington/32/238766_2.png) [@PerryBebbington](https://forum.arduino.cc/u/PerryBebbington)\
**Post date:** [September 20, 2020, 2:30pm UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807/15 "2020-09-20T14:30:10Z")

</div>

This is clutching at straws but try taking out the battery. It should work without a battery, the battery is only to maintain the time when the power is off.

Also try the code and configuration in my Nextion tutorial.

---

<div class="post-metadata">

**Author:** ![robotronico](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@robotronico](https://forum.arduino.cc/u/robotronico)\
**Post date:** [September 20, 2020, 7:51pm UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807/16 "2020-09-20T19:51:02Z")

</div>

Thank you PerryBebbington.  
I opened a ticket on the nextion website... they should answer because it looks like an hardware problem, let's see what they say.  
I'll let you know.  
thanks a lot for your help and your time.  
ciao

---

<div class="post-metadata">

**Author:** ![PerryBebbington](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/perrybebbington/32/238766_2.png) [@PerryBebbington](https://forum.arduino.cc/u/PerryBebbington)\
**Post date:** [September 20, 2020, 7:52pm UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807/17 "2020-09-20T19:52:17Z")

</div>

> robotronico:  
> Thank you PerryBebbington.  
> thanks a lot for your help and your time.  
> ciao

You are welcome 🙂

---

<div class="post-metadata">

**Author:** ![robotronico](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@robotronico](https://forum.arduino.cc/u/robotronico)\
**Post date:** [September 22, 2020, 3:12am UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807/18 "2020-09-22T03:12:24Z")

</div>

Hi guys,  
I confirm that my panel's RTC is not working.  
nextion support was good. they asked me to try many things but at the end they confirm that my panel's RTC was not initialized in a correct way or something like this.  
they are going to send me a new panel.  
The support was good and really fast considering that they are in China and I'm in Italy.  
thanks to everybody.  
ciao.

---

<div class="post-metadata">

**Author:** ![PerryBebbington](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/perrybebbington/32/238766_2.png) [@PerryBebbington](https://forum.arduino.cc/u/PerryBebbington)\
**Post date:** [September 22, 2020, 6:34am UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807/19 "2020-09-22T06:34:45Z")

</div>

> robotronico:  
> Nextion support was good. They asked me to try many things but at the end they confirm that my panel's RTC was not initialized in a correct way or something like this.  
> they are going to send me a new panel.  
> The support was good and really fast considering that they are in China and I'm in Italy.

Glad to hear the support was good; in the past I have read reports of their support being poor.

---

<div class="post-metadata">

**Author:** ![robotronico](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@robotronico](https://forum.arduino.cc/u/robotronico)\
**Post date:** [October 8, 2020, 8:13pm UTC](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807/20 "2020-10-08T20:13:06Z")

</div>

Hi Guys.  
I received the new panel and I tested it. It works well finally.  
Thanks for your support and your time.  
😀 I'm Happy

[Next page](https://forum.arduino.cc/t/nextion-display-rtc-problem/674807.md?page=2)
