Raspberry Pi simulator for GPIO, in Python with gpiozero
The Raspberry Pi 4 Model B, the Raspberry Pi 5 and the Raspberry Pi Zero 2 W, from their 40-pin header. Your main.py runs in a Python engine in the page, and gpiozero and RPi.GPIO drive the header as they do on a real Pi, on the simulated clock. There is no Linux here, and this page says plainly what that leaves out.
- 9khu vực ngoại vi được mô phỏng
- 9dự án sẵn sàng để chạy
- Thời gian thựctrên máy của chính bạn

Những gì được mô phỏng
Lấy từ tài liệu cam kết của chính bo mạch và diễn đạt bằng lời đơn giản, kèm những gì còn thiếu ngay bên cạnh.
Được mô phỏng
- Thanh tiêu đề
- All 40 pins in their real order, named by BCM number, with BOARD numbering mapped to them
- Nguồn
- 3V3 on pins 1 and 17, 5V on pins 2 and 4, and the eight grounds
- GPIO
- GPIO 0 to 27 at 3.3 V logic, as inputs with their 50 k pulls or as outputs, with the SoC’s power-on pulls and the 1.8 k pull-ups on GPIO 2 and 3
- gpiozero 2.0.1
- LED, PWMLED, RGBLED, Button, Buzzer, Servo, AngularServo, DistanceSensor, MotionSensor, LineSensor and more, on the lgpio pin factory
- RPi.GPIO 0.7.1
- BCM and BOARD, setup, output, input, PWM, add_event_detect, wait_for_edge and cleanup, with the library’s own warnings and errors
- Thời gian
- time.sleep(1) is one simulated second; edge callbacks run at the time of the edge
- The Pi 5
- RPi.GPIO fails there with the error a real Pi 5 gives, and gpiozero works
- I2C và SPI
- /dev/i2c-1 and /dev/spidev0.0 and 0.1, with smbus, smbus2, spidev and gpiozero’s MCP3008, at the speed of the bus and with the errors a Pi gives
- The Serial Monitor
- print() and tracebacks, input(), and Ctrl-C as KeyboardInterrupt
Không được mô phỏng
- Linux. There is no kernel, no desktop, no terminal, no sudo and no file system beyond the project’s files.
- pip and apt. Only the modules that come with the board can be imported.
- Networking: no Wi-Fi, Ethernet or Bluetooth, and no socket or requests.
- Camera, màn hình, HDMI và âm thanh.
- The I2C bus’s speed setting and clock stretching: I2C runs at Raspberry Pi OS’s default 100 kHz.
- Threads. gpiozero’s callbacks, blink() and PWM run without them.
- CPython itself: the engine is MicroPython, so a few details of the language differ (isinstance(True, int) is False). Programs that drive the pins run unchanged.
Mở một mạch và nhấn Chạy
Mỗi ví dụ này mở ra trong trình soạn thảo đúng như hình vẽ ở đây.
Every built-in project on the Raspberry Pi
Mỗi dự án có trang riêng với mạch đang chạy, code và danh sách linh kiện.
Các bài hướng dẫn dùng bo mạch này
Bài nào cũng kết thúc bằng một mạch đang chạy, trên chính bo mạch này.
Câu hỏi
Có miễn phí không?
Có. Mọi bo mạch và mọi linh kiện đều nằm trong gói Free, không cần tài khoản.
Đây có phải là trình mô phỏng Raspberry Pi không?
No. There is no Arm core and no Linux. Your Python runs in a Python engine in the page, and its gpiozero and RPi.GPIO drive the header. Everything a circuit can see of a Pi is here; the operating system is not.
Why does RPi.GPIO fail on the Pi 5?
Because it fails on a real Pi 5: the pins are on the RP1 chip, which RPi.GPIO 0.7.1 cannot find, and GPIO.setup raises "Cannot determine SOC peripheral base address". Use gpiozero, which works on all three boards.
Tôi có thể pip install một thư viện không?
Không. Hãy thêm file .py của thư viện thành một tab riêng và import nó từ main.py, cách này hoạt động với các thư viện viết bằng Python thuần.
Chương trình của tôi có chạy trên một chiếc Pi thật không?
Có, với gpiozero hoặc RPi.GPIO như được cài sẵn trong Raspberry Pi OS. Định thời trên Pi thật sẽ kém chính xác hơn: PWM bằng phần mềm bị rung ở đó, còn ở đây thì không.
Các bo mạch khác
Mọi bo mạch trong số này đều chạy được ngay hôm nay, và mọi bo mạch đều miễn phí.
Bạn muốn xem phần giới thiệu ngắn gọn hơn? Xem the Raspberry Pi simulator page.
Một chip RISC-V 160 MHz, trên đúng bản đồ bộ nhớ thật.
Arduino cổ điển, với ATmega328P chạy 16 MHz.
Chip của Uno trên một bo mạch nhỏ cắm vừa breadboard.
Arduino cỡ lớn, có 54 chân digital và bốn cổng serial.
Một bo mạch hình dáng Uno mà chip của nó tự xử lý USB serial.
Một bo mạch RISC-V thứ hai, có 31 chân và WiFi mô phỏng.
ESP32 cổ điển 240 MHz, có WiFi mô phỏng.
ESP32-S3 240 MHz, có USB serial và một LED RGB.
Thử với Python của chính bạn
Viết main.py với gpiozero hoặc RPi.GPIO rồi nhấn Chạy. Không cần cài đặt gì và không cần tài khoản.