Raspberry Pi SI7050 Temperature Sensor Python Tutorial

by Dcube Tech Ventures in Circuits > Electronics

54 Views, 0 Favorites, 0 Comments

Raspberry Pi SI7050 Temperature Sensor Python Tutorial

Raspberry Pi SI7050 Temperature Sensor Python Tutorial

SI7050 is a digital temperature sensor which works on I2C communication protocol and offers high accuracy over the entire operating voltage and temperature range. This high accuracy of the sensor is attributed by the novel signal processing and analog design. These sensors are embedded with an on-chip memory which stores the callibration data which facilitates its usage over a wide range. Here is its demonstration with Raspberry Pi using python code.

What You Need..!!

SI7050_I2CS_A_1 .png
pi.jpg

1. Raspberry Pi

2. SI7050

3. I²C Cable

4. I²C Shield for Raspberry Pi

5. Ethernet Cable

Connection:

SI7050_I2CS_A_1 .png
pi.jpg
sensor.jpg
complete_connection.jpg

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 SI7050 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:

complete_connection.jpg

The python code for SI7050 can be downloaded from our github repository- DCUBE Store Community.

Here is the link for the same :

https://github.com/DcubeTechVentures/SI7050/blob/master/Python/SI7050.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.

# SI7050

# This code is designed to work with the SI7050_I2CS I2C Mini Module .

import smbus

import time

# Get I2C busbus = smbus.SMBus(1)

# SI7050 address, 0x40(64)

# 0xF3(243) Select temperature NO HOLD MASTER mode

bus.write_byte(0x40, 0xF3)

time.sleep(0.5)

# SI7050 address, 0x40(64)

# Read data back, 2 bytes, MSB first

data0 = bus.read_byte(0x40)

data1 = bus.read_byte(0x40)

# Convert the data

cTemp = (175.72 * (data0 * 256.0 + data1) / 65536.0) - 46.85

fTemp = cTemp * 1.8 + 32

# Output data to screen

print "Temperature in Celsius : %.2f C" %cTemp

print "Temperature in Fahrenheit : %.2f F" %fTemp

Applications:

SI7050 can be incorporated in various systems including computer equipments, portable consumer devices and medical equipments. This sensor can be employed in cold storage chains, asset tracking as well as various industrial control systems. It plays a pivotal role in battery protection too.