The LM75 is a precision integrated-circuit temperature sensor that offers an easy-to-use I2C interface to provide temperature readings with a high degree of accuracy. It is widely used in system thermal management, environmental monitoring, and personal electronics to measure temperature with minimal interfacing and component count.
Pin Number | Name | Description |
---|---|---|
1 | SDA | Serial Data Line for I2C communication |
2 | SCL | Serial Clock Line for I2C communication |
3 | A2 | Address pin 2, selectable bit |
4 | A1 | Address pin 1, selectable bit |
5 | A0 | Address pin 0, selectable bit |
6 | GND | Ground reference for the power supply |
7 | OS | Overtemperature Shutdown output |
8 | Vcc | Supply voltage |
#include <Wire.h>
// LM75 I2C address (depends on A2, A1, A0 pin status)
const int LM75_Address = 0x48;
void setup() {
Wire.begin(); // Initialize I2C
Serial.begin(9600); // Start serial communication at 9600 baud
}
void loop() {
Wire.beginTransmission(LM75_Address); // Start communication with LM75
Wire.write(0x00); // Select temperature register
Wire.endTransmission();
Wire.requestFrom(LM75_Address, 2); // Request 2 bytes from the temperature register
if(Wire.available() == 2) {
int tempRaw = Wire.read() << 8 | Wire.read(); // Read the two bytes
float temperature = tempRaw / 256.0; // Convert to temperature
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" C");
}
delay(1000); // Wait for 1 second before reading again
}
Q: Can I use multiple LM75 sensors on the same I2C bus? A: Yes, you can set different addresses for each LM75 by configuring the A2, A1, and A0 pins.
Q: What is the purpose of the OS pin? A: The OS pin is an overtemperature shutdown output that can be used to signal a microcontroller or other circuitry when the temperature exceeds a programmed threshold.
Q: How do I set the high and low temperature limits? A: You can program the high and low temperature limits by writing to the respective registers in the LM75 via the I2C interface. Refer to the LM75 datasheet for detailed register descriptions and programming instructions.