Raspberry Pi LM75BIMM Temperature Sensor Python Tutorial

by Dcube Tech Ventures in Circuits > Electronics

21 Views, 0 Favorites, 0 Comments

Raspberry Pi LM75BIMM Temperature Sensor Python Tutorial

Raspberry Pi LM75BIMM  Temperature Sensor Python Tutorial

LM75BIMM is a digital temperature sensor incorporated with thermal watchdog and has two wire interface which supports its operation upto 400 kHz. It has an over temperature output with programmable limit and hystersis. Here is the demonstration with a java code using Raspberry Pi.

What You Need..!!

LM75BIMM_I2CS_A_1.png
pi.jpg

1. Raspberry Pi

2. LM75BIMM

3. I²C Cable

4. I²C Shield for Raspberry Pi

5. Ethernet Cable

Connections

LM75BIMM_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 LM75BIMM 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 LM75BIMM can be downloaded from our github repository- Dcube Store

Here is the link for the same :

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

# LM75BIMM

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

import smbus

import time

# Get I2C bus

bus = smbus.SMBus(1)

# LM75BIMM address, 0x49(73)

# Select configuration register, 0x01(01)

# 0x00(00) Continous conversion, Normal operation

bus.write_byte_data(0x49, 0x01, 0x00)

time.sleep(0.5)

# LM75BIMM address, 0x49(73)

# Read data back from 0x00(0), 2 bytes

# Temp MSB, Temp LSB

data = bus.read_i2c_block_data(0x49, 0x00, 2)

# Convert the data to 9-bits

cTemp = (data[0] * 256 + (data[1] & 0x80)) / 128

if cTemp > 255 :

cTemp -= 512cTemp = cTemp * 0.5

fTemp = cTemp * 1.8 + 32

# Output data to screen

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

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

Applications..:

LM75BIMM is ideal for a number of applications including base stations, electronic test equipment, office electronics, personal computers or any other system where temperature monitoring is critical to performance. Therefore, this sensor has a pivotal role in many of the highly temperature sensitive systems.