With venues rapidly opening back up and certain restrictions being lifted, the infamous Benjamin Heckendorn (known as Ben Heck) wanted a way to be more social whilst gaming at the Midwest Gaming Classic Game Night's event. His plan was to create a device that required intense collaboration from each participant, and although his initial ideas did not pan out, a later one did: the Social NES Controller.
This modified Nintendo Entertainment System controller would feature specialized internal circuitry that is able to randomly assign its buttons to three different controllers. In essence, three players must work together with their limited number of buttons to move a single character. If one player got assigned the A button while another was assigned the B button, then the first would have to coordinate their jump movements with the other player's shooting.
The NES uses a clever system to get data from the controllers attached to itself. Each one contains a single 8-bit shift register that acts as a parallel to serial converter. When the incoming latch signal is set to high by the NES, the current states for all of the buttons are loaded into the shift register. Next, the NES pulses the clock line eight times with a delay of 12us per clock cycle which causes the pin's value to be sent over the data out line. This entire process occurs 60 times a second (60Hz) to load in new button data.
Heck wanted to avoid hacking up the three individual NES controllers, so he instead collected a few NES controller ports that have the pins broken out on the back. He was then able to solder these to a piece of perf board. The main microcontroller used in this device is the ATtiny1614. It is a newer AVR MCU that has 16KB of flash and 2KB of SRAM, plus it can run at 20MHz which allows it to process signals in the background whilst the NES is still catching up. Additionally, this ATtiny differs from older ones in that it has dedicated serial peripherals such as UART, SPI, and I2C rather than just a generic serial peripheral that's found in the ATtiny 85/45/25 lineup.
The data lines mentioned previously are all fed into their own GPIO pins that can be read by the MCU. The three sets of clock and latch pins are all tied together and controlled by just two GPIO pins.
The aim of this project was to randomly choose which pins get to be pressed by a certain player, but Heck quickly realized that this was a large task due to certain conditions needing to be met all of the time (no overlapping buttons, every button must be usable, etc.). In order to remedy this, he set up a state machine that switches the ability of each controller to either use the A button, B button, or D-pad. Thus advancing the state will modify what the controllers can do.
When the NES asks for new data via the latch pin, the ATtiny quickly reads in the correct data from each controller according to what buttons it's set to and then stores it within a byte. This byte is transferred to the SPI peripheral's transmit buffer where it is then clocked out by the NES. Heck also added a small speaker and an LED on the top to notify players when the controller roles have changed.
Heck tested his new social NES controller by playing some Contra, and as seen in his build log video, he's quite talented at it. The controller in his right hand was used to operate the character's weapon, the one in his left hand was for movement, and the one on the floor operated by his foot was for jumping.
He also added the ability to change how often the controllers would get reassigned to players via the button, with intervals of 10, 20, 30, 40, 50, 60, and disabled. And one fifth of the time, the state will be randomly selected for an extra challenge.