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!