Raspberry Pi and DS1624 temperature sensor

The DS1624 consists of two separate functional units: a 256-byte nonvolatile E2 memory and a direct-to-digital temperature sensor.

The nonvolatile memory is made up of 256 bytes of E2 memory. This memory can be used to store any type of information the user wishes. These memory locations are accessed through the 2-wire serial bus.

The direct-to-digital temperature sensor allows the DS1624 to measure the ambient temperature and report the temperature in a 12-bit word with 0.0625°C resolution. The temperature sensor and its related registers are accessed through the 2-wire serial interface. Figure 1 in the full data sheet shows a block diagram of the DS1624.

Features

Reduces Component Count with Integrated Temperature Sensor and Nonvolatile E2 Memory
Measures Temperatures from -55°C to +125°C in 0.0625°C Increments
±0.5°C Accuracy from 0°C to 70°C
256 Bytes of E2 Memory for Storing Information Such as Frequency Compensation Coefficients
No External Components
Easy-to-Use 2-Wire Serial Interface
Temperature is Read as a 12-Bit Value (2-Byte Transfer)
Available in 8-Pin SO and DIP Packages

 

Connection

Module Raspberry Pi
VDD 3v3
Gnd Gnd
SDA SDA – GPIO2
SCL SCL – GPIO3

 

Code

This is an example I put together, its a bit glitchy but you can use it to get started

import smbus
import time
# Get I2C bus
bus = smbus.SMBus(1)
DS1624_READ_TEMP = 0xAA
DS1624_START = 0xEE
DS1624_STOP = 0x22
DS1624_MEMORY = 0xAC
DS1624_CONFIG = 0x17
DS1624_ADDRESS = 0x48
class DS1624():
def init(self):
config = bus.read_byte_data(DS1624_ADDRESS, DS1624_CONFIG)
config = config | 0b00000001
bus.write_byte_data(DS1624_ADDRESS, DS1624_CONFIG, config)
def start(self):
bus.write_byte(DS1624_ADDRESS, DS1624_START)
def read_sensor(self):
raw = bus.read_word_data(DS1624_ADDRESS, DS1624_READ_TEMP)
temp_integer = raw & 0x00FF
if temp_integer > 127:
temp_integer = temp_integer - 256
temp_fractional = (raw >> 12) * 0.0625
return temp_integer + temp_fractional
from DS1624 import DS1624
ds1624 = DS1624()
while True :
ds1624.start()
time.sleep(1)
print "1624: %02.02fC" % ds1624.read_sensor()
time.sleep(1)

Testing

 

Link

https://datasheets.maximintegrated.com/en/ds/DS1624.pdf

CJMCU-1624 DS1624 temperature sensor, high precision digital thermometer with memory function

SHARE
Previous articleMMA7660FC accelerometer and Raspberry pi example
Next articleTMP102 sensor and Raspberry Pi python example