A 3 to 8 decoder simulator: a 74HC138 lighting one LED of eight
Mokxi is a free online decoder simulator that runs in your browser, with nothing to install and no account needed. Three logic chips and no microcontroller: a 74HC14 oscillator clocks a 74HC161 counter, and a 74HC138 decodes the counter’s bottom three bits into one lit LED out of eight. Every pin is live, so you can follow the binary address in and the one low output out.
- 505parts on the bench
- 45boards running now
- 1.00xreal time, on every board
What you can do here
In the circuit above, or in the editor it opens.
- Follow a 3-bit binary address to the one output it selects
- Read the 138’s active-low outputs and see why the LEDs hang from 5 V
- Disable the chip with an enable pin and watch every output go high
- Change the clock’s capacitor and speed up the count
- Cascade two 138s into a 4 to 16 decoder
- Drive the address from an Arduino instead of a counter
What the running circuit shows
Three bits in, one line low.
The 74HC161 counts up on every rising edge of its clock, and its Q0, Q1 and Q2 go to the 138’s A0, A1 and A2. The 138 pulls exactly one of its eight outputs low: Y3 when the address is binary 011. In the engine the selected output sits at about 0.26 V and the others at 5.00 V. Each LED runs from the 5 V rail through 330 ohms into one output, so only the low one lights, at about 8.8 mA.
The clock is one Schmitt inverter of the 74HC14 with 100 k from its output back to its input and 4.7 µF from the input to ground. A Schmitt input switches at two different voltages, so the capacitor chases the output between them, about 1.78 V and 2.78 V here, and it oscillates at about 0.8 × R × C. In the engine the light moves on every 0.385 seconds and runs along all eight LEDs in about 3.1 seconds. Change C1 to 1 µF and each step takes about 82 ms.
Q3 is not used, so the 138 never sees the fourth bit and the light runs along the row twice for every sixteen counts. The 138 also has three enables, E1 and E2 active low and E3 active high, all tied on here. Pull E3 low and every output goes high and every LED goes dark, which is how a second 138 takes over the next eight lines in a 4 to 16 decoder.
How the chips are modeled
Logic levels, thresholds and nanoseconds.
Each chip follows its datasheet. The 138 works out every output separately, so an unknown input only makes an output unknown when it could change it, and its propagation delay is the SN74HC138’s typical 18 ns. The 161 changes all four outputs on the same clock edge, a synchronous counter, and the 74HC14’s inputs have real Schmitt thresholds, which is what lets a resistor and a capacitor make it oscillate.
What it leaves out: the few-nanosecond glitches a real 138 can show while its three address inputs change at slightly different times. Here the change from one output to the next is clean. If you clock something fast from a decoder output in hardware, that glitch is worth designing around.
Three steps from a blank tab to a running circuit.
Open the editor
It runs in your browser tab. Nothing to install, and you need no account to start.
Your first projectWire it and write the code
Drag parts onto a breadboard, run each wire from pin to pin, and write the sketch beside it.
WiringPress Run
Your sketch compiles in the tab and runs on a model of the chip, with the Serial Monitor beside it.
Run and serial
Open a project and press Run.
Every one runs in the editor exactly as it is drawn, ready to change.
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.”
“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!”
“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.”
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 3 to 8 decoder do?
It takes a 3-bit binary number and selects one of eight outputs: address 0 selects Y0, address 5 selects Y5. On the 74HC138 the selected output goes low and the other seven stay high.
Why do the LEDs go from 5 V to the decoder’s outputs?
Because the 138’s outputs are active low. The selected output sinks current, so an LED from the 5 V rail through a resistor into it lights. Wired to ground instead, seven would light and one would go dark.
How do I make a 4 to 16 decoder?
Use two 138s. Wire the three address lines to both, and put the fourth bit on the enables: into E1 of the first chip and E3 of the second, so the first answers 0 to 7 and the second 8 to 15.
Do I need an account at all?
No. The editor, the templates, the gallery, the compiler and Run all work without signing in. Your browser keeps your work as you go. An account saves your projects online, so they follow you to any computer. It also gives you a link to share.
Which boards are supported?
Forty-five, all on the free plan. Arduino: the Uno R3, Uno R4 Minima and Uno R4 WiFi, Nano, Nano ESP32, Nano RP2040 Connect, Mega 2560, Leonardo, Micro, the Pro Mini in its 5 V and 3.3 V builds, and the SparkFun Pro Micro. ESP32: the classic DevKit V1, the ESP32-S3, the ESP32-C3 and C6 DevKits, the Espressif DevKitC V4, the Freenove ESP32-WROVER, the Wemos LOLIN32 Lite, the Wemos D1 R32, the Cheap Yellow Display, the TTGO T-Display, the ESP32-C3 SuperMini and the Seeed XIAO ESP32-C3, C6 and S3. ESP8266: the NodeMCU, the Wemos D1 mini and the ESP-01S. Also the Raspberry Pi Pico and Pico W, the Seeed XIAO RP2040, the Waveshare RP2040-Zero, the Seeed XIAO SAMD21, the WCH CH32V003, the STM32F411 Black Pill, the STM32 Nucleo-F411RE and the STM32F103 Blue Pill, the BBC micro:bit V2, and the ATtiny85 and the ATmega328P in its 16 MHz and 8 MHz builds, which plug straight into the breadboard as bare chips. Your own code compiles in the browser for all of them. Then the Raspberry Pi 4, Pi 5 and Zero 2 W computers, which run your Python with gpiozero and RPi.GPIO, with nothing to compile. Each board page lists what it can and can’t do. For example, the WiFi boards have pretend WiFi, not a real radio, and the page says so.
Is my sketch really compiled in the browser?
Yes. A real compiler (clang, built for the web) runs in your browser. It downloads once, and your browser keeps a copy. After that, every build happens on your own computer. There is no build server and no waiting in line, so there are no build minutes to run out of.
Which browsers work?
Any up-to-date Chrome, Edge, Firefox or Safari, on a computer, a phone or a tablet. They all support WebAssembly, which Mokxi needs, and they have for years.
Does it work on a phone?
Yes. The editor works with touch, the buttons are big enough to tap, and the layout fits a small screen. The simulation runs on the phone itself.
Can I try Pro before I pay?
Yes. Every account can try Pro free for 7 days, once. It takes a card, nothing is charged for those days, and if you cancel before they end you pay nothing. It starts when you choose it.
Can I cancel anytime?
Yes, in one press from your account page. Your plan runs to the end of what you paid for.
Do you offer refunds?
Yes, once per account. Write to us within 14 days of a payment and we refund all of it. Lifetime Pro is refunded in full within 14 days of buying it.
Is there a student discount?
Yes. Students get Pro at half price with a school email.
Do students need accounts?
No. The simulator works signed out, so your class starts from one link with nothing to sign up for. An account only adds cloud saving and sharing, and a student can make one later, or never.
Does it work on a Chromebook?
Yes. Everything runs on the machine in front of the student, so a Chromebook works as well as a lab PC.
What does it cost for a class?
Nothing, if your students only need to open and run circuits: the whole simulator is on the free plan. The class tools (a roster, starter projects, auto-graded checks, the gradebook) come with Pro and Classroom. Classroom is $9.99 a student a year, from 5 students, so at least $49.95 for the year. Your own seat is free, and from 50 students each one costs less. Your students get Pro’s room while they are in your classes. Pay by card, invoice or purchase order. Pro on its own runs classes for up to 10 students in all. To try the class tools with real students first, start the free 30-day trial from your class page: one class of up to 20 students, no card.
Is student work private?
Yes. A student’s projects in a class are always private: they cannot be opened by link or put in the gallery. One exception, and only for reading: a teacher may open, and never write, a project owned by somebody in a class they teach, which is what a card on the class wall does. What we store about a student, who processes it, how a school has it deleted, and how we handle COPPA consent for students under 13 and FERPA as a school official are all on the student data privacy page at /privacy/students.
Is Mokxi AI free?
Every signed-in account gets questions: 5 a day on a free account, 700 for the 7 days on the Pro trial, 3,000 every month on Pro and the other paid plans, and 25 a day on Lifetime Pro.
Does Mokxi AI work with ESP32 and Raspberry Pi Pico sketches?
Yes. It knows which board the project is on and answers for that board, from an Uno to an ESP32, an ESP8266, a Pico or an STM32.
Can Mokxi AI change my code without asking?
No. It proposes a change as a card. Accept is yours, and only appears once the changed code compiles; Ctrl+Z undoes it.
What does Mokxi AI send with a question?
Your project text, the matching help articles and the last six messages of the chat, never your name or account. "What is sent" shows exactly what went.
Latest arrivals in Mokxi.
More simulators
Each one opens on a circuit that is already running.
Decode a count
Open the circuit, probe the address pins and follow the light. Nothing to install, and no account needed.





