Giter VIP home page Giter VIP logo

adafruit_mcp9808_library's Introduction

Adafruit MCP9808 Library Build StatusDocumentation

This is the Adafruit MCP9808 Precision I2C Temperature sensor library

Tested and works great with the Adafruit MCP9808 Breakout Board

This chip uses I2C to communicate, 2 pins are required to interface

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Written by Kevin Townsend/Limor Fried for Adafruit Industries.
BSD license, check license.txt for more information All text above must be included in any redistribution

To install, use the Arduino Library Manager and search for "Adafruit MCP9808" and install the library.

adafruit_mcp9808_library's People

Contributors

aluminumangel avatar bfesser avatar caternuson avatar chazcheadle avatar evaherrada avatar hoffmannjan avatar jlunz avatar ladyada avatar pilotak avatar siddacious avatar szymonkaliski avatar tdicola avatar tyeth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_mcp9808_library's Issues

I2C pins change

Thank you for opening an issue on an Adafruit Arduino library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:

  • Do not use GitHub issues for troubleshooting projects and issues. Instead use
    the forums at http://forums.adafruit.com to ask questions and troubleshoot why
    something isn't working as expected. In many cases the problem is a common issue
    that you will more quickly receive help from the forum community. GitHub issues
    are meant for known defects in the code. If you don't know if there is a defect
    in the code then start with troubleshooting on the forum first.

  • If following a tutorial or guide be sure you didn't miss a step. Carefully
    check all of the steps and commands to run have been followed. Consult the
    forum if you're unsure or have questions about steps in a guide/tutorial.

  • For Arduino projects check these very common issues to ensure they don't apply:

    • For uploading sketches or communicating with the board make sure you're using
      a USB data cable and not a USB charge-only cable. It is sometimes
      very hard to tell the difference between a data and charge cable! Try using the
      cable with other devices or swapping to another cable to confirm it is not
      the problem.

    • Be sure you are supplying adequate power to the board. Check the specs of
      your board and plug in an external power supply. In many cases just
      plugging a board into your computer is not enough to power it and other
      peripherals.

    • Double check all soldering joints and connections. Flakey connections
      cause many mysterious problems. See the guide to excellent soldering for examples of good solder joints.

    • Ensure you are using an official Arduino or Adafruit board. We can't
      guarantee a clone board will have the same functionality and work as expected
      with this code and don't support them.

If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:

  • Arduino board: INSERT ARDUINO BOARD NAME/TYPE HERE

  • Arduino IDE version (found in Arduino -> About Arduino menu): INSERT ARDUINO
    VERSION HERE

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): LIST REPRO STEPS BELOW

Identical temperature readings for highest resolution mode with wake()

Longer delay in Adafruit_MCP9808::wake() for for highest resolution mode / slowest temperature conversion time needed?

void Adafruit_MCP9808::wake() {
shutdown_wake(false);
delay(250);
}

I have the following setup:

Adafruit_MCP9808 mcp_internal = Adafruit_MCP9808();
void setup() {
  if (!mcp_internal.begin(0x19)) {
    Serial.println("Couldn't find MCP9808! Check your connections and verify the address is correct.");
  }
  mcp_internal.setResolution(3);
}

void loop() {
  mcp_internal.wake();
  float c = mcp_internal.readTempC();
  mcp_internal.shutdown(); 
  Serial.print(c, 4); Serial.println("*C");
}

Tried on Seeduino 4.2 and DIY-Arduino (8 MHz internal clock).

With delay(250) I get the same reading every time:

27.6250*C
27.6250*C
27.6250*C
...

Increasing the delay to values greater than 250 and I am seeing all measurements as expected.
The datasheet only states a Typical conversion time of 250 ms for the highest resolution, so this might not be enough in my case.

Not using the wake() function and calling shutdown_wake(false) + delay of course works, though a first-time user might be surprised.

Pull request #21 can cause problems

I don't think calling _wire->begin(); in ::init() is a good idea in PR #21 . Lets say on ESP8266 you can remap I2C pins and specify different speed so you init the I2C object outside this class and you pass on as reference.

Adafruit_MCP9808 mcp;

void setup() {
    Wire.begin(SDA_2, SCL_2);
    Wire.setClock(400000);

    mcp.begin(&Wire);
}

I think that _wire->begin() should be only in ::begin() and ::begin(uint8_t addr)

shutdown_wake(0) can put the device in shutdown mode

If the device is not in shutdown mode and shutdown_wake(0) is done, the function sets the shutdown bit to a 1 which puts the chip in shutdown mode. In other words, it has the opposite effect.

  tempsensor.shutdown_wake(0);
int Adafruit_MCP9808::shutdown_wake( uint8_t sw_ID )

    if (sw_ID == 0)
     {
-       conf_shutdown = conf_register ^ MCP9808_REG_CONFIG_SHUTDOWN ;
+       conf_shutdown = conf_register & ~MCP9808_REG_CONFIG_SHUTDOWN ;

The current code toggles the shutdown bit using XOR instead of zeroing the bit.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.