Interfacing BMP180 I2C Temperature and Pressure Sensor with Odinub

Hello Everyone! In this tutorial, we will see how to interface BMP180 with Odinub. 

The BMP180 device is a digital barometric pressure sensor. This is accessible on a small module that provides access to the sensor via the I2C interface. This allows us to easily interface it to the Odinub with a minimum of wiring. The ultra-low power consumption down to 3 μA makes the BMP180 the leader in power saving for your mobile devices.

In contrast to the DHT11 / DHT22, the BMP180 cannot measure humidity, but the air pressure, which in turn cannot be estimated by the other two sensors. Yet, both can likewise measure the temperature.

This board is 5V compliant - a 3.3V regulator and an i2c level shifter circuit is incorporated so you can use this sensor safely with 5V logic and power. The BMP180 is the next-generation of sensors from Bosch and replaces the BMP085. It is completely identical to the BMP085 in terms of firmware/software.

What is I2C?

I2C is a communication protocol that the Odinub can use to speak to other embedded devices.  In this tutorial, we'll be interfacing a BMP180 Temperature/Pressure Sensor to our Odinub. 

I2C combines the best features of SPI and UARTs. With I2C, you can interface different slaves to a single master (like SPI) and you can have multiple masters controlling single, or multiple slaves. This is really useful when you want to have more than one microcontroller logging data to a single memory card or displaying text to a single LCD. With I2C, every device has an address that each communication must be prefaced with.

Like UART communication, I2C only uses two wires to transmit data between devices:

SDA (Serial Data) – The line for the master and slave to send and receive data.

SCL (Serial Clock) – The line that carries the clock signal.

With I2C, data is transferred in messages. Messages are broken up into frames of data. Each message has an address frame that contains the binary address of the slave, and one or more data frames that contain the data being transmitted.

Components Required:

Odinub Board

Odinub Converter

BMP180

Jumper wires

Hardware Connection:

Here is the connection diagram.

The table below shows how the module is connected to Odinub's GPIO header.

VIN        -              3.3v(1/3) 

GND      -              GND(6/8)

SCL         -              12-I2C_SCL

SDA        -              10-I2C_SDA

Reading values from BMP180

Firstly, we have to set up, the WIFI on your Odinub board.

For that, you have to open the terminal and fire the below command.  

if wlan0

If you guys are facing any issue to connect the WIFI on Board visit blog.

To check that whether your WIFI is connected to your network fire the command 

ping google.com

Now we'll need to install some utilities for the Odinub to communicate over I2C inside of Python.

sudo apt-get install build-essential python-dev python-smbus

The below command is used to clone the repository of Adafruit.

Now you have to go to that directory.

cd Adafruit_Python_BMP

sudo python setup.py install

Now you are ready to use the BMP180. 

Next step is to write code into a Python script and run it. For that, you can use your favourite editor to write the code. Here I am using nano editor.

sudo nano <Your_File>.py

Let's examine the code. Remember that the BMP085 is compatible with the BMP180. The library refers to the BMP085.

import Adafruit_BMP.BMP085 as BMP085

sensor = BMP085.BMP085()

temp = sensor.read_temperature()

pressure = sensor.read_pressure()

print 'Temp = {0:0.2f} *C'.format(temp)

print 'Pressure = {0:0.2f} Pa'.format(pressure)

 

And that's it! Now you can run your python file. Fire the below command into your Odinub terminal.

sudo python <Your_File>.py

You can see the output image below

Now you can include this little sensor into your own projects and make simple but interesting applications.

The output looks something like this:

I Hope this project helps you to make a more interesting project!

If you guys are facing any problem comment below in the comment section...!

Code :
Code Title :
Code Language :
Python
0 Commenting Overall Comment