Simulator

A TFT display simulator: an ILI9341 running Pong on an Arduino

Mokxi is a free online TFT display simulator that runs in your browser, with nothing to install and no account needed. A 240 by 320 ILI9341 color display on an Arduino Uno’s SPI pins, a joystick and a piezo speaker. The sketch is a game of Pong, drawn pixel by pixel the way it would be on the real panel, and you play it with the stick.

  • 505parts on the bench
  • 45boards running now
  • 1.00xreal time, on every board
Arduino Uno: Pong on an ILI9341 TFTlive0.000 s 0.00x
Hold the button
Click the circuit to open it in the editor, then move the joystick to play. Press the stick to start again when the game is over.

What you can do here

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

  • Draw in 16-bit color on a 240 by 320 panel
  • Wire the display the standard way: CS 10, DC 9, MOSI 11, SCK 13
  • Play a game drawn at 30 frames a second, with sound
  • Rotate the screen with setRotation
  • See the panel stay dark when the LED pin is left low
  • Edit the sketch, change the colors and run it again

What the running circuit shows

A color panel, four signal wires and a game.

The display takes four signal wires from the Uno: chip select on pin 10, data or command on pin 9, and the SPI clock and data on pins 13 and 11. Reset and the backlight pin go to 5 V. On start the serial monitor prints “Mokxi Uno: pong on an ILI9341” and the court appears.

The game does not use the whole panel. Repainting all 76,800 pixels over SPI is slow work for an Uno, so the game plays in a 160 by 200 window and redraws only the ball and the paddles each frame, 30 times a second. That trick, erase the old shape and draw the new one, is the main thing to learn about small color displays, and the sketch shows it plainly. Lose the rally and the monitor prints “game over, press the stick to play again”.

How the display is modeled

The commands a library sends, drawn as the panel would.

The model takes the ILI9341’s commands over SPI and paints the pixels they describe, in the 65,536 colors of RGB565. setRotation works, and the LED pin is real: leave it low and the panel stays dark with the picture still in its memory, which is a common reason a real TFT seems dead.

What it leaves out: nothing can be read back from the display on MISO, hardware scrolling is not modeled, and the backlight is on or off with no dimming. A real ILI9341’s logic is 3.3 V, and many bare panels need level shifting from a 5 V Uno; nothing in Mokxi can be damaged, so this circuit wires it straight.

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.

Which TFT displays can Mokxi simulate?

The 240 by 320 ILI9341 on this page, and a larger ILI9488, which has its own tutorial on an ESP32. Both are driven over SPI by the usual graphics libraries.

How do I connect an ILI9341 to an Arduino Uno?

CS to pin 10, DC to pin 9, MOSI to pin 11, SCK to pin 13, and RESET and LED to the supply. A real panel’s logic is 3.3 V, so on hardware add level shifting or use a module that has it on board.

Why is my TFT screen white or blank?

A lit but white screen usually means the display never got its start-up commands: check CS, DC and reset. A dark one usually means the backlight pin is not powered. Pull the LED wire in this circuit to see the second case.

More simulators

Each one opens on a circuit that is already running.

Play a rally

Open the circuit, move the stick and return the ball. Nothing to install, and no account needed.