Simulator

Free online Raspberry Pi simulator for Python and GPIO

Mokxi is a free Raspberry Pi simulator that runs in your browser, with nothing to install and no account needed. Your main.py runs in a Python engine in this tab, and RPi.GPIO, gpiozero, smbus, smbus2 and spidev drive the 40-pin header of a Raspberry Pi 4, a Pi 5 or a Zero 2 W. It is not an emulator: there is no Linux and no Cortex-A core, only the board’s Python and the circuit it drives.

  • 505parts on the bench
  • 45boards running now
  • 1.00xreal time, on every board
Raspberry Pi 4: gpiozero blinklive0.000 s 0.00x
Click to open it in the editor
The Pi is running its main.py right now, in the Python engine. Click it to open the circuit in the editor.
What is modeled

The numbers, not the marketing

Taken from the board's own contract document and put in plain words.

What runsMicroPython v1.29.0 built for WebAssembly, a Python 3 interpreter, with RPi.GPIO 0.7.1 and gpiozero 2.0.1 written for it. Not CPython, not Linux, not an Arm core.
The boardsThe Raspberry Pi 4 Model B, the Raspberry Pi 5 and the Raspberry Pi Zero 2 W: all 40 header pins in order, GPIO 0 to 27 at 3.3 V logic, BCM and BOARD numbering.
I2C and SPIsmbus and smbus2 on /dev/i2c-1 at 100 kHz, spidev on /dev/spidev0.0 and 0.1, and gpiozero’s MCP3008 on SPI0, or bit-banged on any other pins.
TimeA simulated clock: time.sleep(1) is one simulated second, and an edge callback runs at the simulated instant of the edge.
Go further

The full board page

Every peripheral area, every example and the wiring notes, in one place.

Raspberry Pi simulatorEvery example, the whole header and what is not simulated.
Guides

Step-by-step guides for the Raspberry Pi

Each one has the parts, the wiring and the code, and ends in a circuit you can run.

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 this a Raspberry Pi emulator?

No. There is no Linux, no Cortex-A core and no SD card image. Your main.py runs in a Python engine in the page, and its libraries drive the header. Everything a circuit can see of a Pi is here; the operating system is not.

Which libraries can I import?

RPi.GPIO, gpiozero, smbus, smbus2 and spidev, and the standard modules a GPIO program reaches for, such as time, math, random and json. picamera2, pigpio, serial, threading and the networking modules are not installed, and importing one raises ImportError.

Does RPi.GPIO work on the Pi 5?

It fails there as it does on a real Pi 5, with "Cannot determine SOC peripheral base address", because the pins are on the RP1 chip. gpiozero works on all three boards.

Can I read an analog sensor?

The Pi has no ADC, so, as on a desk, add an MCP3008 on SPI0 and read it with gpiozero’s MCP3008 class or with spidev. There is a built-in example of exactly that.

Can I use I2C displays and sensors?

Yes, with smbus or smbus2 on bus 1, GPIO 2 and 3. An SSD1306 OLED and a BME280 have built-in examples, and an address nobody answers raises [Errno 121] Remote I/O error, as on a Pi.

Can I pip install a library?

No. Add a library’s .py file as a tab of its own and import it from main.py, which works for libraries written in plain Python.

Will my program run on a real Pi?

Yes, with gpiozero or RPi.GPIO as they ship with Raspberry Pi OS. Timing on a real Pi is looser: software PWM jitters there and does not here.

Is it free?

Yes. Every board and every part is on the free plan, with no account needed. The first Run downloads the Python engine, about 150 KB, and the browser keeps it.

Simulators for one kind of circuit

A servo, a display, a motor driver or a rectifier, each already running.

Try it with your own Python

Write main.py with gpiozero or RPi.GPIO and press Run. Nothing to install and no account needed.