Friday, April 5, 2024

USB Keyboard/Mouse to PS/2 Interface Converter with Raspberry Pi Pico


  the PS/2 interface holds a special place, reminiscent of the days of PC-XT and early computing. With the Raspberry Pi Pico, a microcontroller with impressive capabilities, we can bridge the gap between modern USB peripherals and vintage PS/2 ports. In this blog post, we'll explore how to create a USB keyboard/mouse to PS/2 interface converter using the Raspberry Pi Pico, opening doors to a world of nostalgic computing experiences.

What You'll Need

Before diving into the implementation, let's gather our materials:

  • Raspberry Pi Pico
  • USB keyboard and/or mouse
  • PS/2 keyboard and mouse (optional)
  • OTG adapter and USB hub (for connecting USB peripherals)
  • Bi-directional logic level converter (for 3.3V/5V conversion)
  • Necessary cables and connectors

Getting Started

To begin, we'll need to download the necessary firmware for the Raspberry Pi Pico. Visit the GitHub repository ps2x2pico and download the ps2x2pico.uf2 file.

Connect your Raspberry Pi Pico to your computer and enter bootloader mode by pressing the BOOTSEL button while plugging it in. Then, simply drag and drop the ps2x2pico.uf2 file onto the Pico's mounted drive to flash the firmware.


Wiring Setup

Next, let's set up the wiring configuration. We'll use the GPIO pins on the Raspberry Pi Pico to connect to the PS/2 interface using a bi-directional logic level converter for voltage conversion. Here's a schematic of the wiring setup:

  • Pico GPIO11 (LV1) --- PS/2 keyboard data (HV1)
  • Pico GPIO12 (LV2) --- PS/2 keyboard clock (HV2)
  • Pico GPIO13 (LV) ---- PS/2 5V + Pico VBUS (HV)
  • Pico GND ------------ PS/2 GND
  • Pico GPIO14 (LV3) --- PS/2 mouse data (HV3)
  • Pico GPIO15 (LV4) --- PS/2 mouse clock (HV4)

Ensure proper connections are made, and the voltage levels are compatible using the bi-directional logic level converter.


Build and Setup

Now, let's proceed with the software setup. Ensure you have the Pico SDK installed and set the PICO_SDK_PATH environment variable accordingly.

Clone the ps2pico repository and navigate to the build directory. Use CMake to configure the build environment and then execute the make command to compile the code.


Usage and Enjoyment

With the hardware and software setup complete, it's time to connect your USB keyboard and/or mouse using an OTG adapter and optional USB hub. You can also experiment with wireless keyboards and mice that utilize dedicated USB receivers for connectivity.

Now, relive the nostalgia of classic computing as you interact with vintage PS/2 peripherals using modern USB devices, all thanks to the Raspberry Pi Pico and this USB to PS/2 interface converter.


Further Resources

For those eager to delve deeper into PS/2 protocols and retro computing, here are some valuable resources to explore:

  • PS/2 Keyboard Protocol
  • PS/2 Mouse Protocol
  • Mouse Input on OSDev
  • PS/2 Controller on OSDev

Unleash your creativity and dive into the world of retro computing with Raspberry Pi Pico and PS/2 peripherals. 

Source: Github

0 comments:

Post a Comment