Raspberry Pi - AD7416ARZ 10-Bit Temperature Sensor Python Tutorial
by Dcube Tech Ventures in Circuits > Electronics
21 Views, 0 Favorites, 0 Comments
Raspberry Pi - AD7416ARZ 10-Bit Temperature Sensor Python Tutorial
AD7416ARZ is 10-Bit temperature sensor with four single channel analog to digital convertors and an on board temperature sensor incorporated in it. The temperature sensor on the parts can be accessed via multiplexer channels. This high-accuracy temperature sensor has become an industry standard in terms of form, factor and intelligence, providing calibrated, linearized sensor signals in digital, I2C format. 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 AD7416ARZ 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 AD7416ARZ can be downloaded from our GitHub repository- Dcube Store.
Here is the link for the same :
https://github.com/DcubeTechVentures/AD7416ARZ..
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.
# AD7416ARZ
# This code is designed to work with the AD7416ARZ_I2CS I2C Mini Module available in Dcube Store.
import smbus
import time
# Get I2C bus
bus = smbus.SMBus(1)
# AD7416ARZ address, 0x48(72)
# Read data back fom 0x00(00), 2 bytes
# temp MSB, temp LSB
data = bus.read_i2c_block_data(0x48, 0x00, 2)
# Convert the data to 10-bits
temp = ((data[0] * 256) + (data[1] & 0xC0)) / 64
if temp > 511 :
temp -= 1024
cTemp = temp * 0.25
fTemp = cTemp * 1.8 + 32
# Output data to screen
print "Temperature in Celsius : %.2f C" %cTemp
print "Temperature in Fahrenheit : %.2f F" %fTemp
Applications:
AD7416ARZ is a 10-Bit Temperature sensor with four single channel analog to digital converter can perform the operation of Data acquisition with ambient temperature monitoring. It can also be employed in Industrial process control systems, Automotive Battery-charging applications and Personal computers.