Source: https://mokxi.com/multiplexer-simulator

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.

Start building free or try the 16-channel CD74HC4067

- 455 parts on the bench
- 43 boards running now
- 1.00x real time, on every board

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.

The CD74HC4067 with Arduino The potentiometer part The digital circuit simulator The potentiometer simulator

## 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.

Online circuit simulator Breadboard simulator ESP32 simulator Op-amp simulator Logic gate simulator LED circuit simulator Servo simulator LCD simulator OLED simulator NeoPixel simulator 7 segment display simulator LED matrix simulator Stepper motor simulator Motor driver simulator Ultrasonic sensor simulator Rectifier simulator Digital circuit simulator Potentiometer simulator PWM simulator Relay simulator Shift register simulator DHT11 simulator RFID simulator Accelerometer simulator RGB LED simulator Buzzer simulator MOSFET simulator Circuit simulator for kids Flip-flop simulator Full adder simulator I2C simulator UART simulator Thermistor simulator PIR sensor simulator Oscilloscope simulator Multimeter simulator DC motor simulator Traffic light simulator Diode simulator Capacitor simulator Series and parallel circuit simulator Wheatstone bridge simulator Voltage regulator simulator Soil moisture sensor simulator Zener diode simulator Solar panel simulator AC circuit simulator Thevenin simulator Decoder simulator Encoder simulator PID simulator Robot arm simulator Load cell simulator IR sensor simulator LM35 simulator HC-05 Bluetooth simulator nRF24L01 simulator

## Read eight inputs on one pin

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

Start building free Open the editor
