10 Replies Latest reply on Jun 2, 2016 8:35 AM by javilez

    18B20 One-Wire Temperature Sensors not read by Edison

    Konrad_Roeder

      I would like to read several three One-Wire Temperature Sensors with an Edison Arduino Breakout board using the same shield that I'm already using with an Arduino Uno.  I'm using Arduino IDE 1.6.5 and Edison Image ww25.5-15.  I use the attached sketch for both.  I use the same pins - power, ground and data on digital pin 2.  Jumper J8 is on 5v.

      18B20:
      1 - gnd
      2 - data, 4.7 K to 5V
      3 - 5v

      While the Edison does not require two libraries to be installed (OneWire.h and DallasTemperature.h), the Uno does.  When I run Edison, I have to hide the libraries required by Uno so that Edison can compile (Why is this a necessary hassle?  Uno does not look at Edison's libraries.  Why can't the Uno's libraries be ignored or simply issue a warning?)

       

      Here is what the Uno's execution looks like:

       

      1-Wire DS18B20 example code

      Looking for 1-Wire devices...

      Found '1-Wire' device with address: 0x28, 0xFF, 0xA9, 0x5F, 0x67, 0x14, 0x02, 0x7E

      Found '1-Wire' device with address: 0x28, 0xFF, 0x19, 0xC4, 0x66, 0x14, 0x03, 0xB1

      Found '1-Wire' device with address: 0x28, 0xFF, 0x5B, 0xF8, 0x66, 0x14, 0x02, 0xDF

      That's it.

      Found 3 sensors.

      Requesting temperatures...DONE

      Temperature for Device 0 is: 27.75

      Temperature for Device 1 is: 27.37

      Temperature for Device 2 is: 27.94

       

       

      Requesting temperatures...DONE

      Temperature for Device 0 is: 27.75

      Temperature for Device 1 is: 27.37

      Temperature for Device 2 is: 27:94

       

      Here is what Edison's execution looks like:

      1-Wire DS18B20 example code

      Looking for 1-Wire devices...

      That's it.

      Found 0 sensors.

      Requesting temperatures...DONE

       

       

      Requesting temperatures...DONE

       

       

      Why does this not run??  Am I missing something?

        • 1. Re: 18B20 One-Wire Temperature Sensors not read by Edison
          CMata_Intel

          Hi Konrad_Roeder

           

          The problem you have with the library it may be a conflict issue in the libraries. You can try with changing the folder's locations.

          I don't have the sensor to test this right now. Have you tried with the example sketch in the IDE under OneWire?

          There is another thread (for Galileo) where there are other makers that have a similar issue because of the speed in the GPIOs. This could be same issue you are having, there is a workaround in: Using Galileo to read 1-Wire (such as iButton) devices. I know you are on Edison but it could help you if the sketch doesn't work.

           

          Regards,

          Charlie.

          • 2. Re: 18B20 One-Wire Temperature Sensors not read by Edison
            Konrad_Roeder

            Charlie,

             

            There are really two issues here.  And, please don't be so quick in telling me that these issues are closed and resolved.
            1) The Arduino IDE is an eco-system where it's possible to use the same sketch from one board to another, just by changing the board and perhaps the USB connection being used to talk to the board.  The Intel Edison seems to use libraries located in a non-standard location and if there is a library in its traditional space, the two conflict.  This is an issue with Intel Edison (and perhaps also with Intel Galileo?). I don't have an Galileo to verify this.
            The 18B20 sensor is not needed to show this conflict, but if you need one, you can get one sent to you in a couple of days.  Here is a great source:
            1-Wire Digital Temperature Sensor for Arduino (DS18B20) - VETCO.NET


            2) The "Work Around" that you suggest that can be used to read 1-wire buttons uses the UART interface.  It's not free for me to used.  I need that interface for something else.  Furthermore, the "Work Around" is based on a Linux solution and not an Arduino IDE.  We need a real solid fix here, rather than a hand-wave work-around.

             

            I will take a closer look at this issue with my storage oscilloscope and my bus pirate.  http://www.seeedstudio.com/depot/Bus-Pirate-v36-universal-serial-interface-p-609.html

            --Konrad

            • 3. Re: 18B20 One-Wire Temperature Sensors not read by Edison
              Konrad_Roeder

              Yes, it is a conflict issue with the libraries.  The Arduino IDE does not have this issue when changing boards ... e.g. from an Uno to a Leonardo, or a Leonardo to a Yun for example.  But the IDE now has conflicts with Intel Edison.

               

              Speed of the GPIOs.  Hmmm interesting.   I will take some pictures with my digital storage scope and perhaps debug what's going on with my bus pirate.

               

              --Konrad

              • 4. Re: 18B20 One-Wire Temperature Sensors not read by Edison
                CMata_Intel

                Hi Konrad,

                 

                If you are on Windows, you can look in /Documents you should see a folder called Arduino. The Arduino IDE when compiles code look in the default libraries but when you add a third-party library this libraries are loaded there too, so the IDE looks in that folder too and found that are two folders with the same name so sends a warning/error for this. I think that this is what is happening with you. The Arduino IDE is intended to be used with different boards, but the libraries do not so there could be issues if you want to use libraries that are intended to be used in a differente board. Even the libraries for Edison and Galileo are located in different locations.

                 

                Is the error happening only when all three are connected or even with just one?

                 

                Regards,

                Charlie

                • 5. Re: 18B20 One-Wire Temperature Sensors not read by Edison
                  Konrad_Roeder

                  CMata_Intel,
                  Almost/not quite...

                   

                  When IDE runs with my other Arduino boards, the default libraries are stored in
                  C:/Program Files (x86)/Arduino/libraries

                   

                  And, third-party libraries are stored in
                  .../Libraries/Documents/Arduino/

                   

                  When the IDE runs Intel Edison, the default libraries are stored in
                  ...(did not write it down)

                   

                  And, it also looks in this directory for third-party libraries:
                  .../Libraries/Documents/Arduino/

                   

                  When the IDE finds a file conflict between the two libraries, it throws an error rather than following a precedence and throwing a warning.
                  Certainly, throwing the conflict error is not the best way of resolving this.
                  I probably would prefer that if a duplicate library was found that I would get a warning and the IDE would pick the board specific library by default.

                   


                  The error happens on the Intel Edison with one, two or three 18B20's. It does not happen on an Arduino Uno with one, two, or three 18B20's.
                  In all cases, I use a 4.7K pull-up resistor between the data line and +5v.

                   

                  --Konrad

                  • 6. Re: 18B20 One-Wire Temperature Sensors not read by Edison
                    Konrad_Roeder

                    CMata_Intel,
                    I used my bus pirate to drive one through four 18B20's with a 4.7K pull-up resistor.  It works fine.  It shows that bit-banging a port should work very well.  I will next take a closer look at what the Intel Edison timing looks like.  My initial hypothesis is that the bus drivers / level shifters are not working well with the 1.8v Intel Edison logic.

                     

                    --Konrad

                    • 7. Re: 18B20 One-Wire Temperature Sensors not read by Edison
                      Konrad_Roeder

                      By the way, this is what the library conflict looks like:

                       

                       

                      Build options changed, rebuilding all

                      In file included from DS18x20_Temperature.pde:1:0:

                      C:\Users\User\Documents\Arduino\libraries\OneWire/OneWire.h:108:2: error: #error "Please define I/O register types here"

                      #error "Please define I/O register types here"

                        ^

                      C:\Users\User\Documents\Arduino\libraries\OneWire/OneWire.h:115:5: error: 'IO_REG_TYPE' does not name a type

                           IO_REG_TYPE bitmask;

                           ^

                      C:\Users\User\Documents\Arduino\libraries\OneWire/OneWire.h:116:14: error: 'IO_REG_TYPE' does not name a type

                           volatile IO_REG_TYPE *baseReg;

                                    ^

                      Multiple libraries were found for "OneWire.h"

                      Used: C:\Users\User\Documents\Arduino\libraries\OneWire

                      Not used: C:\Users\User\AppData\Roaming\Arduino15\packages\Intel\hardware\i686\1.6.2+1.0\libraries\OneWire

                      Error compiling.


                      --

                       

                      Clearly I want the Intel version of the OneWire library instead of the one I'm using for other Arduinos.

                       

                      The work-around is to move the Arduino OneWire library into a directory to hide it.

                      • 8. Re: 18B20 One-Wire Temperature Sensors not read by Edison
                        javilez

                        Hi. I would like to read  One-Wire Temperature Sensors with an Edison Arduino Breakout board. I'm using Arduino IDE 1.6.0 and the example OneWire/ds18x20_Temperature.

                        The output of monitor serie is: "No more addresses" and I can't know the temperature.

                         

                        Please, someone can help me?

                        Thanks.

                        • 9. Re: 18B20 One-Wire Temperature Sensors not read by Edison
                          CMata_Intel

                          Hi,

                           

                          Are you using the 18B20? The latest Arduino IDE is the 1.6.9 version and the latest image is the 3.0 release, I suggest you to use these versions. If this doesn’t work, you could try with the environment Konrad is using, Arduino IDE 1.6.5 version, Edison Image ww25.5-15 and 4.7k pull-up resistors.

                          Try with this and let us know the outcome.

                           

                          Regards,

                          -Charlie

                          • 10. Re: 18B20 One-Wire Temperature Sensors not read by Edison
                            javilez

                            Hi Charlie. Thanks for you reply. Yes, I'm using the 18B20(1 - gnd,  2 - data, 4.7 K to 5V,  3 - 5v)

                             

                            I have tried the first solution (to update Arduino IDE to 1.6.9 and image) but has not worked. I obtain the following result: "No more addresses" on example  OneWire(Edison))

                             

                            I will try the second solution. Thank you for the help.

                             

                            Javier.