Skip to main content

ЁЯМб️ Interfacing BMP180 Pressure & Temperature Sensor with Raspberry Pi 3

ЁЯФ╣ Overview

The BMP180 is a sensor that measures atmospheric pressure and temperature. It is commonly used in weather stations, altitude measurement, and IoT projects. In this tutorial, we will interface the BMP180 sensor with Raspberry Pi 3 and display the readings.


ЁЯЫа️ Components Required

✔️ Raspberry Pi 3
✔️ BMP180 Sensor
✔️ Breadboard & Jumper Wires


ЁЯФМ Circuit Diagram

The BMP180 communicates with the Raspberry Pi using the I2C protocol.

ЁЯФЧ BMP180 to Raspberry Pi Connections   

BMP180 PinConnection
VCC3.3V (Raspberry Pi)
GNDGND
SDAGPIO 2 (I2C SDA)
SCLGPIO 3 (I2C SCL)

ЁЯУЬ Python Code to Read BMP180 Sensor

Save the following Python script as bmp180_sensor.py and run it on Raspberry Pi.

python
import smbus import time # BMP180 Default Address BMP180_ADDR = 0x77 # Open I2C bus bus = smbus.SMBus(1) def read_temperature(): bus.write_byte_data(BMP180_ADDR, 0xF4, 0x2E) time.sleep(0.005) temp_msb = bus.read_byte_data(BMP180_ADDR, 0xF6) temp_lsb = bus.read_byte_data(BMP180_ADDR, 0xF7) temp = ((temp_msb << 8) + temp_lsb) / 340.0 + 36.53 return round(temp, 2) try: while True: temperature = read_temperature() print("Temperature:", temperature, "°C") time.sleep(2) except KeyboardInterrupt: print("\nProgram stopped.")

ЁЯТб How It Works

  1. The BMP180 sensor uses the I2C protocol to communicate with the Raspberry Pi.
  2. The Python script sends commands to the sensor and reads the temperature values.
  3. The sensor returns the temperature data, which is displayed on the screen.

ЁЯОп Applications

✅ Weather stations
✅ Altitude measurement
✅ IoT-based climate monitoring


ЁЯУЭ рдорд░ाрдаीрдд рд╕рдордЬाрд╡рдгी (Marathi Explanation)

ЁЯФ╣ рдкрд░िрдЪрдп

BMP180 рд╕ेрди्рд╕рд░ рд╣ा рд╣рд╡ाрдоाрдиाрдЪा рджाрдм (Pressure) рдЖрдгि рддाрдкрдоाрди (Temperature) рдоोрдЬрдг्рдпाрд╕ाрдаी рд╡ाрдкрд░рд▓ा рдЬाрддो. рдпाрдЪा рдЙрдкрдпोрдЧ рд╣рд╡ाрдоाрди рдХेंрдж्рд░े, IoT рдк्рд░рдХрд▓्рдк рдЖрдгि рдЙंрдЪी рдоोрдЬрдг्рдпाрд╕ाрдаी рдХेрд▓ा рдЬाрддो.


ЁЯЫа️ рдЖрд╡рд╢्рдпрдХ рдШрдЯрдХ

✔️ рд░ाрд╕्рдкрдмेрд░ी рдкाрдп рей
✔️ BMP180 рд╕ेрди्рд╕рд░
✔️ рдм्рд░ेрдбрдмोрд░्рдб рдЖрдгि рдЬрдо्рдкрд░ рд╡ाрдпрд░


ЁЯФМ рд╕рд░्рдХिрдЯ рдХрдиेрдХ्рд╢рди

BMP180 рд╕ेрди्рд╕рд░ I2C рдк्рд░ोрдЯोрдХॉрд▓ рд╡ाрдкрд░рддो.

BMP180 рдкिрдирд░ाрд╕्рдкрдмेрд░ी рдкाрдп рдХрдиेрдХ्рд╢рди
VCC3.3V
GNDGND
SDAGPIO 2 (I2C SDA)
SCLGPIO 3 (I2C SCL)

ЁЯУЬ рдкाрдпрдеॉрди рдХोрдб

рд╣ा рдХोрдб bmp180_sensor.py рдиाрд╡ाрдиे рд╕ेрд╡्рд╣ рдХрд░ा рдЖрдгि рдЪाрд▓рд╡ा.

