Raspberry Pi ADT75 Temperature Sensor Python Tutorial
by Dcube Tech Ventures in Circuits > Electronics
65 Views, 0 Favorites, 0 Comments
Raspberry Pi ADT75 Temperature Sensor Python Tutorial

ADT75 is a highly accurate, digital temperature sensor. It comprises of a band gap temperature sensor and a 12-bit analog to digital converter for monitoring and digitizing the temperature. Its highly sensitive sensor makes it competent enough to measure the ambient temperature accurately. Here is the demonstration with a python code using Raspberry Pi.
What You Need..!!


Connection:




Take a I2C shield for raspberry pi and gently push it over the gpio pins of raspberry pi.
Then connect the one end of I2C cable to ADT75 sensor and the other end to the I2C shield.
Also connect the Ethernet cable to the pi or you can use a WiFi module.
Connections are shown in the picture above.
Code:

The python code for ADT75 can be downloaded from our GitHub repository- Dcube Store
Here is the link for the same :
https://github.com/DcubeTechVentures/ADT75/blob/master/Python/ADT75.py
We have used SMBus library for python code, the steps to install SMBus on raspberry pi is described here:
https://pypi.python.org/pypi/smbus-cffi/0.5.1
You can also copy the code from here, it is given as follows:
# Distributed with a free-will license.
# Use it any way you want, profit or free, provided it fits in the licenses of its associated works.
# ADT75
# This code is designed to work with the ADT75_I2CS I2C Mini Module
import smbus
import time
# Get I2C bus
bus = smbus.SMBus(1)
# ADT75 address, 0x48(72)
# Read data back from 0x00(00), 2 bytes
# temp MSB, temp LSB
data = bus.read_i2c_block_data(0x48, 0x00, 2)
# Convert the datato 12-bits
temp = ((data[0] * 256) + data[1]) / 16
if temp > 2047 :
temp -= 4096
cTemp = temp * 0.0625
fTemp = (cTemp * 1.8) + 32
# Output data to screen
print "Temperature in Celsius : %.2f C" %cTemp
print "Temperature in Fahrenheit : %.2f F" %fTemp
Applications:
ADT75 is a highly accurate, digital temperature sensor. It can be employed in a wide range of systems including environmental control systems, computer thermal monitoring etc. It can also be incorporated in industrial process controls as well as power system monitors.