Simulator

An RGB LED simulator that mixes any color

Mokxi is a free online RGB LED simulator that runs in your browser, with nothing to install and no account needed. An RGB LED on three PWM pins of an Arduino Uno, each leg through its own 220 ohm resistor. The sketch hands the light from red to green to blue and back, so the color walks all the way around the wheel.

  • 505parts on the bench
  • 45boards running now
  • 1.00xreal time, on every board
Arduino Uno: RGB fadelive0.000 s 0.00x
Click to open it in the editor
The color goes red, green, blue and round again. Click the circuit to open it in the editor.

What you can do here

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

  • Mix any color with analogWrite on three pins
  • Switch the LED between common cathode and common anode
  • Change a resistor and see the balance of the color move
  • Measure each color’s current with a multimeter
  • Fade through ten named colors in the RGB color mixer project
  • Light a whole strip of NeoPixels instead

What the running circuit shows

Three LEDs under one lens.

An RGB LED is a red, a green and a blue LED in one package, here with their cathodes joined on the long leg. analogWrite sets each one from 0 to 255 on pins 6, 5 and 3, and the eye blends the three. The sketch cross-fades: as one value falls from 255 to 0 the next rises from 0 to 255, so the total stays the same and only the hue moves.

In the engine each hand-over is 256 steps of 8 ms, so the serial monitor says “green”, “blue” and “red” about two seconds apart, and one trip around the wheel takes about six seconds. Pins 6 and 5 switch at about 980 Hz and pin 3 at about 490 Hz, because they come from different timers, and the eye sees none of it.

How the LED is modeled

Three diodes, each with its own forward voltage.

Each die is a diode with its own curve, solved with the resistors and the pins. At full brightness the red die drops about 1.7 V and takes about 13 mA through its 220 ohm resistor; the green and blue dies drop about 2.8 V and take about 9 mA. That is why the same 255 on all three comes out pinkish rather than white, and why the RGB color mixer project turns red down to balance it.

Common anode is a property: flip it and the shared leg goes to 5 V, a LOW lights a color, and the sketch has to write 255 minus each value. What it leaves out: the color on screen is the engine’s estimate of the blend, and a real LED’s three dies sit side by side, so up close a real one shows color fringes this one does not.

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.

How do I make white with an RGB LED?

Turn all three on, then turn red down. On equal resistors the red die takes more current than the others, because it drops less voltage, so all three at 255 comes out pinkish; the RGB color mixer project writes 170 to red for its balanced white.

Common anode or common cathode?

Common cathode has the shared leg on ground and HIGH lights a color; common anode has it on 5 V and LOW lights a color. Set the part’s common property to match, and for common anode write 255 minus each value.

Which pins can fade an RGB LED on an Uno?

The PWM pins, marked with a ~: 3, 5, 6, 9, 10 and 11. This circuit uses 6, 5 and 3.

More simulators

Each one opens on a circuit that is already running.

Mix a color

Open the circuit, change the colors and press Run. Nothing to install, and no account needed.