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.

  • 455parts on the bench
  • 43boards 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.

Questions

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.

Try it with your own Python

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