It all belongs to one of the guys from Circuit Bent an aussie electronic music duo based here in Melbourne. They wanted to use the enclosure from the NES as a MIDI controller on stage, i've fallen deeper and deeper into the rabbit holes of Arduino and MaxMSP over the last 6 months - looking at the box I realised it'd be dead simple to wire the controller sockets into the Arduino board so they could plug in the unmodified controllers and use them as assignable MIDI controllers. There's plenty of space in the enclosure to house both the Arduino board and the Korg Nanokontrol pcb, with some neat dremel cuts and two female USB ports installed on the side for each it would be a pretty sweet little unit.
I checked a pinout diagram for the NES online, pretty straightforward:
The state of the controller is fed out in the following order: A button, B button, select, start, up, down, left, right - fed sequentially into a stream of 8 bits. This gets polled by the sketch at a constant interval then interpreted as discrete button presses. Thinking it was a discrepancy with timing I adjusted the polling interval to match that of the original NES, but serial data still didn't match the button presses.
I'm assuming it's something to do with the resistors but it wasn't enough of a concern to warrant troubleshooting it.
I removed the pcb and soldered new leads, bits now being sent/received correctly.
Converted the bitstream to serial strings, then to MIDI messages. Successfully received in Ableton in a draft custom Max For Live object with single controller input.
Many example sketches for NES controller input use the NESpad library, though this and almost every other approach I took wouldn't support 2 controllers natively. I found a fork of this library called snespadplus built intentionally to address this issue - allowing two controllers to be read at the same time without having
to poll them individually or create multiple instances of the NESpad/SNESpad object.
I had to mod the SNESPadPlus library to make it work with the NES bit ordering. The SNES recieves bits in the following order: B, Y, SELECT, START, U, D, L, R, A, X, L, R
TBC
Clock and latch pins are shared between controllers with only the datalines taking separate inputs on the arduino. I made up a protoshield for the project and connected it up.
No comments:
Post a Comment