This is re-post of a blog post I did about 15 years back, I don't know if I would use an Attiny microcontroller if I was to do this today. The price of chips with built in USB is now cost comparable, and hardware USB is more reliable. But it's a fun project and if you happen to have a microcontroller compatible with V-USB it's worth a try.
I was digging though some of my old junk and found a box of old Nintendo stuff and I thought that it might be cool to turn one of the controllers into a USB game pad. Now you can buy a USB NES style gamepad, but what's the fun in that. So, I started looking though my box of electronic parts and found a couple of Atmel Attiny 85 micro controllers. Sweet a chance to try out the AVR-USB library. Now you would think you need a clock crystal to sync the micro controller with the USB, but the AVR-USB library has an algorithm to calibrate the internal oscillator to within +/- 1% accuracy. Which is fortunate because if we had to use a clock crystal, we wouldn't have enough io pins to use this micro controller. Now being lazy I didn't want to have to write the code from scratch, so I used Raphael Assenat's code as a starting point. He has a project on AVR USB community projects, a SNES/NES Gamepad and Atari Joystick to USB Adapter. He was using a different Atmel micro controller, so a few things had to be changed around, and I deleted the stuff I didn't need. Any way it turned out pretty cool, and it makes playing NES emulators way more fun. PS an Attiny 45 would work the only reason I used the 85 is because that's what I happened to have.

Comments
Post a Comment