Raspberry Pi Pico and BMP180 Sensor

by Ramatronics Laboratory in Circuits > Sensors

3233 Views, 2 Favorites, 0 Comments

Raspberry Pi Pico and BMP180 Sensor

WhatsApp Image 2023-04-16 at 12.46.36 PM.jpeg
22_page-0001.jpg

INTRODUCTION:

In this instructables, I am going to interface BMP180 temperature and pressure sensor to raspberry pi pico. BMP180 sensor support I2C Serial communication protocol so it can be easily interfaced with any microcontroller chip that supports I2C serial communication protocol. BMP180 Temperature sensor can measure Temperature, Pressure and Altitude. So let's get started.




Supplies

WhatsApp Image 2023-04-16 at 12.46.33 PM.jpeg
WhatsApp Image 2023-04-16 at 12.46.32 PM.jpeg
WhatsApp Image 2023-04-16 at 12.46.28 PM.jpeg

List of Electronic Hardware:



https://quartzcomponents.com?sca_ref=3671286.DzEptz4I3w

Raspberry Pi Pico

https://quartzcomponents.com/products/raspberry-pi-pico?_pos=2&_sid=509808da5&_ss=r

Bread Board

https://quartzcomponents.com/products/colored-breadboard-mb-102-830-point?_pos=2&_sid=13bb6826e&_ss=r

BMP180 Sensor

https://quartzcomponents.com/products/gy-68-bmp180-digital-barometric-pressure-sensor-board-module?_pos=1&_sid=06556b106&_ss=r

Jumper Wires

https://quartzcomponents.com/products/65pcs-breadboard-jumper-cable?_pos=8&_sid=81851947d&_ss=r

Micro-B USB Cable

https://quartzcomponents.com/products/raspberry-pi-cable-for-charging?_pos=1&_sid=f1874a182&_ss=r


https://www.amazon.in/

Raspberry Pi Pico

https://www.amazon.in/Raspberry-Pi-Pico-Microcontroller-Board/dp/B08PC3BV33/ref=sr_1_1?crid=J6267VPUUNO3&keywords=Raspberry+pi+pico&qid=1681616073&sprefix=raspberry+pi+pico%2Caps%2C265&sr=8-1

Bread Board

https://www.amazon.in/OLatus-Ol-Breadboard-Gl-Points-Solderless-Circuit/dp/B06XZ54VTN/ref=sr_1_2_sspa?crid=35N1QZTBY1PRL&keywords=Bread+board&qid=1681616100&sprefix=bread+boar%2Caps%2C379&sr=8-2-spons&sp_csd=d2lkZ2V0TmFtZT1zcF9hdGY&psc=1

BMP180 Sensor

https://www.amazon.in/Digital-Barometric-Pressure-compatible-Raspberry/dp/B0BZQ6XX8D/ref=sr_1_1_sspa?crid=14DC8S9LXTAPB&keywords=bmp180&qid=1681616127&sprefix=bmp180%2Caps%2C269&sr=8-1-spons&sp_csd=d2lkZ2V0TmFtZT1zcF9hdGY&psc=1

Jumper Wires

https://www.amazon.in/INVENTO-Solderless-Flexible-Breadboard-Arduino/dp/B07PGHD2M8/ref=sr_1_37?crid=18XC9WM72MN5S&keywords=jumper+wires&qid=1681616446&sprefix=jumper+wires%2Caps%2C283&sr=8-37

Micro-B USB Cable

https://www.amazon.in/Solero-MB301-Charging-480Mbps-1-5-Meter/dp/B08Y1SJVV5/ref=sr_1_11_sspa?crid=3GKTIHS8DHUH5&keywords=micro%2Bb%2Bcable&qid=1681616220&sprefix=micro%2Bb%2Caps%2C277&sr=8-11-spons&sp_csd=d2lkZ2V0TmFtZT1zcF9tdGY&th=1

Downloading the BMP180 Micro Python Module

Screenshot 2023-04-16 130629.png

You can download the Micro python driver for BMP180 from my GitHub repository. The link is given below:

https://github.com/ramjipatel041/Raspberry-Pi-Pico-and-BMP180


Making a Prototype Circuit on Bread Board

Raspberry pi pico and BMP180_bb.jpg
WhatsApp Image 2023-04-16 at 12.46.38 PM.jpeg
WhatsApp Image 2023-04-16 at 12.46.26 PM.jpeg
WhatsApp Image 2023-04-16 at 12.46.28 PM.jpeg
WhatsApp Image 2023-04-16 at 12.46.30 PM.jpeg
WhatsApp Image 2023-04-16 at 12.46.32 PM.jpeg
WhatsApp Image 2023-04-16 at 12.46.00 PM.jpeg

For making a prototype circuit on a bread board, first fix the raspberry pi pico board on the bread board as shown in the image. Then also fix the BMP180 sensor on the bread board. Now connect the BMP180 sensor to the pico board using jumper wires. Connect the four jumpers according to given points

  1. Connect the VCC pin of the BMP180 sensor to the VBUS pin(pin 40 of the pico board) of the raspberry pi pico board.
  2. Connect the GND pin of the BMP180 sensor to any GND pin of the raspberry pi pico board. In my case I am connecting it to Pin-38 of the pico board.
  3. Connect the SCL(Serial Clock) pin of the BMP180 sensor to the Pin-2 (GPIO-1)of the pico board.
  4. Connect the SDA(Serial Data) pin of the BMP180 sensor to the Pin-1(GPIO-0) of the pico board.

Writing Main Micro Python Script

Screenshot 2023-04-16 130244.png

To run the micro python script click on the run option. Now you will be able to see the values of temperature and pressure in the shell area.

from machine import Pin, I2C
from bmp085 import BMP180
import time

i2c = I2C(0, sda = Pin(0), scl = Pin(1), freq = 1000) #i2c detains

bmp = BMP180(i2c)
bmp.oversample = 2
bmp.sealevel = 101325

while True: 
  tempC = bmp.temperature    #get the temperature in degree celsius
  pres_hPa = bmp.pressure    #get the pressure in hpa
  altitude = bmp.altitude    #get the altitude
  temp_f= (tempC * (9/5) + 32)  #convert the temperature value in fahrenheit
  print(str(tempC)+"°C " +str(temp_f)+"°F " + str(pres_hPa)+"hPa "+ str(altitude))
  time.sleep_ms(100)  #delay of 100 milliseconds


Run the Main Program Script

Screenshot 2023-04-16 130036.png
WhatsApp Image 2023-04-16 at 12.46.37 PM.jpeg
WhatsApp Image 2023-04-16 at 12.46.36 PM.jpeg
WhatsApp Image 2023-04-16 at 12.46.35 PM.jpeg
WhatsApp Image 2023-04-16 at 12.46.38 PM.jpeg