By embedding a PIC microcontroller into an NES controller, it can be converted into a replacement for Apple's iPod remote.
(Only 3rd and 4th Generation iPods have this, it is a the small oval port next to the headphone jack).
It's been quite some time since iPods have used this iPod remote connector, but the dock connector (the one used on all iPods except the shuffle, iPad, and iPhone) has the same Rx/Tx pins, as well as a 3.3V out. A simple breakout board can replace the hacked connector at the end, and you can get this to work with any recent Apple products. You can buy breakout boards at: http://www.kineteka.com/PodBreakout-v1.aspx
(The mini one is pretty nice, and they also have pinout information).
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Parts
Microcontroller- dsPIC30F2011 These can be sampled from Microchip's sample site
Programmer- the drawback to using a dsPIC is the complicated programming procedure. The easiest way to program it is to use a Microchip ICD2, however these run fairly expensive. I have not tried this, but apparently the utilities found at http://homerreid.ath.cx/misc/dspicprg/ can be used with a homemade JDM Programmer.
IC sockets- I used 2 8-pin DIP sockets(a single 18 pin or 16 pin would have also worked). These are necessary for removing and replacing the IC for programming and debugging.
Dremel with a cutting bit
Soldering iron and small gauge electrical solder
Flush cutters, or wire cutters
Standard Ethernet (CAT-5) cabling
A good amount of small gauge wire- I used the innards of extra CAT-5 cable.
3G or 4G iPod.
A plug for the remote jack on the iPod. This is the most difficult to acquire. Several suggestions are made at iPod Linux's site.
I used a small piece of a shattered old memory module that perfectly fit the remote plug, but any of the other solutions also work.
Step 2: NES Controller Prep
Unscrew the controller with a small Phillips head screwdriver, and remove the PCB. The only components that need to be added are the PIC and the sockets to hold it. This way the original look and feel of the controller is completely uncompromised.
First, the NES chip must be removed. If you do not have a desoldering pump, then the IC can be cut off the board with flush cutters, and the pins can be removed with by heating them with a soldering iron, and pulling them out with pliers.
The original NES cable also must be desoldered from the board in a similar manner.
In order to make room for the PIC, a small portion of the board must be cut away from the top-right corner. Only just enough to allow the IC in the socket to sit across the board inside the controller case should be removed. Carefully use the dremel to cut away a section about .25" by 1".
Step 3: Schematic
The circuit within the controller will essentially be the below picture. This picture is difficult to follow, but is a better explanation of how the controller works. The following steps detail my application of this schematic.
Step 4: Wiring the Sockets
The wiring of the controller is very simple in theory, but is complicated by the usage of all original components (the black lines covered with green transparent tape are, in fact, pull-up resistors.)
Much of the wiring can vary based on how much of the board was removed with the dremel. Some of the traces that were cut must be replaced with wire, especially any that connect to the button pads or the pullup resistors.
Note: the pads for the old NES chip are counted counter-clockwise from the notch printed on the back of the controller. PIC pin numbers are counted in the same way.
The colors refer to the colors of the original NES cable wires, and are printed on the back of the board (not the colors in the parenthesis).
PIC pin 1 (Master Reset) --- V+ (NES pin 16)PIC pin 2 (IO 0) --- UP (NES pin 4)PIC pin 3 (IO 1) --- DOWN (NES pin 5)PIC pin 4 (IO 2) --- LEFT (NES pin 6)PIC pin 5 (IO 3) --- RIGHT (NES pin 7)PIC pin 8 (Transmit) --- yellowPIC pin 11 (IO 4) --- A (NES pin 1)PIC pin 12 (IO 5) --- B (NES pin 15)PIC pin 13 (VSS) --- ground (The empty pad near the top right corner that is farther away from the edge)PIC pin 14 (VDD) --- V+PIC pin 15 (IO 7) --- SELECT (NES pin 13)PIC pin 16 (IO 6) --- START (NES pin 14)PIC pin 17 (AVSS) --- ground (Same empty pad as above)PIC pin 18 (AVDD) --- V+
Step 5: Wiring the Cable
Cut a length of Cat5 cable (I used 2 feet), and cut away an inch of the insulation on each end. Cut off all but three wires from the exposed areas.
The 3 wires in the cable each will connect to a pin on the remote plug.
Attaching the connector varies depending on what kind of connector, so I will refer to each wire as its pin on the connector.
Connector pin 1(Receive) --- NES pin 3 (this is connected to the PIC's transmit)
Connector pin 3(Ground) --- brown
Connector pin 4(3.3V) --- V+
Once these three wires have been connected, simply push the cable into the stress relief posts that the old cable went through in the controller case.
There is a severe lack of places to tie into the V+ line. All pins that need to have V+ can be connected directly to each other, but NES pin 16 must be at 3.3V. I used a knife to scrape some of the soldermask off of the trace to create my own pads.
Step 6: PIC
I used a dsPIC30F2011. These and many other PICs can be sampled from Microchip's site at http://sample.microchip.com/
I used a dsPIC instead of a normal PIC because
1. It can run on 3.3V that is provided by the iPod
2. It has 8 I/O ports for all of the buttons
3. It has an easy to program UART module, which can send data to the iPod with no conversion needed.
4. I already had one and a programmer.
Any other microcontroller that you know how to use and meets these requirements can be substituted, but the wiring will be different.
The downside of using a dsPIC is that the programmer is quite expensive (The ICD2 is now $160). There are free tools at http://homerreid.ath.cx/misc/dspicprg/ that can be used with a homemade JDM programmer, but I have never attempted this.
The zipped files are the code for the PIC. It is a project in Microchip's freely available MPLAB IDE . If you want to modify it or recompile it, you will also need Microchip's C Compiler , which has a free student edition. These can be used to generate the neccesary hex file (also in the zip) for programming with MPLAB or the aforementioned JDM programmer.
The code samples the I/O ports 64 times per second, and if there is any change, sends various commands over serial to the iPod.
I used publicly available documentation on the Apple Accessory Protocol (AAP, or iAP) to write the code, and it is talked about at http://www.adriangame.co.uk/ipod-acc-pro.html and http://nuxx.net/wiki/Apple_Accessory_Protocol
Up, down, left, and right are volume up, volume down, previous song, and next song, respectively. A plays/pauses the music, while B stops it. The select button mutes, and the Start button, when held, enables you to control the iPod's interface directly. With start held, up and down scroll the wheel, and A and B operate the iPod's select and menu buttons.
Step 7: Final Assembly
Attach the NES controller case to the board and screw it together. Plug the controller into the remote port on your iPod and press the buttons. The PIC is turned on by simply plugging it into the iPod, which provides power to it. You now have a way of controlling an iPod from 2 feet farther away than ever before.
This instructable contains sharp, fast, and hot objects. Touching them might not kill you. I am not responsible for any forms of cancer that this will likely cause.
Participated in the
The Instructables Book Contest