Raspberry Pi Pico and BMP180 Sensor
by Ramatronics Laboratory in Circuits > Sensors
3233 Views, 2 Favorites, 0 Comments
Raspberry Pi Pico and BMP180 Sensor
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.
Downloads
Supplies
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
BMP180 Sensor
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
Raspberry Pi Pico
Bread Board
BMP180 Sensor
Jumper Wires
Micro-B USB Cable
Downloading the BMP180 Micro Python Module
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
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
- Connect the VCC pin of the BMP180 sensor to the VBUS pin(pin 40 of the pico board) of the raspberry pi pico board.
- 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.
- Connect the SCL(Serial Clock) pin of the BMP180 sensor to the Pin-2 (GPIO-1)of the pico board.
- 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
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