Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 37 of 37

Thread: Teensy 3.6 not detecting MCP9808 sensor

  1. #26

  2. #27
    There is the picture hopefully you all can see it on your screen.

  3. #28
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,417
    Chandler obviously had problems including an image in a message and has emailed me the photo. I've resized it (it was over 3MB) and include it here:
    Attachment 21728

    Looks to me like you haven't got SDA and SCL wired properly. SDA on the MCP9808 should go to SDA on the T3.6, and similarly with SCL. You have SDA to SCL.

    Pete
    Last edited by defragster; 09-15-2020 at 07:45 PM.

  4. #29
    Quote Originally Posted by el_supremo View Post
    Chandler obviously had problems including an image in a message and has emailed me the photo. I've resized it (it was over 3MB) and include it here:
    Attachment 21728

    Looks to me like you haven't got SDA and SCL wired properly. SDA on the MCP9808 should go to SDA on the T3.6, and similarly with SCL. You have SDA to SCL.

    Pete
    Just fixed that issue and still throwing that the sensor cant be found

  5. #30
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,438
    Pictures I believe need to be under 1mb in size...

  6. #31
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,417
    The rest of your wiring looks OK.
    I hooked up a T3.6 with several I2C devices, including the Chronodot. I tried two different I2C scanners and both find all 5 addresses on the bus using a range of pullups - I tried 2k2, 4k7 and even no pullups at all.

    The only thing I can think of to try is to use a multimeter with continuity tester and make sure that all of the jumper wires are good.

    Pete

  7. #32
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,438
    Again maybe show current picture (sized to < 1mb...) The attachments above are not valid...

  8. #33
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,417
    @KurtE: Does the attachment in #28 work for you?

    Pete

  9. #34
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    12,197
    Quote Originally Posted by el_supremo View Post
    @KurtE: Does the attachment in #28 work for you?

    Pete
    not KurtE - but, no :: "Attachment 21728"
    Invalid Attachment specified. If you followed a valid link, please notify the administrator

  10. #35
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,417
    Hmmmm. The link in #28 is to https://forum.pjrc.com/attachment.ph...chmentid=21728 which shows the image to me.
    Try again:
    Click image for larger version. 

Name:	I2C_MCP9808_wbrs.jpg 
Views:	7 
Size:	91.8 KB 
ID:	21739
    That seems to have attached in a different way but I used the same mechanism.

    Pete

  11. #36
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,438
    Again at least with that last photo, it is hard to follow the wires, but I am unsure if on A4/A5 Or if it is off by one A5/A6... (again why I run the HiLow test to take the doubt out of things...)

  12. #37
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,438
    Again I would suggest check your wiring.

    My one arrived today, I hooked it up to a T3.6 ... Quick and dirty

    Click image for larger version. 

Name:	screenshot.jpg 
Views:	3 
Size:	121.7 KB 
ID:	21786

    I ran the unedited Adafruit library test program:
    Code:
    /**************************************************************************/
    /*!
    This is a demo for the Adafruit MCP9808 breakout
    ----> http://www.adafruit.com/products/1782
    Adafruit invests time and resources providing this open source code,
    please support Adafruit and open-source hardware by purchasing
    products from Adafruit!
    */
    /**************************************************************************/
    
    #include <Wire.h>
    #include "Adafruit_MCP9808.h"
    
    // Create the MCP9808 temperature sensor object
    Adafruit_MCP9808 tempsensor = Adafruit_MCP9808();
    
    void setup() {
      Serial.begin(9600);
      while (!Serial); //waits for serial terminal to be open, necessary in newer arduino boards.
      Serial.println("MCP9808 demo");
      
      // Make sure the sensor is found, you can also pass in a different i2c
      // address with tempsensor.begin(0x19) for example, also can be left in blank for default address use
      // Also there is a table with all addres possible for this sensor, you can connect multiple sensors
      // to the same i2c bus, just configure each sensor with a different address and define multiple objects for that
      //  A2 A1 A0 address
      //  0  0  0   0x18  this is the default address
      //  0  0  1   0x19
      //  0  1  0   0x1A
      //  0  1  1   0x1B
      //  1  0  0   0x1C
      //  1  0  1   0x1D
      //  1  1  0   0x1E
      //  1  1  1   0x1F
      if (!tempsensor.begin(0x18)) {
        Serial.println("Couldn't find MCP9808! Check your connections and verify the address is correct.");
        while (1);
      }
        
       Serial.println("Found MCP9808!");
    
      tempsensor.setResolution(3); // sets the resolution mode of reading, the modes are defined in the table bellow:
      // Mode Resolution SampleTime
      //  0    0.5C       30 ms
      //  1    0.25C      65 ms
      //  2    0.125C     130 ms
      //  3    0.0625C    250 ms
    }
    
    void loop() {
      Serial.println("wake up MCP9808.... "); // wake up MCP9808 - power consumption ~200 mikro Ampere
      tempsensor.wake();   // wake up, ready to read!
    
      // Read and print out the temperature, also shows the resolution mode used for reading.
      Serial.print("Resolution in mode: ");
      Serial.println (tempsensor.getResolution());
      float c = tempsensor.readTempC();
      float f = tempsensor.readTempF();
      Serial.print("Temp: "); 
      Serial.print(c, 4); Serial.print("*C\t and "); 
      Serial.print(f, 4); Serial.println("*F.");
      
      delay(2000);
      Serial.println("Shutdown MCP9808.... ");
      tempsensor.shutdown_wake(1); // shutdown MSP9808 - power consumption ~0.1 mikro Ampere, stops temperature sampling
      Serial.println("");
      delay(200);
    }
    Code:
    MCP9808 demo
    Found MCP9808!
    wake up MCP9808.... 
    Resolution in mode: 3
    Temp: 21.3750*C	 and 70.4750*F.
    Shutdown MCP9808.... 
    
    wake up MCP9808.... 
    Resolution in mode: 3
    Temp: 21.4375*C	 and 70.5875*F.
    Shutdown MCP9808.... 
    
    wake up MCP9808.... 
    Resolution in mode: 3
    Temp: 21.4375*C	 and 70.5875*F.
    Shutdown MCP9808....

    The wire scanner program finds it.
    Code:
    I2C Scanner
    Scanning...
    Device found at address 0x18  (LIS331DLH)
    done
    
    Scanning...
    Device found at address 0x18  (LIS331DLH)
    done
    
    Scanning...
    Device found at address 0x18  (LIS331DLH)
    done
    Although maybe need to add the logical name for device as one of them that might be using address 0x18

    Update: FYI - I moved the SCL wire to 37 and SDA wire to pin 38 and edited the Adafruit program like:
    Code:
      if (!tempsensor.begin(0x18, &Wire1)) {
    And it worked as well.
    Last edited by KurtE; 09-18-2020 at 11:03 PM.

Posting Permissions

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