Introduction: Measurement of Temperature Using AD7416ARZ and Raspberry Pi

About: We are a group of makers. We work in IoT, IOS app, android app, embedded design, sensor design, raspberry pi, arduino, beaglebone, particle electron, particle photon, Bluetooth.

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.

In this tutorial the interfacing of the AD7416ARZ sensor module with raspberry pi is demonstrated and its programming using python language has also been illustrated. To read the temperature values, we have used raspberry pi with an I2C adapter.This I2C adapter makes the connection to the sensor module easy and more reliable.

Step 1: Hardware Required:

The materials that we need for accomplishing our goal includes the following hardware components:

1. AD7416ARZ

2. Raspberry Pi

3. I2C Cable

4. I2C Shield for raspberry pi

5. Ethernet Cable

Step 2: Hardware Hookup:

The hardware hookup section basically explains the wiring connections required between the sensor and the raspberry pi. Ensuring correct connections is the basic necessity while working on any system for the desired output. So, the requisite connections are as follows:

The AD7416ARZ will work over I2C . Here is the example wiring diagram, demonstrating how to wire up each interface of the sensor.

Out-of-the-box, the board is configured for an I2C interface, as such we recommend using this hookup if you’re otherwise agnostic.

All you need is four wires! Only four connections are required Vcc, Gnd, SCL and SDA pins and these are connected with the help of I2C cable.

These connections are demonstrated in the pictures above.

Step 3: Code for Measurement of Temperature:

The advantage of using raspberry pi is, that is provides you the flexibility of the programming language in which you want to program the board in order to interface the sensor with it. Harnessing this advantage of this board, we are demonstrating here its programming in the python. The python code for AD7416ARZ can be downloaded from our github community that is Control Everything Community.

As well as for the ease of the users, we are explaining the code here also:

As the first step of coding you need to download the smbus library in case of python, because this library supports the functions used in the code. So, to download the library you can visit the following link:

https://pypi.python.org/pypi/smbus-cffi/0.5.1

You can copy the working python code for this sensor from here also:

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

The part of code mentioned below includes the libraries required for the correct execution of the python codes.

import smbus

import time

The code can be executed by typing the below mentioned command in the command prompt.

 $> python AD7416ARZ.py

The output of the sensor is also shown in the picture above for the reference of the user.

Step 4: 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.