An adapter to interface a NES Mini Controller (or a SNES Mini Controller too, both I2C devices) with a PC as a generic USB Gamepad; based on an attiny85.
The microcontroller uses the v-usb library to create a low-speed usb device (the gamepad) and implements some homemade code in order to process the I2C signals from the controller.
The source code (among with some extra explanations about how it works) is available on my github! https://github.com/theisolinearchip/nesmini_usb_adapter
So the SMD boards are finally here! I ordered five of them and started testing the first one (and it works as expected! : D).
The board came fully assembled except for the biggest and more "external" components (micro socket, led and wiimote connector) but beside the five-to-ten minutes soldering time it's kinda "plug and play"! : D
I need to run some additional tests (and maybe design a fancy case for the whole device) but chances are that this will be the final-release-ready-to-be-deployed-to-the-world! Stay tuned!
There're a couple of somehow important main changes/updates related to the project:
An extra capacitor was added for the attiny85 (also I was using polarized caps and that was not necessary at all).
A couple of 10k resistors were added in order to provide the pull-up lines for SDA and SCL. Yup, that's like the 101 for all the I2C communication, but the old design will work without problem as long as the controller is connected. Why? Well, I think it uses it's own internal pull-ups, so that "does the trick" (but as soon as it gets disconnected the system gets stucked 'cause there's nothing pulling the lines up).
The last firmware revision can detect a disconnected controller (related to the previous point) and re-connect itself on-the-fly (it's kinda pointless with the NES Mini Controller, but the SNES Mini one requires a specific startup bytes sequence to be written on it before being able to start sending the proper data).
Also the firmware uses now this I2C library that works with the native two-wire mode on the attiny85 instead of using the pure-software bit-banging approach I wrote before (I made that library too! Here's the hackaday.io project page! : D)
And I ordered a few PCBs with all those changes! It'll be my first SMD-and-already-assembled board (with some extra components I'll manually add later) so let's see how it goes and if everything's right!
So, in conclusion: expect some testing PCBs soon with the improved design and updated firmware!
It's been a while since the last time I wrote stuff about the adapter, but I've been working into something behind the scenes!
Now I have PCBs! : D
It's a custom design for the exact same thing you can see in the protoboards: attiny85 + usb stuff + wii connector + status led. Nothing more, nothing less. Featuring:
Designed with KiCad (from the schematics to the gerber files). This was actually my third PCB attemps (after the dices)
Also first time I made a custom symbol for something to be added on a manufactured board (I couldn't find any wiimote connector symbol, so I measured everything and made my own design - and it works really nice! : D)
The first batch was almost useless because I messed up with the wii connector and mirrored some pins (my bad! :_ D), so this is actually the SECOND group of boards I ordered.
I added a breakout for an AVR programmer in case I wanna reflash the firmware without removing the micro.
And that's it! I ordered 10 units and tested a couple of them and everything seems to work fine both with SNES and NES Mini controllers (although the SNES Mini one requires some special boot sequence, so it needs to be plugged BEFORE powering up the device - yup, a firmware update is required to handle this via software, indeed).
I'm not sure if anyone would be interested in having one of those boards (since it seems I may have some spares after this first experiment). I'm thinking maybe on some small shop or delivery mechanism, but honestly I don't know. Let me know if you're interested and your thoughts about the whole project!
As next steps:
Some firmware updates (autoconnect detection for the SNES Mini variant, basically)
Sell / distribute / share the boards if someone is interested? Not sure about this, but I'll think about it.
Convert it into a multi-controller universal adapter like the many you can find out there on the Internet (I started this one partially inspired by this old Retro Adapter I read about). But I'm almost sure this approach will require a different micro with more pins than the attiny85...
Maybe I make a fancy 3d-printed box for the board with my raw-box-designing skills.
And that's everything I have for this update! Let me know any question or suggestion you may have about the project! : D
Emulating a "regular" HID gamepad is cool but, it's possible to use V-USB to have a valid XInput device like the XBox Controllers?
Those controllers are full-speed USB devices, and the only types the V-USB library can handle are the low-speed ones so, maybe... not...?
Well, I tried a couple of things and manage to have a valid low-speed XInput device BUT with very limited support (only the "non-analogic" buttons). Also, I'm pretty sure this is a totally non-standard movement and it will eventually crash, fail or just stop working :_ D