Page 1 of 1

TMP75 sensor from old iMac - Working!

Posted: Sat May 16, 2020 12:12 am
by andaley
Just to let you guys know that I have managed to get one of those sensors used in older iMac to check temperature of drives, CDROM.
D713C3FA-85DA-4B42-BFEB-DAA3C6B27B37_1_105_c.jpeg
D713C3FA-85DA-4B42-BFEB-DAA3C6B27B37_1_105_c.jpeg (285.73 KiB) Viewed 1859 times
Temperature reading is done via i2c

Code: Select all

/*
Read the temperature from an LM75-derived temperature sensor, and display it
in Celcius every 250ms. Any LM75-derived temperature should work.
*/

#include <Temperature_LM75_Derived.h>

// The Generic_LM75 class will provide 9-bit (±0.5°C) temperature for any
// LM75-derived sensor. More specific classes may provide better resolution.
//Generic_LM75 temperature;
Generic_LM75 temperature(0x49);

void scanI2C() {
  byte error, address;
  int nDevices;
  Serial.println("Scanning...");
  nDevices = 0;
  for(address = 1; address < 127; address++ ) {
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
    if (error == 0) {
      Serial.print("I2C device found at address 0x");
      if (address<16) {
        Serial.print("0");
      }
      Serial.println(address,HEX);
      nDevices++;
    }
    else if (error==4) {
    }    
  }
  if (nDevices == 0) {
    Serial.println("No I2C devices found\n");
  }
  else {
    Serial.println("done\n");
  }
}

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

float readI2CTemperature() {
  //Serial.print("Temperature = ");
  //Serial.print(temperature.readTemperatureC());
  return temperature.readTemperatureC();
}

void loop() {
   Serial.println(readI2CTemperature());
}