Simulator

An air quality sensor simulator: an ENS160 on an Arduino Uno, live in your browser

Mokxi is a free online air quality sensor simulator that runs in your browser, with nothing to install and no account needed. An ENS160 air quality sensor on an Arduino Uno, wired over I2C: VIN to 5V, GND to GND, SDA to A4 and SCL to A5, read with ScioSense_ENS160.h. The circuit runs right on the page and opens in the editor exactly as drawn.

  • 526parts on the bench
  • 46boards running now
  • 1.00xreal time, on every board
Arduino Uno: ENS160 air qualitylive0.000 s 0.00x
Click to open it in the editor
Click the circuit to open it in the editor, then move the aqi, tvoc and eco2 sliders while it runs. The next sample reports them in the serial monitor.

What you can do here

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

  • Watch AQI, TVOC and eCO2 print every second
  • Move the aqi slider from 1 to 5
  • Set TVOC in ppb with the tvoc slider
  • Raise eCO2 from 400 ppm upward
  • Read the ENS160 over I2C at 0x53
  • Open the sketch in the editor and change it

What the running circuit shows

Three readings a second, straight from the simulated chip.

At the default settings the sensor starts with aqi at 1, tvoc at 0 and eco2 at 400. The sketch finds the chip and prints its first sample: “ENS160 found at 0x53” then “AQI 1, TVOC 0 ppb, eCO2 400 ppm”.

Now change the settings in the editor: set the air quality index to 3, TVOC to 300 ppb and eCO2 to 1200 ppm. The next sample reports them: “AQI 3, TVOC 300 ppb, eCO2 1200 ppm”.

The readings update once per second, just like the real chip in its standard mode. Try things from the sketch's comments: print the warm-up flag, bits 2 and 3 of the status register (0x20), which read 1 for the first three minutes, then turn on an LED when the AQI reaches 4.

How the air quality sensor is modeled

A metal-oxide gas sensor with four tiny heated plates and its own processor.

The ENS160 works out three numbers each second in standard mode: the air quality index of Germany's environment agency (UBA), from 1 for excellent air to 5 for unhealthy; TVOC, the total volatile organic compounds in parts per billion; and eCO2, the equivalent carbon dioxide level in parts per million. The three sliders in the simulator cover indoor air and change the readings while the circuit runs, with the next sample reporting them.

The chip does not measure CO2 itself: for that you need an NDIR sensor such as the SCD40. The simulator models the chip's output ranges for aqi, tvoc and eco2, and the sketch talks to it over I2C at 0x53, or 0x52 with ADDR to GND, using the ScioSense library Mokxi ships.

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.

My ENS160 is not found at 0x53. What is wrong?

Check SDA, SCL and power first, as the sketch suggests. Most boards sit at 0x53 because the board pulls ADDR up, but with ADDR to GND the address is 0x52. Also mind that the library's default constructor is 0x52.

Does the ENS160 measure carbon dioxide?

No. Its eCO2 reading is the CO2 level in ppm that would come with the measured TVOC. For real CO2 you need an NDIR sensor such as the SCD40.

Why do the readings look odd right after starting?

The chip warms up for the first three minutes after power-on, and the validity bits in the status register read 1 during that time. The sketch's comments suggest printing the warm-up flag to see this.

More simulators

Each one opens on a circuit that is already running.

Smell the air, in numbers

Open the circuit, move the three sliders and watch the readings change every second. Nothing to install, and no account needed.