Nintendo Switch Controller Emulator for RP2040/RP2350.
2wiCC (SwiCC v2) is a controller emulator that presents itself as a Switch (1) Pro Controller to the console while providing control from a PC via UART commands.
Any RP2040- or RP2350-based board should work, potentially with pin configuration changes. This project has been written assuming a Waveshare RP2040-Zero board, which is ideal because of its small size, onboard RGB LED, and USB-C connector.
A serial (UART) adapter is needed. This project has been written assuming that a second RP2040-Zero board has been configured as a USB-serial adapter using the firmware available at https://github.com/knflrpn/2wiCC_Comms/releases .
On your Switch, you need to go to Settings > Controllers & Accessories and check "Nintendo Switch Pro Controller Wired Communication" to force the Switch to use USB for USB-connected controllers, otherwise the Switch will only use USB to exchange Bluetooth information and then stop talking over USB.
| Function | GPIO Pin | Notes |
|---|---|---|
| UART TX | 0 (default) | Serial output from board |
| UART RX | 1 (default) | Serial input to board |
| Status LED | 16 | WS2812 RGB LED (onboard on RP2040-Zero) |
| VSYNC Input | 14 | Optional: for frame synchronization |
- Flash one board with this firmware.
- Flash a second board with the USB-UART bridge firmware (https://github.com/knflrpn/2wiCC_Comms/releases).
- Cross-wire the UART pins (TX→RX, RX→TX) between the two boards.
- Connect grounds between the two boards.
A case for this setup is available here: https://www.printables.com/model/1401073-2wicc-case
Connect SwiCC to your host system via a UART-to-USB adapter of your choice.
- Baud Rate: 460,800 bps
- Format: 8N1 (8 data bits, no parity, 1 stop bit)
- Flow Control: None
The RGB LED provides visual feedback:
- Red pulse (heartbeat): Indicator that SwiCC is alive
- Steady blue: USB connection established
If the heartbeat is present but there is no steady blue, it indicates that the SwiCC is alive but the Switch is not talking to it, which is most often because of the USB cable (e.g. using a 'charging only' cable that doesn't carry data).
All commands are sent in ASCII and consist of
- A
+character to indicate the start of a command. - A command type consisting of one or more alphanumeric characters.
- A space character to indicate the end of the command type string. All commands must include this space even if the command does not require a parameter.
- An optional parameter (depending on the command).
- A newline (either
\ror\nor both) to commit the command.
| Command | Parameter | Description |
|---|---|---|
QD |
6 hex digits | Queue digital-only controller state (3 bytes) |
QF |
18 hex digits | Queue full controller state (9 bytes: 3 digital + 6 analog) |
QFI |
42 hex digits | Full controller state (QF) plus IMU data |
Controller State Format:
Controller state is sent as hex-encoded ASCII. E.g. a byte with decimal value 255 is sent as the two ASCII characters FF.
- Digital (3 bytes): Button states as a bitmask
- First byte: [ZR, R, Right SL, Right SR, A, B, X, Y] (bits 7-0)
- Second byte: [unused, unused, Capture, Home, Left Stick, Right Stick, +, -] (bits 7-0)
- Third byte: [ZL, L, Left SL, Left SR, D-pad Left, D-pad Right, D-pad Up, D-pad Down] (bits 7-0)
- Analog (6 bytes): Left stick X, Y, Right stick X, Y, encoded in the Pro Controller data format (see https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/bluetooth_hid_notes.md). Center position is defined as 0x800 and full swing is +/- 0x600 from center.
- IMU (12 bytes): 16-bit little-endian 2's complement signed value each for X, Y, Z acceleration and X, Y, Z gyro, in that order. Neutral for all values is 0.
Note that IMU state is not queued; it takes effect immediately after QFI is parsed, and persists until the next QFI.
| Command | Parameter | Description |
|---|---|---|
SPM |
RT or BUF |
Set playback mode (Real-Time or Buffered) |
| Command | Parameter | Description |
|---|---|---|
GQR |
None | Get queue remaining space |
GQS |
None | Get total queue size (default 1024) |
| Command | Parameter | Description |
|---|---|---|
VSYNC |
0 or 1 |
Disable/enable VSYNC synchronization |
VSD |
4 hex digits | Set frame delay in microseconds (0000-FFFF) |
| Command | Parameter | Description |
|---|---|---|
REC |
0 or 1 |
Stop/start input recording |
GRR |
None | Get recording buffer remaining space |
GRS |
None | Get total recording buffer size (default 1024) |
GR |
0 or 1 |
Get recorded data (0=start from beginning, 1=continue) |
| Command | Parameter | Description |
|---|---|---|
ID |
None | Returns +2wiCC (device identification) |
VER |
None | Returns firmware version |
GCS |
None | Get USB connection status (0=disconnected, 1=connected) |
LED |
0 or 1 |
Disable/enable status LED |
RMBL |
0 or 1 |
Disable/enable rumble feedback |
ECHO |
text | Echo back the provided text |
- Always uses the most recently received controller state
- Best for live input injection
- Plays controller states sequentially from the queue
- Advances one state per frame (60 FPS if VSYNC disabled, otherwise according to VSYNC)
- Automatically switches back to real-time if buffer runs empty
+QD 080000 # Press A button
+QD 000000 # Release all buttons
+QF 000000000880000880 # No buttons and neutral sticks
+REC 1 # Start recording
# Play the game...
+REC 0 # Stop recording
+GR 0 # Download recorded inputs
Repeat +GR 1 until the entire recording is retrieved.
Recorded inputs use run-length encoding and are returned in this format:
+R [18 hex digits]x[2 hex digits]
- 18 hex digits: Full controller state (9 bytes)
- x: Separator (literal
xcharacter) - 2 hex digits: Number of consecutive frames with this state (1-240)
Example: +R 000000000880000880x74 means neutral controller for 0x74 (116 decimal) frames.
SwiCC sends status updates back to the host PC over the UART connection. The format for these messages is a + character to mark the beginning of a message, an alphanumeric message type string, a space character, optional data, and a newline (\r\n) to mark the end of the message.
| Message Format | Description |
|---|---|
+ERR WATCHDOG |
Indicates the microcontroller rebooted because the watchdog timer timed out. |
+RMBL [6 hex digits] |
Rumble data sent from the Switch. Rumble feedback defaults to disabled and must be enabled with the RMBL command if desired. |
+LGHT [2 hex digits] |
Reports a change to the controller's indicator lights. |
+WRN TIMEOUT [0 or 1] |
Warning indicating whether the Switch has enabled (1) or disabled (0) USB timeout 4. If USB timeout remains enabled, the console will stop communicating over USB. See the Switch Settings section above to prevent this. |
