Simulator

A multiplexer simulator: eight channels, one analog pin

Mokxi is a free online multiplexer simulator that runs in your browser, with nothing to install and no account needed. Three knobs on three channels of a 74HC4051, and an Arduino Uno that sets three address lines to choose which one reaches its A0. The serial monitor prints all three readings, one channel at a time.

  • 505parts on the bench
  • 45boards running now
  • 1.00xreal time, on every board
Arduino Uno: three knobs through a 74HC4051live0.000 s 0.00x
Click to open it in the editor
Turn a knob and watch its channel change in the serial monitor, or click anything else to open it in the editor.

What you can do here

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

  • Turn each knob and read its channel on one analog pin
  • Change the address lines in code and pick any of eight channels
  • Swap in the 16-channel CD74HC4067 and read up to sixteen inputs
  • Use the chip the other way, as a demultiplexer, to switch one signal out to many
  • Watch the address lines on the logic analyzer as the sketch steps through them
  • Edit the Arduino code and press Run again

What the running circuit shows

One analog pin, read three times.

The 74HC4051 is an eight-way analog switch. Its S0, S1 and S2 pins take a three-bit address from Uno pins 2, 3 and 4, and whichever channel that address names, Y0 to Y7, is joined to the common Z pin, which goes to A0. The sketch sets the address for channel 0, waits 50 microseconds, reads A0, and does the same for channels 1 and 2.

In the engine the three knobs start centered, and the serial monitor prints 512 for Y0, Y1 and Y2. Turn the second knob all the way up and the third all the way down and the line reads Y0 512, Y1 1023 and Y2 0: three readings from one pin, each the voltage on the channel the address chose.

How the multiplexer is modeled

Real switches, real resistance.

Each channel is a switch with about 70 ohms of on-resistance, solved with the knobs and the analog input as one circuit, so what reaches A0 is a voltage, not a copied number. That is also why the sketch waits a moment after changing the address: the switch and the pin’s capacitance take a little time to settle, on the bench as here. E, VEE and GND are wired to ground and VCC to 5 V, and an unpowered chip passes nothing.

What it leaves out: an address line left floating. In Mokxi a floating chip input is unknown, so the chip opens every switch and A0, with nothing on it, wanders on all three channels; on a real board the open input picks up noise and the chip lands on whatever channel it reads, which looks much the same on the serial monitor. Charge injection and crosstalk between channels are not modeled.

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.

What does a multiplexer do?

It connects one of several inputs to a single output, chosen by an address on its select pins. With three select lines a 74HC4051 picks one of eight channels; with four a CD74HC4067 picks one of sixteen.

Can I use it as a demultiplexer?

Yes. The 74HC4051’s switches pass signals both ways, so a signal put on Z comes out on whichever channel the address selects.

Can I simulate a 4 to 1 multiplexer from gates?

Yes. Build it from AND, OR and NOT gates on the canvas, or from 74HC chips, and drive the two select lines from switches to check its truth table.

More simulators

Each one opens on a circuit that is already running.

Read eight inputs on one pin

Open the circuit, turn a knob and press Run. Nothing to install, and no account needed.