1

I'm trying to get an Arduino Uno to run four sensors (all I2C). The first two are TMP102 temperature sensors. The address is controlled by tying the ADD0 pin to GND, VCC, SDA, or SCL (four possible addresses, without multiplexing). I get it to receive data just fine through the GND setting.

I wrote some code to collect from two, but before I was even talking to the second one, plugging it in causes the data stream from the GND one to stop. Unplugging it from the breadboard makes it work again. Either sensor in either location on the breadboard will work fine, as long as it's addressed as ground. Neither sensor will, even by itself, work with any other address. I tried some other sketches from the net (one attached below that should read from any of four different sensors), but all have the same issue.

#include <Wire.h>
byte res;
byte msb;
byte lsb;
int val;

void setup()
{
  Serial.begin(9600);
  Wire.begin();
}

void loop()
{
  res = Wire.requestFrom(72,2); 
  if (res == 2) {
    msb = Wire.read(); /* Whole degrees */ 
    lsb = Wire.read(); /* Fractional degrees */ 
    val = ((msb) << 4);   /* MSB */
    val |= (lsb >> 4);    /* LSB */
    Serial.print( "72:");
    Serial.println(val*0.0625);
    delay(1000);   
  }
  res = Wire.requestFrom(73,2); 
  if (res == 2) {
    msb = Wire.read(); /* Whole degrees */ 
    lsb = Wire.read(); /* Fractional degrees */ 
    val = ((msb) << 4);   /* MSB */
    val |= (lsb >> 4);    /* LSB */
    Serial.print( "73:");
    Serial.println(val*0.0625);
    delay(1000);   
  }
  res = Wire.requestFrom(74,2); 
  if (res == 2) {
    msb = Wire.read(); /* Whole degrees */ 
    lsb = Wire.read(); /* Fractional degrees */ 
    val = ((msb) << 4);   /* MSB */
    val |= (lsb >> 4);    /* LSB */
    Serial.print( "74:");
    Serial.println(val*0.0625);
    delay(1000);   
  }
  res = Wire.requestFrom(75,2); 
  if (res == 2) {
    msb = Wire.read(); /* Whole degrees */ 
    lsb = Wire.read(); /* Fractional degrees */ 
    val = ((msb) << 4);   /* MSB */
    val |= (lsb >> 4);    /* LSB */
    Serial.print( "75:");
    Serial.println(val*0.0625);
    delay(1000);   
  }
}

Breadboard: (image link: the forum kept crashing when I tried to upload the image directly) https://www.sugarsync.com/pf/D333436_95042359_6938296

Thanks!

0

You see that little solder jumper block on the breakout board labelled "ADD0"? You need to remove the solder from that. It's currently connected in a pre-defined position and you trying to use the ADD0 pin is conflicting with that.

  • Well, that's not obvious :) Would soldering the other pair of contacts together tie ADD0 to VCC? – DeltaG Jun 12 '15 at 1:54
  • Most likely, Yes. – Majenko Jun 12 '15 at 8:15
  • I just used a jumper to set the second address, rather than soldering, but... it works! Thanks for the help! – DeltaG Jun 12 '15 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.