The DS1621 is a digital temperature sensor and thermostat integrated circuit (IC) that provides high-accuracy temperature readings over a range of -55°C to +125°C. It communicates via a two-wire serial interface, making it compatible with most microcontrollers, including the Arduino platform. The DS1621 is commonly used in environmental control systems, computer thermal monitoring, and any application requiring precise temperature readings.
Pin Number | Name | Description |
---|---|---|
1 | GND | Ground pin, connected to system ground |
2 | DQ | Serial data pin, used for two-wire serial communication |
3 | SCL | Serial clock pin, used to synchronize data transfer |
4 | VDD | Supply voltage pin, connected to 2.7V to 5.5V |
#include <Wire.h>
// DS1621 I2C address
#define DS1621_ADDR 0x48
// DS1621 Commands
#define START_CONVERT 0xEE
#define READ_TEMP 0xAA
void setup() {
Wire.begin(); // Initialize I2C
Serial.begin(9600); // Start serial communication at 9600 baud
// Start temperature conversion
Wire.beginTransmission(DS1621_ADDR);
Wire.write(START_CONVERT);
Wire.endTransmission();
}
void loop() {
int8_t msb, lsb;
float temperature;
// Request temperature reading
Wire.beginTransmission(DS1621_ADDR);
Wire.write(READ_TEMP);
Wire.endTransmission();
// Read 2 bytes of temperature data
Wire.requestFrom(DS1621_ADDR, 2);
if (Wire.available() == 2) {
msb = Wire.read(); // Read first byte (MSB)
lsb = Wire.read(); // Read second byte (LSB)
temperature = msb + (lsb >> 7) * 0.5; // Calculate temperature
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" C");
}
delay(1000); // Wait for 1 second before reading again
}
Q: Can the DS1621 be used with 3.3V systems? A: Yes, the DS1621 operates between 2.7V and 5.5V, making it suitable for both 5V and 3.3V systems.
Q: How can I change the resolution of the temperature readings? A: The resolution can be adjusted by writing to the configuration register of the DS1621. Refer to the datasheet for detailed instructions.
Q: Is it necessary to calibrate the DS1621? A: The DS1621 is factory-calibrated for accuracy and typically does not require additional calibration.
Q: How long does it take for the DS1621 to provide a temperature reading? A: The conversion time depends on the resolution setting, ranging from 1 second (9-bit) to 8 seconds (12-bit).