8 Replies Latest reply on Nov 14, 2014 8:49 PM by Terrence_

    Intel Edison Arduino Board + General Questions and Proceedsings

    UST_

      Hello,

       

      I just started using the Arduino UNO last week, fairly new at controllers but have a decent programming background so I was able to pick it up fairly quickly and implement the project I had in mind.

       

      I saw the Intel Edison, with it's built in wireless capabilities, in memory storage and all around great specs and wanted to switch my project over. So I thought hey why not get the Edison-Arduino breakout board and transfer everything over! I got the Edison this past Friday and was only able to get it up and running Monday using the "Getting Started" page that Intel provides. Made a few mistakes; but I got these things accomplished and working:

      - Downloaded the Edison Arduino IDE

      - I was able to run the "Blink Program" that the get started page says

      - The Edison flashed with the latest version of Yucto (off of Intel's software download page)

      - Updated the Edison name, setup wifi and password

       

      Now I have a code that I had working in my old Arduino IDE, so I tried transferring it (including old libraries) and the code didn't work. My libraries that I had transferred seemed to be broken so I searched the forums and internet to look for fixes; but all I did was just delete the libraries and transfer them back and the issues were fixed.

       

      Sorry for the convoluted back story, just wanted to explain where I am at with my understanding. My problem is that I seem to be missing a fundamental understanding of how the Arduino-Edison IDE is supposed to be used in-conjunction with the Arduino-Edison board. I've seen a lot of forums and responses by Intel personnel and mhahn , which have been helpful; but I still seem to be missing something vital in how things can work to get my code running.


      I know I'll problem have to make adjustments or even use an outside program, but main issue is I need to understand how to start properly coding for this new board, my old code uses the A4/A5 (SDA/SCL) analog pins, which the Arduino-Edison Board seems to have as well.

       

      Please, any insight or guidance would be greatly appreciated.

        • 1. Re: Intel Edison Arduino Board + General Questions and Proceedsings
          CMata_Intel

          Hi UST_;

           

          Working with the Edison using the IDE that you download, is very similar to working with the Arduino board. I think that you could get a lot of helpful information in their website (Arduino website), in there you'll find code examples, commands and libraries information. Now, as you know by the moment not everything that is available for Arduino is already available for the Edison, but you could go to the directory where is your IDE  and find which libraries are available and ready to use;  the direction in your PC that you should check it has to be something like this:

          >..arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison.

           

          Regards.

          CMata

          • 2. Re: Intel Edison Arduino Board + General Questions and Proceedsings
            UST_

            Hi CMata ,

             

            Thanks for the speedy reply!

             

            I have looked there as you suggested and the Edison libraries seem to be sufficient enough, I've even added a few of my own (Time, Time Alarms, and DS1307), do these libraries that I have added need to be configured? If so where would I start.

             

            Besides that, I got the code I wanted up on the Arduino-Edison IDE, compiled successfully. I'm just trying to run a RTC (DS1307) and have it print the time. I have it exactly wired as I did with the Arduino UNO. I'm using the A4/A5 pins on the Arduino-Edison board but when I run the example code "Set Time" (code below) from the DS1307 library it just shows a blank screen in the serial monitor; it doesn't even show the default Serial.println() in the void setup().

             

            When I then run the example code "Read Test" (shown below) from the DS1307 library it shows this error on the serial monitor "DS1307 read error!  Please check the circuitry." Which should show if the DS1307 is not connected properly, but I haven't changed any of the wiring from the Arduino UNO to the Arduino-Edison board, everything is as it should be. This is why I was asking if additional interfacing needs to be done, or why I feel like I'm missing something vital about the interfacing.

             

            Sincerely,

             

            UST

            • 3. Re: Intel Edison Arduino Board + General Questions and Proceedsings
              UST_

              Hi CMata,

               

              Sorry here is the code for both of those examples I mentioned in the above. CMata_Intel

               

               

              --------------------------------------------------------------------------- CODE ----------------------------------------------------------------------SetTime.pde

              #include <Wire.h>

              #include <Time.h>

              #include <DS1307RTC.h>

               

               

              const char *monthName[12] = {

                "Jan", "Feb", "Mar", "Apr", "May", "Jun",

                "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"

              };

               

               

              tmElements_t tm;

               

               

              void setup() {

                bool parse=false;

                bool config=false;

               

               

                // get the date and time the compiler was run

                if (getDate(__DATE__) && getTime(__TIME__)) {

                  parse = true;

                  // and configure the RTC with this info

                  if (RTC.write(tm)) {

                    config = true;

                  }

                }

               

               

                Serial.begin(9600);

                while (!Serial) ; // wait for Arduino Serial Monitor

                delay(200);

                if (parse && config) {

                  Serial.print("DS1307 configured Time=");

                  Serial.print(__TIME__);

                  Serial.print(", Date=");

                  Serial.println(__DATE__);

                } else if (parse) {

                  Serial.println("DS1307 Communication Error :-{");

                  Serial.println("Please check your circuitry");

                } else {

                  Serial.print("Could not parse info from the compiler, Time=\"");

                  Serial.print(__TIME__);

                  Serial.print("\", Date=\"");

                  Serial.print(__DATE__);

                  Serial.println("\"");

                }

              }

               

               

              void loop() {

              }

               

               

              bool getTime(const char *str)

              {

                int Hour, Min, Sec;

               

               

                if (sscanf(str, "%d:%d:%d", &Hour, &Min, &Sec) != 3) return false;

                tm.Hour = Hour;

                tm.Minute = Min;

                tm.Second = Sec;

                return true;

              }

               

               

              bool getDate(const char *str)

              {

                char Month[12];

                int Day, Year;

                uint8_t monthIndex;

               

               

                if (sscanf(str, "%s %d %d", Month, &Day, &Year) != 3) return false;

                for (monthIndex = 0; monthIndex < 12; monthIndex++) {

                  if (strcmp(Month, monthName[monthIndex]) == 0) break;

                }

                if (monthIndex >= 12) return false;

                tm.Day = Day;

                tm.Month = monthIndex + 1;

                tm.Year = CalendarYrToTm(Year);

                return true;

              }

              ---------------------------------------------------------------------------------------------------------------------------------------------------------------------

               

              -----------------------------------------------------------------------------CODE ------------------------------------------------------------------------------ ReadTest.pde

               

              #include <Wire.h>

              #include <Time.h>

              #include <DS1307RTC.h>

               

               

              void setup() {

                Serial.begin(9600);

                while (!Serial) ; // wait for serial

                delay(200);

                Serial.println("DS1307RTC Read Test");

                Serial.println("-------------------");

              }

               

               

              void loop() {

                tmElements_t tm;

               

               

                if (RTC.read(tm)) {

                  Serial.print("Ok, Time = ");

                  print2digits(tm.Hour);

                  Serial.write(':');

                  print2digits(tm.Minute);

                  Serial.write(':');

                  print2digits(tm.Second);

                  Serial.print(", Date (D/M/Y) = ");

                  Serial.print(tm.Day);

                  Serial.write('/');

                  Serial.print(tm.Month);

                  Serial.write('/');

                  Serial.print(tmYearToCalendar(tm.Year));

                  Serial.println();

                } else {

                  if (RTC.chipPresent()) {

                    Serial.println("The DS1307 is stopped.  Please run the SetTime");

                    Serial.println("example to initialize the time and begin running.");

                    Serial.println();

                  } else {

                    Serial.println("DS1307 read error!  Please check the circuitry.");

                    Serial.println();

                  }

                  delay(9000);

                }

                delay(1000);

              }

               

               

              void print2digits(int number) {

                if (number >= 0 && number < 10) {

                  Serial.write('0');

                }

                Serial.print(number);

              }

              -------------------------------------------------------------------------------------------------------------------------------------------------------------------------

              • 4. Re: Intel Edison Arduino Board + General Questions and Proceedsings
                CMata_Intel

                Hi UST_;

                 

                This is a document about Shield Testing Reports , in there you'll find some shields with RTCs and the libraries that they used, in some cases those libraries needs changes (I supposed that is what is happening in this case). Take a look of that document and try with those libraries, they also used the RTC-DS1307 in some cases. Use those cases as feedback and let us know how it goes.

                 

                Regards.

                CMata

                1 of 1 people found this helpful
                • 5. Re: Intel Edison Arduino Board + General Questions and Proceedsings
                  UST_

                  Hi CMata_Intel,

                   

                  I took a look at the libraries that they use and suggested. This gets my clock running, but it further complicates things for my project, the library they use is RTClib, which defines the date and time as their own variable DateTime, which I can't use to compare against integer values.

                   

                  I think I need to change my Time and DS1307 libraries to work with Edison, so my next step will be to see and figure out how the RTClib is working and printing time and change Time and DS1307 to match. Thanks for the direction!

                  • 6. Re: Intel Edison Arduino Board + General Questions and Proceedsings
                    Terrence_

                    UST, the Edison has a RTC on it.  Is there a reason you are attaching a ds1307?

                    I am in the same boat and want to know why you are not using the on board rtc.

                     

                    Thanks.

                     

                    Re: RTC 1307 - Real Time Clock

                    • 7. Re: Intel Edison Arduino Board + General Questions and Proceedsings
                      UST_

                      Terrence_

                       

                      The reason I was using the DS1307 is because I was originally programming and making my project for the Arduino UNO. On the Arduino Playground - Time they had excellent libraries for Time.h and DS1307.h.

                       

                      I still want to use the DS1307, mainly because of the amazing library I was using with it, which worked in sync to Time.h. With this I was able to compare the time to past time and make data recordings per minute, store them every minute in two arrays for data counting and time stamping respectively. Then print that data.

                       

                      To sum up, the two libraries together made it great to manipulate date and time because they worked together and their variables were comparable (int I believe or some derivation of it). The DS1307 tracked the time continuously and needed no further tweaking once the time was set with one of the example codes from the library.

                       

                      Also, earlier in one of your posts GetCurDateTime function - how is this? Intel_Peter stated that:

                      Time.h library is not currently compatible with the Edison.

                      I don't see how to do what I want without that library working. I want to know if I should try and fix the library, if possible with my current knowledge at the moment, or if I should switch back to the Arduino Uno for the moment and once it gets addressed go back to the Edison. Unless there is another way entirely to do this?

                       

                      Cheers,

                      UST

                      • 8. Re: Intel Edison Arduino Board + General Questions and Proceedsings
                        Terrence_

                        UST_ hurry up and get over to my thread on getting the datetime.  mikalhart has a solution and it works for getting datetime.

                         

                        GetCurDateTime function - how is this?

                         

                        Terrence