Simulator

A pressure sensor simulator: read a BMP388 barometer on an Arduino Uno

Mokxi is a free online pressure sensor simulator that runs in your browser, with nothing to install and no account needed. A BMP388 barometric pressure sensor wired to an Arduino Uno: VIN to 5V, GND to GND, SDA to A4 and SCL to A5. The sketch reads it with Adafruit_BMP3XX.h and the serial monitor prints the pressure.

  • 526parts on the bench
  • 46boards running now
  • 1.00xreal time, on every board
Arduino Uno: a BMP388 altimeterlive0.000 s 0.00x
Click to open it in the editor
Click the circuit to open it in the editor, then drag the pressure slider. The simulator reports the pressure in hectopascals, as the next measurement will report it.

What you can do here

In the circuit above, or in the editor it opens.

  • Watch the serial monitor print the pressure every second
  • Drag the pressure slider and see the altitude change
  • Set the temperature, which starts at 22
  • Read the wiring: VIN to 5V, GND to GND, SDA to A4, SCL to A5
  • Set SEA_LEVEL_HPA to today's sea-level pressure for a true altitude
  • Open the sketch and follow the things to try in the comments

What the running circuit shows

Pressure, temperature and altitude, printed once a second.

At the default settings the sketch finds the chip and prints each second: “BMP388 found at 0x77” then “pressure 1013.25 hPa, temperature 22.00 C, altitude -0.0 m”. The pressure slider starts at 1013.25 and the temperature starts at 22.

Drag the pressure slider down to 950 and the next measurement changes: “pressure 950.00 hPa, temperature 22.00 C, altitude 540.4 m”. Less pressure reads as more altitude, which is exactly how a barometer works as an altimeter.

The sketch comments explain the rule of thumb: about 12 Pa, or 0.12 hPa, less is a meter higher. You can watch that play out on the sliders.

How the barometric pressure sensor is modeled

Two sliders stand in for the weather.

The Bosch BMP388 reads air pressure and temperature over I2C at address 0x77 or 0x76. Its readings are raw 24-bit counts, and the library turns them into pascals and degrees using 21 trimming bytes Bosch writes into every chip at the factory.

The simulator models two properties: pressure in hPa, from 300 to 1250, and temperature in degrees C, from -40 to 85, the datasheet's operating range. The two sliders change them while the circuit runs, and the next measurement reports them.

How it works

Three steps from a blank tab to a running circuit.

  1. Open the editor

    It runs in your browser tab. Nothing to install, and you need no account to start.

    Your first project
  2. Wire it and write the code

    Drag parts onto a breadboard, run each wire from pin to pin, and write the sketch beside it.

    Wiring
  3. Press Run

    Your sketch compiles in the tab and runs on a model of the chip, with the Serial Monitor beside it.

    Run and serial
Reviews

What makers say about Mokxi.

“The AI checker helps check and correct my circuits, and it has way more components than Tinkercad. As a student I really appreciate the tool.”

ChloeEngineering student

“I’d been looking for a real online electronic simulator that was intuitive and complete when I found Mokxi. I was able to quickly import a Fritzing file and my Arduino sketch and start testing. Mokxi has all of the makings for the best online Arduino simulator I have been able to find!”

JayModel builderFeatured in his DioramaOS post

“I’m using Mokxi to develop and simulate an STM32-based four-wheel-drive robot car before building the actual hardware. It allows me to experiment with DC motor control, PWM, RPM measurement using photointerrupters, and different acceleration, braking, and reversing strategies, helping me understand and refine the system before implementing it in real life.”

NusretRobot car builder, Hamburg

Share your story

FAQ

Questions, answered.

Is it free?

Yes. The circuit on this page, every part in it and the editor it opens in are on the free plan, with no card.

Do I need an account?

No. The circuit runs the moment the page does, and the editor opens without one. A free account is only for saving a project to the cloud and sharing it by link.

Can two BMP388 sensors share one I2C bus?

Yes. SDO is the address bit. Left alone the board pulls it up and the address is 0x77; to GND it is 0x76. The sketch would then call begin_I2C(0x76).

How do I get a true altitude instead of height above sea level?

Set SEA_LEVEL_HPA to today's sea-level pressure from a weather report. Or read the pressure once in setup() and use that, and the sketch shows height above the desk.

Is 5 V on VIN safe for this board?

Yes. The board has its own regulator and level shifters, so 5 V on VIN is fine even though the chip itself runs from 1.65 to 3.6 V.

More simulators

Each one opens on a circuit that is already running.

Measure the air

Open the circuit, drag the pressure slider and watch the altitude climb. Nothing to install, and no account needed.