Barometer

Greg Abbas

My wife sometimes wonders if it's going to rain soon, because it feels to her like the barometric pressure is changing. She asked for something that would tell her if that's the case, so for Christmas this year I decided to make her a barometer. Of course you can easily buy a barometer, but the commercially-available home barometers I found were missing a key feature I wanted: to tell how the current pressure compares to what it was several hours ago. (Without having to manually make note of it.) Here's what I came up with:

I like a retro/steampunk aesthetic, so I tried to make it look as un-electronic as I could. I liked the look of this "vintage German weather station", so I modeled my design on that.

You can get a cheap breakout board like this BMP581 from Adafruit to measure the ambient pressure, and an ESP32 can easily drive small servo motors to indicate what the sensor is reading, so that's the route I took.

Physical Design

I didn't make the glass enclosure (a "cloche") because (a) I don't know how to blow glass and (b) they're readily available. I used this one from Amazon.

The "hull" of the device is composed of top and bottom caps (3D printed in a bronze-colored filament) and a cylindrical shell that will get covered with a paper label. The two little needle pointers stick out around the top and bottom of the shell, and then bend 90 degrees to reach towards the center (this is a cut-away view from the side).

Those are driven by small servos:

Which are held up by a scaffold that's bolted to the bottom cap. (Shell and top cap hidden for clarity.)

See those little "pegs" inside the bottom cap? That's what holds the shell... they friction-fit on the inside of the shell, taking advantage of the layer lines (from the 3D printing process) instead of explicitly modelled snap-fit connectors. There are similar ones inside the top cap.

The ESP32 is bolted to the side of the servo scaffold:

and I jammed the BMP581 in there too, but just used the Qwiic cable to hold it roughly in place instead of properly mounting it.

That assembly sits on a "neck" that has a center hole to accomodate a temporary wire to help me align it when I glued it to the bottom cap. The neck also has an off-center hole for a 5v USB power cable, and a void for a heat-set insert. The neck sits on top of the cloche base (made of MDF, that came with the glass cloche). I drilled holes in the base for the power cable and the counter-sunk M3 bolt. Finally, I 3D-printed some small feet that I epoxied to the base, with red felt glued onto them to avoid scratching whatever surface this contraption sits on.

The label is just laser-printed on a sheet of resume paper, cut out, and then fastened at the corners onto the shell with some tiny screws. I used a rubber band to hold it in place while I attached it.

By they way, one technique I had a lot of success with is on this project is using the 3D printer to make custom jigs. I don't have a drill press, so when I wanted to put holes in precise locations on the wooden base, I printed a simple guide that fits around the base and has holes for my drill bit. Then to glue the feet on the base, I made another jig with holes to hold each foot in position.

Parts List

Electronics

Electrically, this thing is super-simple. I just hooked the servo controls up to GPIO 26 (A0) and GPIO 25 (A1), and used the Qwiic connector to plug in the BMP581.

I connected the 5v supply from a USB-A cable straight to both the servos and the ESP32, which of course is bad form because motors are notorious for making the voltage fluctuate in ways that'll cause a microcontroller to be unstable. But these are tiny servos and in practice it seems to work.

I dremeled-off a small piece of perfboard to solder all the power and servo connections to. It's hard to see with everything jammed in there, but you can see the yellow/red/brown servo connections at the bottom of the photo.

Software

Unfortunately my employer is uptight about its employees sharing hobby software publicly, so I can't provide a link to my git repo. But I can talk about how I did it.

It's a small C++ software project in VSCode, using PlatformIO and Arduino libraries, notably "adafruit/Adafruit BMP5xx Library" for talking to the BMP581. I also used HTTPClient because I experimented with getting meteorological observations from the Internet instead of a local sensor, and knolleary/PubSubClient with bblanchon/ArduinoJson because I added support to publish status information to my MQTT broker (not really necessary).

One thing that makes the process of writing firmware for ESP32 way more fun that it used to be is that this is an area where AI coding really works well. It's a small software project but I'm not fluent in all the required APIs, so telling Claude to write it for me worked brilliantly. I was lazy and didn't make a detailed plan first, so I did occasionally have to ask the LLM to refactor code into separate files or eliminate duplication. Of course it's always keen to do so (not to mention obsequious and flattering).

Calibration

One interesting challenge is calibrating the mapping from pressure values to servo angle positions. I added a web server to the firmware, and made a single web page with controls to tweak the "min" (29.5 inHg) and "max" (30.5 inHg) positions for each of the two servos. That wasn't accurate enough, so I added a third calibration parameter, "mid" (30.0 inHg), and changed the servo angle interpolation from linear to quadratic. After the calibration procedure is done, there's a button to switch the device from calibration mode back to normal mode where it uses observation data from the sensor to drive the needles.

Questions or comments? Email me at .

2025 Dec 7