Jump to content


Unmodified and unopened C64 as a USB keyboard

C64 Commodore 64 Arduino Hardware Hack Keyboard User Port

2 replies to this topic

#1 galax OFFLINE  



  • 747 posts
  • Location:Toronto, Canada

Posted Sat Jul 12, 2014 2:49 AM

This was a very cheap thing to hack together: the C64 was almost free from a garage sale, and I used an $8 Arduino Pro Micro from Aliexpress. I've seen people connect an Arduino directly to the keyboard output, but I wanted to try something using the user port, as it's a very cool feature of the C64. Also I don't have any way to load or save data on the C64 at the moment, so there wasn't much else I could do with it! (the first project probably should have been a tape adapter...)


Hardware-wise, I shared the USB and 5v C64 user port power, and connected the user port data lines from to 8 of the Arduino's pins, configured as digital inputs.


The Pro Micro can act as a USB keyboard (so that bit's easy), so all I had to do was 1) Write a 2 line BASIC program (As short as possible as I have to retype it on power on) that dumps a byte to the user port alternately for the currently pressed key and current modifiers (Ctr/Shift/C=), and 2) Convert the 8 data inputs back into a byte in the Arduino, work out the corresponding key pressed, and send it to the USB keyboard. Seemed responsive enough for any lag to be not really noticeable, but I'd like to give it a more thorough test. IThe data could be pushed to the user port quicker by an assembler loop, which would probably decrease the lag.


Connecting to the C64 was a bit Heath Robinson, as I don't have a proper user port edge connector and it's quite fiddly to build one. if I can construct a better edge connector or find a proper one I'll finish it off and take some photos.


Of course, configurable keys, macros, key combinations for nonexistent keys etc. would all be pretty easy to do in software on the Arduino.

Edited by galax, Sat Jul 12, 2014 2:51 AM.

#2 Mirage OFFLINE  



  • 6,656 posts
  • Have a problem? Hire the Envious Snakes!
  • Location:Milwaukee, WI

Posted Tue Jul 15, 2014 11:44 AM

That is very cool, thanks for posting. I actually recently got a couple Arduino units, but haven't had time to dive into them yet, so don't have the knowledge to do this. Neat idea for a project though!

#3 galax OFFLINE  



  • Topic Starter
  • 747 posts
  • Location:Toronto, Canada

Posted Wed Jul 16, 2014 1:12 AM

Getting started with the Arduino is amazingly simple:

  • Download & install the IDE http://arduino.cc/en/main/software
  • Plug your Arduino into your PC using USB
  • Run the IDE and select an example program.
  • Make sure the correct virtual COM port is selected (there should only be one)
  • Hit the 'upload' button

And that's it, you have code running on the Arduino. Change the code, hit upload again, it's that easy.


My C64's PSU died (probably the reason it was free), so I had to build another one, and I also built an S-video monitor adapter, which makes the display look way better. I ordered some user port connectors on eBay- when I get them I'll finish this off.

Also tagged with one or more of these keywords: C64, Commodore 64, Arduino, Hardware, Hack, Keyboard, User Port

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users