9 Replies Latest reply on Oct 15, 2015 12:45 AM by chewcheik

    Using Integrated RTC of Edison From Arduino

    ab-tools

      Hello,

       

      one of the cool things about Edison is that it already includes more or less everything you need: WiFi and even a real time clock. ;-)

       

      But while trying to use the integrated RTC of Edison, I came across following questions:

      1. how do I access/set the integrated RTC from Arduino?
      2. obviously I need to connect a battery to the RTC, otherwise it does not make much sense to use it at all. I searched a bit and read here that I need to "connect the + of the battery to V_VBAT_BKUP pin (pin23 on the edison, pin 5 of J18 on the mini breakout)", but I can't find this PIN on the Edison board for Arduino. Where do I need to connect the battery to?

       

      Best regards and thanks in advance for any tip on that

      Andreas

       

      P. S.: I'm developing with Arduino on a Windows 8.1 64 bit (just in case that matters at some point).

        • 1. Re: Using Integrated RTC of Edison From Arduino
          Intel_Peter

          Hello ab-tools,

           

          Unfortunately according to the Intel® Edison Arduino* Board Schematic there's no direct access to this pin on the Arduino expansion board headers. However, it could be reached on the testing point TP23 (which is found on the back side of the board). You could try soldering this point to get access to this pin. If you decide to do so, be careful since it is very easy to create short circuits between this and the other points.

           

          Peter.

          • 2. Re: Using Integrated RTC of Edison From Arduino
            ab-tools

            Hello Peter,

             

            that's really bad - as written above it's the great thing about Edison that everything is included directly on the board and you don't need a lot add-on modules (RTC, WiFi, Bluetooth, ...) which are needed for a lot of applications!

            Therefore I don't understand why this very important PIN is not made easily accessible (making the RTC more or less useless).

             

            Anyway, I would try soldering it which looks like doable to me if you can answer the first question:

            how I can access/set the Edison RTC from Arduino?

             

            As soon as I have the RTC up and working with Arduino I will try the soldering part.

             

            I searched already on the web, but did not find any Arduino code regarding the Edison RTC:

            could you please send me a short example code on how to access the RTC?

             

            Best regards and thanks again for your quick support

            Andreas

            • 3. Re: Using Integrated RTC of Edison From Arduino
              Intel_Peter

              I'm sorry, I completely missed that question. I personally have never used the RTC but you can read it on /proc/driver/rtc and change it with the command timedatectl.

              That being said, you can use it by making a system call from the Arduino side with the command system. I'll give you a simple example of how this command is used:

               

              system("echo hello world");

               

              I'll attach a couple of links to threads that might be of help for you:

              Re: RTC clock alarm to boot up the Edison

              Getting_setting_date and time on Edison

               

              Peter.

              • 4. Re: Using Integrated RTC of Edison From Arduino
                ab-tools

                Hello Peter,

                 

                first thanks for your quick reply again!

                 

                OK, I looked through the threads mentioned and additional searched a bit. I would get the Edison hardware RTC from Arduino to be set like this:

                system("date -s \"2015-08-05 21:00:00\"");

                system("hwclock -w"); // set hardware RTC according to system time

                 

                This seems to work fine so far.

                 

                But the other way round seems to be a bit more complicated.

                 

                Resetting the Linux system time to the time of the hardware RTC is easy again:

                system("hwclock -s");

                 

                I could then output the system date e. g. like this:

                system("date +\"%Y-%m-%d %H:%M:%S\"");

                 

                But how the heck I get that back into my Arduino process?

                 

                The only spontaneous option that came to my mind would be writing it into a file on the SD storage and then reading this file from Arduino again - but this sounds really crazy just for getting the time from the RTC!

                 

                Is there any other option to get this time back into the Arduino process?

                I mean e. g. getting the output of above system call back?

                 

                Best regards and thanks again

                Andreas

                • 5. Re: Using Integrated RTC of Edison From Arduino
                  Intel_Peter

                  Unfortunately, that's the only option I can think of as well. However there is a very good document about this that might interest you: IoT - Data sharing between programming environments on Intel® Edison | Intel® Developer Zone.

                   

                  Peter.

                  • 6. Re: Using Integrated RTC of Edison From Arduino
                    ab-tools

                    Hello Peter,

                     

                    although it does not seem like a very "clean" solution and it's a pity that Intel does not provide an Arduino library to access the Edison hardware RTC directly, it's OK for me:

                    the approach (writing to file and reading it back from Arduino) works fine and reliable in my tests - so I can live with it.

                     

                    But I need to change the voltage/ampere settings for the RTC battery charge and I don't get that done although I tried a lot of different codes changes already:

                    Changing V_VBAT_BCKP Voltage and Ampere Setting

                     

                    Please help here as I really want to get this project finally done.

                     

                    Best regards and again thanks for your support

                    Andreas

                    • 7. Re: Using Integrated RTC of Edison From Arduino
                      Vincenze

                      > one of the cool things about Edison is that it already includes more or less everything you need: WiFi and even a real time clock. ;-)

                      One of the cool things about Edison is that it also includes Linux.

                       

                      You overlooked a major obstacle: when you set the current time, you should also set the current timezone. You need an Arduino library with timezones, which should be regularly updated. That's true unless your area doesn't observe summer time.

                       

                      Linux already has a library with timezones. Also, Linux has an NTP client which will automatically adjust time from the Internet.

                       

                      If you want to interact with Linux, run a daemon on Linux, to which you can connect from Arduino, send commands and receive results. That's what the Arduino Yun does when it interacts with Linux.

                       

                      As for the super capacitor that you selected, it has a very small capacitance. It can only work for 10 minutes, it's purely for a tiny power outage. Get a 1F-10F super capacitor, it will charge the clock for hours and days, but it'll be BIG.

                      • 8. Re: Using Integrated RTC of Edison From Arduino
                        ab-tools

                        Hello Vincenze,

                         

                        I'm an Arduino developer and Intel says the Edison board supports Arduino development. So I don't want to write any Linux daemon. ;-)

                         

                        The reason why I'm using Edison is, because it has a lot of power (for such a small board), two cores and WiFi plus RTC included. I don't care about the operating system at all - it just needs to work. :-)

                         

                        And regarding time zones you're absolutely right, of course. Therefore I'm using this Arduino time zone library which works very well:

                        JChristensen/Timezone · GitHub

                         

                        And although getting the RTC time via the Linux command writing to text file and reading that again from Arduino is a bit messy, it works very well in my tests. So I can live with that.

                         

                        As I wrote the only problem left is that I did not manage to change the charging settings of the integrated charging circuit:

                        Changing V_VBAT_BCKP Voltage and Ampere Setting

                        So if you should have any idea on that your help would be highly appreciated!

                         

                        Best regards and thanks a lot in advance

                        Andreas

                        • 9. Re: Using Integrated RTC of Edison From Arduino
                          chewcheik

                          HI ab-tools,

                          Thank you for bring up the issue.

                          I also wish to use RTC from the Intel Edison arduino board.

                          Do you found the solution on how to solder the Edison?


                          Best regards,

                          Goh