This is an old revision of the document!


BMP180 dual-purpose sensor

esp32-bmp180.jpg

This dual-purpose sensor is used to measure temperature and barometric pressure. It operates as an I2C slave device.

The actual sensor is tiny but a board is available from China with the I2C connections and power on a standard 0.1 inch header which makes it easily accessible.

Micropython

Setup

sudo apt-get install picocom
sudo pip3 install mpfshell

Detect

picocom -b 115200 /dev/ttyUSB0
from machine import Pin, I2C
i2c = I2C(scl=Pin(22), sda=Pin(21), freq=100000)
i2c.scan()
[119]

Install

wget https://raw.githubusercontent.com/micropython-IMU/micropython-bmp180/master/bmp180.py
mpfshell --nocolor -no ttyUSB0 -c put bmp180.py
Connected to esp32
mpfshell --nocolor -no ttyUSB0 -c ls
Connected to esp32

Remote files in '/':

       bmp180.py
       boot.py

Run

picocom -b 115200 /dev/ttyUSB0
from machine import Pin, I2C
i2c = I2C(scl=Pin(22), sda=Pin(21), freq=100000)
from bmp180 import BMP180
bmp180 = BMP180(i2c)
print (bmp180.temperature)
26.95987

Resources

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies