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.
- 455parts on the bench
- 43boards running now
- 1.00xreal time, on every board
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.
Questions
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.