Announcement

Collapse
No announcement yet.

Real Time Clock

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Real Time Clock

    So, I didn't like the idea of HS3-Pi being dependent on the internet to maintain the correct time after a restart (eg power cut). So, I've installed the PiFace RTC board, configured using the install script, and tested.

    Turned off my internet router, and shutdown HS3-Pi and disconnect power. Then waited 30 minutes.

    Restarted HS3-Pi, and yes, it's got the correct time!! I would imagine this will work on a Zee as well.


    #2
    Thank-you Christopher.

    Other than taking the cover off for the SD card; never paid attention to the insides of the RPi.

    Geez for a bit I thought the RTC clock pictured above was running batteryless until I saw the battery underneath.

    I need to get two (or three) of them as I want to put one into my little modded microrouter and modded Joggler (its big brother has a battery soldered into place) next to the socketed MMC EFI bios chip.

    Got it; opened up my ZeeLiTe and all I need to do is put the RTC clock in the Socket on the top eh?
    Attached Files
    Last edited by Pete; October 9, 2014, 10:55 AM.
    - Pete

    Auto mator
    Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
    Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
    HS4 Lite - Ubuntu 20.04 / VB W7e Jetway JBC420U591
    Fanless Intel® Celeron N3160 SoC 8Gb
    HS4 Pro - V4.1.18.1 - Ubuntu 20.04/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb
    HSTouch on Intel tabletop tablets

    X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

    Comment


      #3
      Originally posted by Pete View Post
      Got it; opened up my ZeeLiTe and all I need to do is put the RTC clock in the Socket on the top eh?
      That's correct, fit a battery and then it fits on the GPIO pins, and then you run the install script that updates /etc/modules and /etc/rc.local.

      https://raw.githubusercontent.com/pi...-time-clock.sh

      Comment


        #4
        Found the RTC clock this morning. I couldn't find it here yesterday.

        Its still a bit too much as the shipping is the same price as the RTC clock. (way excessive shipping).

        Well might as well get it from MCM as they are carrying the whole PiFace line of stuff.

        Purchased some other stuff from MCM a few weeks back as they are carrying a few things now from the EU that I cannot find here.

        Thank-you Christopher.
        Attached Files
        Last edited by Pete; October 10, 2014, 06:36 AM.
        - Pete

        Auto mator
        Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
        Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
        HS4 Lite - Ubuntu 20.04 / VB W7e Jetway JBC420U591
        Fanless Intel® Celeron N3160 SoC 8Gb
        HS4 Pro - V4.1.18.1 - Ubuntu 20.04/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb
        HSTouch on Intel tabletop tablets

        X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

        Comment


          #5
          Ordered. Found a new term this morning that I like called "bit banging".

          Concurrently here looking for something to fit inside of my modded microrouter. Using GPIO pins for that RTC clock. Well also modding one of my Almond plus test devices with an RTC clock.
          - Pete

          Auto mator
          Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
          Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
          HS4 Lite - Ubuntu 20.04 / VB W7e Jetway JBC420U591
          Fanless Intel® Celeron N3160 SoC 8Gb
          HS4 Pro - V4.1.18.1 - Ubuntu 20.04/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb
          HSTouch on Intel tabletop tablets

          X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

          Comment


            #6
            Got the RTC clock (shim) from MCM. Very quick shipping.

            Ordered it so fast didn't pay attention to the description that states no battery is included.

            Battery is $1.79 USD there so ordered 10 from Amazon instead for ~$4.00 USD with free shipping. Not a big deal to wait.
            - Pete

            Auto mator
            Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
            Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
            HS4 Lite - Ubuntu 20.04 / VB W7e Jetway JBC420U591
            Fanless Intel® Celeron N3160 SoC 8Gb
            HS4 Pro - V4.1.18.1 - Ubuntu 20.04/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb
            HSTouch on Intel tabletop tablets

            X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

            Comment


              #7
              I couldn't wait for that slow boat for the batteries; so just purchased an RTC battery (2120) and installed script:

              root@ICS-HomeTrollerZEE:/tmp# sh install-piface-real-time-clock.sh
              install-piface-real-time-clock.sh: 64: install-piface-real-time-clock.sh: [[: not found
              install-piface-real-time-clock.sh: 14: install-piface-real-time-clock.sh: Bad substitution
              root@ICS-HomeTrollerZEE:/tmp# ./rtc.sh
              Enabling I2C module.
              Changing /etc/rc.local to load time from PiFace Clock.
              Please *reboot* and then set your clock with:

              sudo date -s "14 JAN 2014 10:10:30"

              root@ICS-HomeTrollerZEE:/tmp#
              root@ICS-HomeTrollerZEE:~# date
              Tue Oct 21 17:50:50 CDT 2014
              root@ICS-HomeTrollerZEE:~# hwclock -r
              Tue 21 Oct 2014 05:51:05 PM CDT -0.739349 seconds
              root@ICS-HomeTrollerZEE:~#
              Neato stuff!
              - Pete

              Auto mator
              Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
              Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
              HS4 Lite - Ubuntu 20.04 / VB W7e Jetway JBC420U591
              Fanless Intel® Celeron N3160 SoC 8Gb
              HS4 Pro - V4.1.18.1 - Ubuntu 20.04/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb
              HSTouch on Intel tabletop tablets

              X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

              Comment


                #8
                Just need to see how it copes with changing from daylight saving time this weekend.

                Comment


                  #9
                  Here I have added NTP and NTPDATE to the RPi. I am have have always blocked NTP from the internet. Here the time will change on November 2, 2014. I think the changes in the tables are correct. I also block DNS through the firewall. My secondary failover connection also has a built in using a GPS NTP server. (really doesn't need it with the primary).

                  Clock utilized here is via my PFSense firewall (historically always used NTP server).

                  ntpq -c clockvar
                  assID=0 status=0000 clk_okay, last_clk_okay,
                  device="NMEA GPS Clock", timecode="$GPZDA,125742.000,22,10,2014,,*57",
                  poll=74546, noreply=0, badformat=0, baddata=0, fudgetime2=400.000,
                  stratum=0, refid=GPS, flags=5
                  Playing some this morning:

                  root@ICS-HomeTrollerZEE:~# dpkg-reconfigure tzdata
                  Current default time zone: 'America/Chicago'
                  Local time is now: Wed Oct 22 08:05:01 CDT 2014.
                  Universal Time is now: Wed Oct 22 13:05:01 UTC 2014.
                  root@ICS-HomeTrollerZEE:~#
                  root@ICS-HomeTrollerZEE:~# zdump -v America/Chicago | grep 2014
                  America/Chicago Sun Mar 9 07:59:59 2014 UTC = Sun Mar 9 01:59:59 2014 CST isdst=0 gmtoff=-21600
                  America/Chicago Sun Mar 9 08:00:00 2014 UTC = Sun Mar 9 03:00:00 2014 CDT isdst=1 gmtoff=-18000
                  America/Chicago Sun Nov 2 06:59:59 2014 UTC = Sun Nov 2 01:59:59 2014 CDT isdst=1 gmtoff=-18000
                  America/Chicago Sun Nov 2 07:00:00 2014 UTC = Sun Nov 2 01:00:00 2014 CST isdst=0 gmtoff=-21600
                  root@ICS-HomeTrollerZEE:~#
                  root@ICS-HomeTrollerZEE:/etc# hwclock --debug
                  hwclock from util-linux 2.20.1
                  Using /dev interface to clock.
                  Last drift adjustment done at 1413931719 seconds after 1969
                  Last calibration done at 1413931719 seconds after 1969
                  Hardware clock is on UTC time
                  Assuming hardware clock is kept in UTC time.
                  Waiting for clock tick...
                  /dev/rtc0 does not have interrupt functions. Waiting in loop for time from /dev/rtc0 to change
                  ...got clock tick
                  Time read from Hardware Clock: 2014/10/22 13:15:41
                  Hw clock time : 2014/10/22 13:15:41 = 1413983741 seconds since 1969
                  Wed 22 Oct 2014 08:15:41 AM CDT -0.086740 seconds
                  Found an issue:

                  root@ICS-HomeTrollerZEE:/etc# ntpq -p
                  remote refid st t when poll reach delay offset jitter
                  ============================================================ ==================
                  192.168.244.159 .INIT. 16 u - 1024 0 0.000 0.000 0.000
                  Not sure why I am seeing this as this was the old NTP clock.

                  Added these two lines to the end of ntp.conf

                  ## Type: boolean
                  ## Default: "yes"
                  #
                  # Force time synchronization befor start ntpd
                  #
                  NTPD_FORCE_SYNC_ON_STARTUP="yes"


                  ## Type: boolean
                  ## Default: "no"
                  #
                  # Force time synchronization of hwclock befor start ntpd.
                  # This works only if NTPD_FORCE_SYNC_ON_STARTUP is set
                  # to yes.
                  #
                  NTPD_FORCE_SYNC_HWCLOCK_ON_STARTUP="yes"
                  Curious whether I should get rid of the fake-hwclock cron job?

                  root@ICS-HomeTrollerZEE:/etc# cd cron.hourly
                  root@ICS-HomeTrollerZEE:/etc/cron.hourly# cat fake-hwclock
                  #!/bin/sh
                  #
                  # Simple cron script - save the current clock periodically in case of
                  # a power failure or other crash

                  if (command -v fake-hwclock >/dev/null 2>&1) ; then
                  fake-hwclock save
                  fi
                  Still have an issue. This is the old NTP server which is not online and curious about it.

                  root@ICS-HomeTrollerZEE:/etc/cron.hourly# ntpq --numeric --peers
                  remote refid st t when poll reach delay offset jitter
                  ============================================================ ==================
                  192.168.244.159 .INIT. 16 u - 1024 0 0.000 0.000 0.000


                  root@ICS-HomeTrollerZEE:/etc# ntpq -c "rv 0 clock" 192.168.244.159
                  192.168.244.159: timed out, nothing received
                  ***Request timed out
                  Real time comes from the NTP server....I am confused as I cannot find any references to dot 159 anywhere.

                  root@ICS-HomeTrollerZEE:/etc# ntpq -c "rv 0 clock" 192.168.244.129
                  clock=d7f23496.5a90e2f0 Wed, Oct 22 2014 8:50:14.353
                  The above bolded 16 u shows that it's getting its time sync wrong still which doesn't make sense to me.

                  I removed the fake-hwclock program. Time doesn't appear to be coming from my ntp.conf clock reference. I wonder if its something built in to Homeseer?

                  Found my issue:

                  root@ICS-HomeTrollerZEE:/etc# ps aux | grep ntp
                  ntp 4444 0.0 0.2 5384 1392 ? Ss 09:21 0:00 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -c /var/lib/ntp/ntp.conf.dhcp -u 102:104
                  root 5005 0.0 0.1 3552 804 pts/0 S+ 09:30 0:00 grep ntp
                  root@ICS-HomeTrollerZEE:/etc# cd /var/lib/ntp/
                  root@ICS-HomeTrollerZEE:/var/lib/ntp# nano ntp.conf.dhcp
                  File above was referencing dot 159.

                  # NTP server entries received from DHCP server
                  server 192.168.244.159 iburst
                  changed it to 129. - Curious why it was referencing a DHCP file when I am configured for a static IP?

                  root@ICS-HomeTrollerZEE:/var/lib/ntp# service ntp restart
                  [ ok ] Stopping NTP server: ntpd.
                  [ ok ] Starting NTP server: ntpd.
                  root@ICS-HomeTrollerZEE:/var/lib/ntp# ntpq -np
                  remote refid st t when poll reach delay offset jitter
                  ============================================================ ==================
                  192.168.244.129 .GPS. 1 u 2 64 1 0.575 -1224.9 0.001
                  root@ICS-HomeTrollerZEE:/var/lib/ntp#
                  What is odd about this is that I downloaded a new image and wrote it to a new SD card just a bit over a month ago. I have not used the dot 159 NTP server since the middle of last year (2013). The server has been off since then.
                  Last edited by Pete; October 22, 2014, 10:56 AM.
                  - Pete

                  Auto mator
                  Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
                  Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
                  HS4 Lite - Ubuntu 20.04 / VB W7e Jetway JBC420U591
                  Fanless Intel® Celeron N3160 SoC 8Gb
                  HS4 Pro - V4.1.18.1 - Ubuntu 20.04/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb
                  HSTouch on Intel tabletop tablets

                  X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

                  Comment


                    #10
                    Originally posted by tarbat View Post
                    Just need to see how it copes with changing from daylight saving time this weekend.
                    It handles the change from BST to GMT perfectly.

                    Comment


                      #11
                      Thank-you Christopher for the suggestion and use of the RTC clock you specified.

                      It is working well and I am into that whole time thing.

                      I have old (not that old at around 200 years) clocks around.

                      Geez just reading that Galileo designed a pendulum clock around 1637 but never finished it.



                      Time change worked here too.

                      Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
                      permitted by applicable law.
                      root@ICS-HomeTrollerZEE:~# hwclock -r
                      Wed 05 Nov 2014 06:29:21 AM CST -0.772868 seconds
                      root@ICS-HomeTrollerZEE:~#
                      - Pete

                      Auto mator
                      Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
                      Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
                      HS4 Lite - Ubuntu 20.04 / VB W7e Jetway JBC420U591
                      Fanless Intel® Celeron N3160 SoC 8Gb
                      HS4 Pro - V4.1.18.1 - Ubuntu 20.04/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb
                      HSTouch on Intel tabletop tablets

                      X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

                      Comment


                        #12
                        Originally posted by Pete View Post
                        Thank-you Christopher for the suggestion and use of the RTC clock you specified.
                        Maybe Homeseer should consider including a RTC on the Zee, for such a small cost it seems an obvious feature on a device where the time is so important.

                        I also have a bit of an obsession with clocks - here's my latest effort.
                        http://www.flickr.com/photos/tarbat/9562357632/

                        Comment


                          #13
                          Yes I think the including of an RTC clock for the Zee would be a good thing.

                          Wow; very neato clock. Can you tell me some more about why and what relating to it?

                          There is a neighbor (retired) in my little subdivision that likes wood crafting and has been building clocks lately.

                          This morning my Hermle regulator clock keeps stopping. It is an old design but its been now over 10 years and never has stopped.

                          Someone has mentioned to me that I should lubricate the clock. Never even occurred to me to do that.
                          Last edited by Pete; November 6, 2014, 09:09 AM.
                          - Pete

                          Auto mator
                          Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
                          Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
                          HS4 Lite - Ubuntu 20.04 / VB W7e Jetway JBC420U591
                          Fanless Intel® Celeron N3160 SoC 8Gb
                          HS4 Pro - V4.1.18.1 - Ubuntu 20.04/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb
                          HSTouch on Intel tabletop tablets

                          X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

                          Comment

                          Working...
                          X