Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: Arduino HDC1080 Library compatibility

  1. #1
    Junior Member
    Join Date
    Feb 2017
    Posts
    10

    Arduino HDC1080 Library compatibility

    Dear Teensy Community,

    I would like to use a humidity&temperature sensor which is controlled or acquired by i2c bus. I am trying to use the Arduino library in order to access to the sensor data.

    What do you recommend me to do if I found that examples don't work properly? Should I modify the libraries?

    How is it possible to adjust an existing arduino compatible library with Teensy 3.2?

    Thanks,

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,355
    Quote Originally Posted by ElkinDiaz View Post
    What do you recommend me to do if I found that examples don't work properly? Should I modify the libraries?
    If you can't solve it, of course post a question here. Please notice the "Forum Rule" in red at the top of every page. Questions about problems are expected to have the complete code and all details (like the exact part you are really using) to reproduce the problem. Usually a photo of how you really connected the wires is also useful, since most libraries work and problem are often simple misunderstanding about how to connect the signals or power.

    How is it possible to adjust an existing arduino compatible library with Teensy 3.2?
    Yes, but the details are important. That's why we have the Forum Rule.

    However, nearly all libraries "just work", especially libs from Adafruit. Your easiest path is usually to buy one of their sensors. They also see Teensy, so you can get everything from one site.

  3. #3
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    2,786

    Cool

    Note, if you are using i2c on the Teensy, you may need to add pull-up resistors between the two i2c pins (pins 18 and 19) and 3.3v (one resistor between pin 18 and 3.3v, and one resistor between pin 19 and 3.3v). Some i2c devices already have pull-up resistors, some do not. If you connect the device and run the i2cscanner example program, and it hangs, it means you need the pull-up resistors.

    Generally 2.2K resistors are recommended for 3.3v applications like the Teensy. You can use the 4.7K resistors that 5v Arduino applications use, but it might prevent you from raising the speed on the i2c bus (ditto for having multiple pull-up resistors). The default i2c bus is fine with 4.7K resistors.

    I don't think it is an issue with Adafruit any more since a lot of their new designs are 3.3v chips, but really old i2c devices might be 5v only. That requires using a level shifter to convert between 3.3v and 5v. Generally, it is better to buy i2c devices that can work at either 3.3v or 5v.

  4. #4
    Junior Member
    Join Date
    Feb 2017
    Posts
    10
    Thanks for the ideas,

    Paul I am trying to use the ClosedCube HDC1080, I need to connect it to the i2c Wire1 interface on pins 29 and 30.
    [URL="http://www.arduinolibraries.info/libraries/closed-cube-hdc1080"]

    I have to include the "i2c_t3.h" in order to use the Wire1 interface, am I right?

    There is a difference on the Wire interface used, and so I tried to modify the library ClosedCube_HDC1080.cpp, I have replaced all the Wire... instructions (Wire.beginTransmission, Wire.write, Wire.endTransmission and Wire.read instructions) by Wire1... instructions.

    It compiles, but the result is that I get the maximum values for all the read values.

    I uploaded the .ino file I am trying use, and the modified HDC1080 library source files in this GitHub link:

    https://github.com/elkingonzalo/Teensy---HDC1080.git

    Thanks.

  5. #5
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    1,588
    you might try running the scanner example from the i2c_t3 lib and see if you see your device

  6. #6
    Junior Member
    Join Date
    Feb 2017
    Posts
    10
    I wrote my own functions to read and it worked, so I did not need to use the HDC library and it works perfect.

    Thanks for the support.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •