Dashboard Chart with Asynchronous Timestamps

#1

Hello -

I sometimes need to operate the raspberry pi running node-red without access to the internet. When I do the clock loses sync with world time as I cycle power on and off. I see now when the clock on the Raspi is not sync'd I have problems with the line chart X-axis on my browser.

It appears that the right end of the chart is scaling to the current time on the client PC but the server PC is providing data that's timestamped from a few hours ago (10 minutes worth) and the chart is compressed. Has anyone experienced this? Workaround ideas?

When the times are sync'd this chart displays as expected with a total X axis range of 10 minutes.

image

0 Likes

#2

Why not add a realtime clock to the Pi? https://www.adafruit.com/product/3386

0 Likes

#3

This issue has come up before -- essentially, the ui_chart x-axis always wants to zoom to the current time (the right end of the axis).

DCeeJay, I can't remember exactly why, but I seem to recall you telling me there was not a good option for zooming to only the visible data set (or perhaps it wasn't easy to add another option)?

0 Likes

#4

You could configure your PC (or another machine on the local network) as an ntp server. Then the pi can synchronise to the PC. Assuming you are running LInux then that is not difficult and google should help you. Don't know about Windows, but a quick google suggests that again it might not be too difficult.

1 Like

#5

Install an RTC module on you raspi as well as you do on an arduino board,google it 10-15$ an many instructables as example:

Regards

1 Like

#6

Colin's suggestion is probably the easiest solution, if you do have to use a RTC as David suggested, try to get one with a Dallas DS3231 chip, they are very accurate. If you follow David's link above they have a modules based on this chip.

0 Likes

#7

Indeed the dashboard is aimed at displaying real-time data rather than historical... which does really mean that clocks need to be in sync...

Generally if it's on a local network then a local timeserver is the simplest approach - usually you just need to add a server line to the ntp.conf file- but I see on latest Raspbian for Pi (Stretch) it is now in the file /etc/systemd/timesyncd.conf instead.

0 Likes

#8

Thanks for all of the advice folks. I have a Dallas DS3231 chip on the way.

Zach

0 Likes