用于通过 Gameboy 连接线模拟 Gameboy 打印机的代码
An Arduino-based emulator for the Game Boy Printer, tested against 110 Game Boy Printer–compatible games. 100% game compatibility has been reached by reverse-engineering real packet capture examples. Connect any compatible Game Boy to an Arduino, print as normal, and download your images to a PC or phone.
Tested hardware: Game Boy DMG (brick), Game Boy Pocket, Game Boy Color, Game Boy Advance (regular and SP), and the Kong Feng GB Boy Colour.
Despite using Arduino as the main target, the emulator code is also compatible with ESP8266, ESP32 and Raspberry Pi Pico derived boards with very minor adjustments (the relevant libraries — ESP8266 Arduino, ESP32 by Espressif System, or Arduino-Pico — must be installed in the Arduino IDE). No support is provided for these boards; use them at your own risk.
V3 note: Raw packet mode is now the default. This gives better compatibility with games that use compression, with all decoding handled on the PC side rather than on the Arduino.
Main project website: https://mofosyne.github.io/arduino-gameboy-printer-emulator/
Downloads: GitHub Releases · Release Notes
Questions, advice, or images to share? Join the community:
There are three steps: flash the firmware, wire the Game Boy, then get your images.
No software to install. Requires Chrome or Chromium (WebUSB support).
GameBoyPrinterEmulator/GameBoyPrinterEmulator.ino in the Arduino IDE.Use an Arduino Nano or Uno. Do not cut up original Game Boy link cables — replacement cables are cheap and widely available online. If you have a 3D printer, this Game Boy DMG-01 link port plug for Dupont wires (by Marko Štamcar) lets you make a clean connection without any cable at all.
Photo and tutorial by West McGowan (@imwestm) — full tutorial here.
Gameboy Original/Color Link Cable Pinout
___________
| 6 4 2 |
\_5__3__1_/ (view at cable end)| Arduino pin | Game Boy link pin |
|---|---|
| (unused) | Pin 1 — 5.0V |
| D4 | Pin 2 — Serial OUT (SOUT) |
| D3 | Pin 3 — Serial IN (SIN) |
| (unused) | Pin 4 — Serial Data |
| D2 | Pin 5 — Clock (Interrupt) |
| GND | Pin 6 — GND |
⚠️ SIN and SOUT are crossed inside the cable. If nothing happens when you print, swap pins D3 and D4 — either physically, or by swapping them in the sketch. Wire colour is not a reliable guide to which is which.
⚠️ Avoid third-generation (purple, AGB-005) link cables. These have a completely different pinout from GB/GBC cables and will not work unless you can confidently identify the correct pins.
For a cleaner build, dedicated PCBs are available that include a GBC socket and fit an Arduino Nano or Uno — no soldering to cables required. Complete builds ordered from China typically cost around €10.
Once wired, print from any compatible game. The Arduino will receive the data and output it over serial.
Some workflows (especially if you're not using a Web Serial tool) require capturing the raw serial output to a log file first, then decoding it.
Windows: Use PuTTY to log serial output to a file.
Linux/macOS: Use screen:
#!/bin/bash
# Press Ctrl+a then k to end the session
# Run 'screen -r' to reattach if you close the window
screen -L -Logfile "arduino_$(date +'%Y%m%d-%H%M%S').log" /dev/ttyUSB0 115200Note: Arduino IDE v2 no longer makes it easy to copy serial output to a file — PuTTY or
screenare the recommended alternatives.
The saved log file can be pasted into GBP Downloader's manual input field or decoded with any of the tools below.
| Tool | Best for |
|---|---|
| Game Boy Printer Web (Source Code) | Full-featured: palette control, photo library, WebUSB direct connection. To connect via WebUSB: Settings → Enable WebUSB, then WebUSB Serial devices → Open Web Serial devices |
| GBP Downloader (Source Code) | Fast and lightweight: connect, print, export PNG or ZIP — works offline |
| GBCamera Android Manager | Field use with an Android phone over USB serial. If you boot the Arduino with a real Game Boy Printer connected and switched on, it will boot in printer mode — allowing the app to output images directly to the physical printer. The LED on pin 13 flashes to indicate ready |
| JavaScript decoder (Source Code) | Browser-based, works offline |
| GNU Octave / MATLAB decoder (Source Code) | Scripted or batch processing workflows |
| Python decoder | Command-line / scripting |
| C decoder | Compiled command-line tool |
Game Boy Printer Web and GBP Downloader both support direct Web Serial connections (Chrome, Edge, or Opera on desktop) — you can print and watch images appear live without saving a log file at all.
| Component | Description |
|---|---|
GameBoyPrinterEmulator/gpb_emulator.ino |
Main Arduino sketch |
GameBoyPrinterEmulator/gameboy_printer_protocol.h |
Reusable header with protocol definitions |
GameBoyPrinterDecoderJS/gameboy_printer_js_raw_decoder.html |
Raw packet decoder (recommended) |
GameBoyPrinterDecoderJS/gameboy_printer_js_decoder.html |
Tile-based decoder |
Raw mode (default since V3): outputs raw packets as hex, with the printer's response as the final two bytes of each packet. Example:
88 33 01 00 00 00 01 00 81 00Tile mode: outputs one Game Boy tile per line as hex. Example:
55 00 FB 00 5D 00 FF 00 55 00 FF 00 55 00 FF 00暂无开放 Issues,或尚未同步最近议题。