Introduction: How to Adapt a NES Clone Controller to Bluetooth
So, I'm realy nostalgic and decided to build a NES clone crontoller to bluetooth adapter, because, by this way I could play again that amazing games that we all remenber.
A important thing I need to highlight is that in my city is so dificult to find decent eletronic components and parts, so the only controller type a had in hands its the clone type, but its not complicated adapt this instructable to original NES controller.
The whole system it's so simple, if you PC/notebook have a bluetooh card it's done, if not you just need a Bluetooth USB dongle.
Step 1: What You Need
First of all, if you'll try to build your own NES clone to bluetooth adapter it's supposed you have some electronics and programming skills, otherwise some steps, like the uC programming will be a little hard to do by yourself.
Components and parts list:
1 - Wireless Bluetooth RS232 TTL Transceiver Module;
1 - PIC 12F675;
1 - 5 Volts voltage regulator;
1 - 3.3 Volts voltage regulator;
2 - 1uF capacitor;
2 - 4.7 uF capacitor;
1 - 1k2 ohm resistor;
1 - 2k2 ohm resistor;
1 - 4MHz oscilator crystal;
2 - 22pF capacitor;
1 - A CC power source ( >= 8 Volts);
wire, solder wire, pic programmer, solder iron, universal circuit board, etc;
Step 2: How the Controller Works
Well, let's begin by the start. Let's understand how a NES Controller function, it's important to say that this step independs if the controller it's the original one or the clone one, the internal functionality is the same.
Internaly the controller what we call in digital eletronic parallel-to-serial register, a integrated circuit that store the state of each button (pressed or not) when a "lacth" pulse is given, then the register send each state alwaysa clock pulse is given.
So it's cleare that the controller have 5 wire, they are: VCC, GND, LATCH, DATA, CLOCK.
So the algorithym to read the buttons states is very simple:
1 - Give a latch pulse;
2a - Verify the DATA wire;
2b - Give a clock pulse;
3 - repeat 2a and 2b until all the buttons states were read;
Here are the code sample witch contain the read controller function:
//função de leitura do controle
#define LATCH_CH pin_c0
#define CLK_CH pin_c1
#define DATA_CH pin_c2
//sequencia de leitura
//A B Se St U D L R
int16 val;//combinação dos botões
int i;//variavel de indexação
//zera a variavel
val = 0;
//ativa o pulso de LATCH
//Lê o primeiro botão
val = (input(DATA_CH)<<0)|val;
//Ativa o canal de CLOCK e Lê os 7 botões restantes
val = (input(DATA_CH)<<i)|val;
return val; //retorna a combinação
The code are in C and was written on PICC CCS compiler but is so simple to understand.
The intervals length can be seen more easily in the picture below.
It's more easy find the pin-out diagram of the original NES controller connector in the internet, so in the picture is also show the pin-out diagram of NES clone controller connector.
PS: 3 controllers was broken to discover this :(
Step 3: How the Bluetooth Module Works
This step it's very simple, the bluetooth module came with a default configuration, the device name is "linvor" and the paring code is "1234", both can be set and reset by AT commands.
So just buy one of it and join the party. But here a important information, this module works with 3.3 V and we need 5 V to make the controller works (actually a don't test power on the controller with 3.3V :-) ).
To power on the module you just need to regulate your 5 V source to 3.3 V (with a lm317, lm7833 or other regulator), but the TX pin that came from the PIC microcontroller have 5 V as high logic level, so we need a voltage divider to decrease the 5 V to 3.3 V, this will drive correctly the RX pin on BT module.
The correct connection:
TX_uC_PIN (5 V) ----> voltage divider ----> RX_BT_PIN (3.3 V )
The images below show the voltage divider and the uC pin out.
Step 4: How the PC Software Works
The software just simulate a keyboard key press event, the firmware inside PIC read from the controller wicth buttons are pressed or not in this sequence: A - B - Select - Start - Up - Down - Left - Right. If a button is pressed the respective bit becames '0' otherwise the bit becames '1', so if the gamer pressed the Up, the right and the A button, the bits carrier is: 0 1 1 1 0 1 1 0, or in hexadecimal 0x76, or in decimal 118.
Note that if I was send the buttons information in binary it would take 8 bytes length ("01110110"), if was send in decimal would take 3 bytes ("118") and if it was send in hexadecimal would take two bytes ("76"). But exist a better way to send this information, note that we have 8 bits, so we can send it like a character, if we take a look in the ASCII table 0x76 correspond to 'L' character, so we just need to send 'L' to transfer all the information.
So is this what the firmware does, it sends the buttons states codified like a 8 bit character.
Attached here you found the firmware C code and HEX to burn and the PC software.
Step 5: Assemble!
Here you find some more pictures.
Just a video:
The video were recorded before I built the 12F675 board, so it's shown a 16F877A board, it's make some difference?! rsrs