Adding a RTC?

Discussion in 'General Discussion' started by josolanes, Oct 17, 2013.

  1. josolanes

    josolanes New Member

    Joined:
    Oct 14, 2013
    Messages:
    64
    Likes Received:
    0
    Hi,

    Does anyone know how or if it's possible to add a RTC to the UDOO?

    I've noticed https sites really don't like it when your PC date is Jan 1 1970 :p. Of course, running "date MMddhhmmyyyy" works well [where MM is the month, dd is the day, hh is the hour, mm is the minutes, and yyyy is the year] and survives restarts but as soon as the UDOO loses power or is unplugged and plugged back in the date is reset, implying no real time clock (RTC).

    Is it possible to add one to it? Maybe add a RTC to the Arduino and have it send the information to the UDOO via its embedded port? I just feel this is something that can help the UDOO board become a full-featured PC and also add nice functionality to an Arduino if the information can be transferred between them :)

    Related, but another way to attack this, maybe we can simply have the UDOO find system the time at startup using NTP and an NTP server, to avoid the need for an RTC at all? If so, does anyone know the way to do this via command line so it can be added at startup? Maybe something like this can be added to the official release, using NTP to find the current time?

    Thanks,
    Josh
     
  2. DracoLlasa

    DracoLlasa UDOOer

    Joined:
    Oct 15, 2013
    Messages:
    419
    Likes Received:
    3
    i havent actually set it up that far yet, but personally i would do the later, NTP on startup.
    This is how my PCDuino and Raspberry Pi get their time. i run Wifi on both so.
    Its not perfect, but easier than adding more hardware for a RTC
     
  3. josolanes

    josolanes New Member

    Joined:
    Oct 14, 2013
    Messages:
    64
    Likes Received:
    0
    Sounds great, I'll look into the command line to do so - it's been a while since I've played with NTP in Linux but I remember it wasn't too bad to setup, just need to research really quick.

    Thanks DracoLlasa!
     
  4. andcmp

    andcmp New Member

    Joined:
    May 8, 2013
    Messages:
    161
    Likes Received:
    0
    Yes, you can run this command to get current time through NTP protocol:
    Code:
    sudo ntpdate-debian
    If you want, you can also set UDOO to do it on startup.

    Also, for your info, there's a white battery power connector, near the reset button, labeled "extbat". This is an "hardware" solution to add RTC functionalities to UDOO, you'll need a 3V button battery wired to a JST male connector.

    Andrea
     
  5. josolanes

    josolanes New Member

    Joined:
    Oct 14, 2013
    Messages:
    64
    Likes Received:
    0
    Andrea,

    Thank you very much - that was excellent information! So would the battery function like it does on a PC motherboard then, where (I suspect) it would recharge when plugged back into power. I suspect this is how motherboards do it at least, as the battery virtually never needs replacing

    In the interim I'll setup the ntpdate-debian to run in linux.rc for startup and will consider a battery as a full RTC functionality as well

    -Josh
     
  6. DracoLlasa

    DracoLlasa UDOOer

    Joined:
    Oct 15, 2013
    Messages:
    419
    Likes Received:
    3
    This is great, makes it VERY easy to add...
    So basically the UDOO has a RTC, you just need to connect the batter in the extbat JST port and you are good to go.
     
  7. ags131

    ags131 New Member

    Joined:
    Oct 22, 2013
    Messages:
    10
    Likes Received:
    0
    Nice! Now I just need to find somewhere that sells cheap JST connectors. :)
     
  8. andcmp

    andcmp New Member

    Joined:
    May 8, 2013
    Messages:
    161
    Likes Received:
    0
  9. BenL

    BenL New Member

    Joined:
    Sep 1, 2013
    Messages:
    7
    Likes Received:
    0
    I'm not sure where to put it so it can work at startup, but a quick search of the man pages turned up ntpdate. From the command line you can type "sudu ntpdate us.pool.ntp.org" to set the time and date.

    Take a look at http://www.pool.ntp.org/en/use.html for more info about setting up ntp (and picking a region that is close to you).

    p.s. If you're like me and know just enough unix to be dangerous, "man -k WORD" can be useful for finding all of the man pages that contain WORD (such as looking for ntp commands).
     
  10. DracoLlasa

    DracoLlasa UDOOer

    Joined:
    Oct 15, 2013
    Messages:
    419
    Likes Received:
    3
    if you are trying to just setup NTP on boot, its real easy, just go into:
    Applications -> system tools -> system settings

    Under system open 'Date and Time'
    in the upper right corner, click 'unlock' and enter the root password (default: ubuntu)
    Then you will be enable to enable 'network Time' just under where the unlock button was.

    Set that up and as long as you are booting to a known wifi network, the system will sync time automatically on boot.
    If you are not booting to a preconfigured WiFi network then obviously you will need to use one of the other RTC type solutions, but this is the most straightforward setup
     
  11. josolanes

    josolanes New Member

    Joined:
    Oct 14, 2013
    Messages:
    64
    Likes Received:
    0
    I forgot to update this - a CMOP battery wired to the port at the bottom of the board, by the Reset button, does indeed work well. Up until now I'd had ntpdate running each startup in /etc/local/rc.local (within Debian). The CMOP battery does maintain time well - confirmed by shutting it off and unplugging it for several minutes then plugging it back in and confirming time with ntpdate disabled
     
  12. andcmp

    andcmp New Member

    Joined:
    May 8, 2013
    Messages:
    161
    Likes Received:
    0
    Great!
     
  13. technilinx

    technilinx New Member

    Joined:
    Nov 21, 2013
    Messages:
    8
    Likes Received:
    0
    What size battery does it support/require (meaning voltage requirements)?
     
  14. tibmeister

    tibmeister New Member

    Joined:
    Oct 20, 2013
    Messages:
    19
    Likes Received:
    0
    The link got cut off...
     
  15. DracoLlasa

    DracoLlasa UDOOer

    Joined:
    Oct 15, 2013
    Messages:
    419
    Likes Received:
    3
    I do beleive any type of 3v button battery would work just fine. the RTC is in the UDOO so it just needs the power.
     
  16. EBrown

    EBrown New Member

    Joined:
    Dec 9, 2013
    Messages:
    48
    Likes Received:
    0
    In that case I'll just serial two AA or AAA batteries together and hook them to that port. (Provided 3V is the correct voltage.)

    Thanks,
    EBrown
     
  17. andcmp

    andcmp New Member

    Joined:
    May 8, 2013
    Messages:
    161
    Likes Received:
    0
    Correct! You can also use a 3V button battery but I would go for a couple of AA/AAA, like the official UDOO's Battery Holder for RTC does.
     
  18. rootScript

    rootScript Member

    Joined:
    Jan 11, 2014
    Messages:
    44
    Likes Received:
    0
    Option 1 = Official Battery holder + 2xAA
    Option 2 = Unofficial Holder + CR 2032 3V (This is what I'm going to do)
    Option 3 = Super Unofficial Battery idea - rechargeable LiPo (need to drop from 3.7v to 3v, & add charger, fuel gauge, + code to recharge from main board when the charge has dropped below certain level). A bit over the top, but if you are bored, why not.
     

    Attached Files:

Share This Page