• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
Retro Game Coders

Retro Game Coders

Retro computer/console game + dev community

  • Home
  • About
  • Blog
  • Retro Resources
    • Retro Gaming Timeline
    • Browser C64 Emulator
    • Best Retro YouTube Channels
    • New Retro Books
    • Raspberry Pi Amiga Emulation
    • MiSTer FPGA Tutorial
    • BMC64 C64 Pi
  • Contact
Home » Emulation

Cheap and Easy Arduino C64 Keyboard to USB Adapter

Ever look at your Commodore 64 keyboard and wish you could use it with Vice emulation or PETSCII art programs? There are expensive but feature-rich commercial products such as Keyrah that do the same thing, but can we do it quickly and on the cheap? YES!

Real C64 Keyboard with Vice C64 Emulator on Mac
Real C64 Keyboard with Vice C64 Emulator on Mac

Notice this notice

While this project READS from the keyboard and so is relatively safe, you do still need to be careful because there are pins on the Arduino that output current. Make sure everything is connected correctly while power is off and if you see smoke or smell burning, pull the plug!

This project is here because through my own tired, careless stupidity, I managed to kill my Ultimate 64. After talking about how careful you need to be while using the user port on a C64 if you don’t want to burn up something difficult to replace.

What you need

This project requires:

  • Working C64 or Vic 20 keyboard
  • Arduino Pro Micro (or Leonardo)
  • Jumper wires
  • Optional LED and resistor
  • USB cable

For now, the Arduino needs to be a version that is compatible with the Pro Micro or Leonardo because those use the ATmega32U4, which can emulate a keyboard directly, but I am going to test a version that ought to work on more boards after I have the key mapping all worked out on my known working configuration.

There are others that can do this, such as the expensive Teensy, but the Pro Micro has just enough pins to work and they are super cheap, especially if you don’t mind waiting for slow shipping. If you are in a hurry, you should be able to pick them up on Amazon etc.

Connect the Arduino pins to the Commodore 64

C64Arduino
202 (SDA)
193 (SCL)
184 (A6)
175
166 (A7)
157
148 (A8)
139 (A9)
1210 (A10)
1116 (MOSI)
1014 (MISO)
915 (SCLK)
818 (A0)
719 (A1)
620 (A2)
521 (A3)
4Not Connected
31
2Not Connected
1Ground

In addition, I wired up an LED with the long leg of the LED connected to VCC and the short leg connected to a 220 ohm resistor and then to Ground. This makes the LED light up when the Arduino is powered.

Programming the Firmware – July 2021 Update!

You might recall a previous, longer incarnation of this article.

Well, since I originally published, it had been bugging me that we had to choose between convenience and capability, and between firmware that was supported and firmware that was not just from years gone by but could not be uploaded using anything but certain versions of Windows.

So I got to work, and produced new firmware that works on Vice, BMC64, Ultimate64 and MiSTer FPGA (though I am still working out the quirks of that last one – watch this space).

Download the code from the C64 usb keyboard firmware repo here and add the HID library, then uncomment to set the key mapping you want, for example uncomment the BMC64 line if you want to use the keyboard with BMC64.

Testing Continues …

If you like it, share it! (Please - because it really helps)

  • Tweet
Category: EmulationTag: arduino, c64
Previous Post: « Commodore Electronics Programming Electronics with the Commodore User Port Part 1: Blinking an LED
Next Post: C64 “Security System” / Digital Input (Programming Electronics with the Commodore 64 Part 2) »

Retro Game Coders

Retro computer/console game + dev community by Chris Garrett

  • Facebook
  • Twitter
  • Instagram
  • YouTube

Maker Hacks ・ Geeky Game Master

© Copyright 2021 Chris Garrett

Privacy ﹒ Terms of Service

Return to top