python
import smbus import time BMP180_ADDR = 0x77 bus = smbus.SMBus(1) def read_temperature(): bus.write_byte_data(BMP180_ADDR, 0xF4, 0x2E) time.sleep(0.005) temp_msb = bus.read_byte_data(BMP180_ADDR, 0xF6) temp_lsb = bus.read_byte_data(BMP180_ADDR, 0xF7) temp = ((temp_msb << 8) + temp_lsb) / 340.0 + 36.53 return round(temp, 2) try: while True: temperature = read_temperature() print("рддाрдкрдоाрди:", temperature, "°C") time.sleep(2) except KeyboardInterrupt: print("\nрдк्рд░ोрдЧ्рд░ॅрдо рдеांрдмрд▓ा.")

ЁЯТб рд╣े рдХрд╕े рдХाрд░्рдп рдХрд░рддे?

  1. BMP180 рд╕ेрди्рд╕рд░ I2C рдк्рд░ोрдЯोрдХॉрд▓ рд╡ाрдкрд░ूрди рд░ाрд╕्рдкрдмेрд░ी рдкाрдпрд╢ी рд╕ंрд╡ाрдж рд╕ाрдзрддो.
  2. рдкाрдпрдеॉрди рдХोрдб рд╕ेрди्рд╕рд░рд▓ा рдХрдоांрдб рдкाрдард╡рддो рдЖрдгि рддाрдкрдоाрди рд╡ाрдЪрддो.
  3. рд╕ेрди्рд╕рд░ рдбेрдЯा рд╕्рдХ्рд░ीрдирд╡рд░ рдк्рд░рджрд░्рд╢िрдд рдХрд░рддो.

ЁЯОп рдЙрдкрдпोрдЧ

✅ рд╣рд╡ाрдоाрди рдХेंрдж्рд░े
✅ рдЙंрдЪी рдоोрдЬрдгी (Altitude Measurement)
✅ IoT-рдЖрдзाрд░िрдд рддाрдкрдоाрди рдиिрд░ीрдХ्рд╖рдг


Comments

Popular posts from this blog

Interfacing Load Cell with Raspberry Pi 3 (via HX711) ⚖️

Interfacing Load Cell with Raspberry Pi 3 (via HX711) ⚖️ Interfacing Load Cell with Raspberry Pi 3 (via HX711) ⚖️ A load cell is a transducer that converts force (weight) into an electrical signal. The HX711 is a precision 24-bit analog-to-digital converter (ADC) designed for weigh scales. Today we’ll connect a load cell to Raspberry Pi 3 using the HX711 module. ЁЯзк ЁЯФз Components Required Component Quantity Raspberry Pi 3 1 Load Cell 1 HX711 Module 1 Jumper Wires 6 Breadboard (optional) 1 ЁЯФМ Pin Connections HX711 Pin Raspberry Pi Pin Pin Number VCC 5V Pin 2 GND Ground Pin 6 DT GPIO 5 Pin 29 SCK GPIO 6 Pin 31 Figure: Load Cell connected to Raspberry Pi 3 via HX711 ЁЯТ╗ Python Code from hx711 import HX711 import RPi.GPIO as GPIO import time hx = HX711(dout_pin=5, pd_sck_pin=6) hx.set_reading_format("MSB", "MSB") hx.set_reference_unit(1) hx.reset()...

Interfacing Sound Sensor with Raspberry Pi 3

ЁЯФ╣ Overview The KY-037 is a high-sensitivity sound detection sensor that can detect noise levels in the environment. It provides both analog and digital outputs. In this tutorial, we’ll interface the digital output of KY-037 with Raspberry Pi 3 Model B+ (without using an ADC like MCP3008) and detect sound events.

Interfacing Water Flow Sensor with Raspberry Pi 3 ЁЯЪ┐

Interfacing Water Flow Sensor with Raspberry Pi 3 ЁЯЪ┐ ЁЯОп Objective To measure the flow rate of water using a Water Flow Sensor (YF-S201) and Raspberry Pi 3. Useful in smart irrigation and water management systems. ЁЯз░ Components Required Component Quantity Raspberry Pi 3 1 YF-S201 Water Flow Sensor 1 10K Pull-down Resistor 1 Jumper Wires As required Breadboard 1 ⚡ Circuit Connections Sensor Pin Connect To Red (VCC) 5V (Raspberry Pi) Black (GND) GND (Raspberry Pi) Yellow (Pulse Out) GPIO18 (Pin 12) with pull-down resistor ЁЯза Python Code import RPi.GPIO as GPIO import time FLOW_SENSOR = 18 pulse_count = 0 def countPulse(channel): global pulse_count pulse_count += 1 GPIO.setmode(GPIO.BCM) GPIO.setup(FLOW_SENSOR, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) GPIO.add_event_detect(FLOW_SENSOR, GPIO.FALLING, callback=countPulse) try: while True: pulse_count = 0 time.sleep(1) flow_rate = (pulse_count / 7.5) ...