BMP180 Barometric Altimeter
Measure your floor's elevation to the metre with a $3 pressure sensor and an ESP32.
Difficulty: Breadboard. Estimated build time: about 60 minutes. Estimated parts cost: about US$8.50. 6-line bill of materials. Compare supplier offers when available. A self-contained barometric altimeter that reads atmospheric pressure with millibar resolution and prints the result as both pressure (hPa) and altitude (metres above sea level) on a small OLED screen.
Wire the BMP180 breakout to the ESP32
Most BMP180 breakouts (GY-68) have six pins: VCC, GND, SCL, SDA, 3V3, and XCLR. Connect VCC to the ESP32's 3.3 V pin (do NOT use 5 V — the BMP180 is 3.3 V tolerant only), GND to GND, SDA to ESP32 GPIO 21, and SCL to GPIO 22 (the default I²C pins on most ESP32 dev kits). Leave XCLR floating; it's a reset pin that pulls itself high inside the chip.
Wire the SSD1306 OLED on the same I²C bus
The big win of I²C is that you can share the bus across many devices. Wire the SSD1306 OLED's VCC and GND to 3.3 V/GND, then run its SCL and SDA to the same ESP32 GPIO 22 and 21 pins the BMP180 is already using. The two devices have different I²C addresses (BMP180 is 0x77; SSD1306 is 0x3C or 0x3D), so the master can talk to each one without confusing them. A single set of 4.7 kΩ pull-ups on SCL/SDA covers both.
Install the libraries and verify both devices answer on the bus
In the Arduino IDE Library Manager, install "Adafruit BMP085 Unified" (the BMP085 and BMP180 share a driver) and "Adafruit SSD1306" plus "Adafruit GFX." Run the I²C scanner sketch from the ESP32 examples — you should see two addresses: 0x77 (BMP180) and 0x3C (OLED). If you see only one, check that you have pull-ups on both lines and that the breakout's onboard regulator isn't dropping its supply.
Read pressure and temperature
Start with the BMP085_test example sketch shipped with the library. It calls sensor.begin(), then sensor.getEvent(&event) for pressure (in hPa) and sensor.getTemperature(&temperature) for temperature (in °C). Open the serial monitor at 115200 baud and you should see something like 1013.25 hPa at sea level — slightly lower if you live somewhere elevated. Press your finger gently against the sensor's port (the small hole on the top of the chip) and watch the reading change as you compress the air column above it.
Convert pressure to altitude
Add a single line: float alt = sensor.pressureToAltitude(1013.25, event.pressure, temperature); — that 1013.25 is sea-level reference pressure in hPa. The returned altitude is in metres above sea level. Walk the breadboard from your basement to your top floor, and watch the number climb by roughly 3 m per flight of stairs. The accuracy is heavily affected by the weather (a real high or low pressure system shifts the absolute altitude reading by 50–100 m), but the RELATIVE altitude — first floor versus second floor — stays accurate to a couple of metres.
Print pressure + altitude to the OLED
Inside loop(), clear the display, write "PRESSURE" and the hPa value in a large font, then write "ALT" and the metres value below it, then call display.display() to push the buffer to the screen. Update once per second — the BMP180 is slow enough (~5 reads per second max in standard mode) that there's no point hammering it harder. You now have a standalone elevation indicator that you can carry around the house and watch react to your real-world position.