Introduction: Connect NDSL With ARDUINO

Nintendo DS has GBA bus, so I made it transmittable with ARDUINO.

What you can do with it :
transmit data between arduino and ndsl.
so, you can use your ndsl to arduino's wireless lan or arduino to your ndsl's digital IO port!


What you need:
Hardware :
NDSL GBA cart cover
nintendo Y driver (eventhough you don`t have, no problem!)
some wires (3 wires, enough! 4 wires GREAT)
cutter knife,
soldering iron,
solder,
ARDUINO
:) Nintendo DS Lite

Software:
devkitpro
libnds (for nintendo development)
arduino

How it works:
NDSL has GBA bus. It has /WR pin and External interrupt pin.
If you access gba bus, /WR will toggled, so I can use /WR to send data.
However, it lasts just 350us. It mean you cannot use this pin to digital I/O pin directly.
So I mimic NEC REMOTE CONTROLLER protocol(TV, VIDEO etc...)
External interrupt pin is used to receive data, /WR pin is used to send data.
ARDUINO works exactly same way.


these are my youtube video.

http://www.youtube.com/watch?v=CnBe5NonHLA
http://www.youtube.com/watch?v=B3aEGCiGEaA
http://www.youtube.com/watch?v=BddcjIB_sPQ

What's new? What's GOOD:
You can use your slot1 device already you have.
In addition to, If you have arduino already, making your own gba connector is cheaper than buy another transmittable slot1 or slot2 device.

DISCLAIMER
DO NOT ACROSS GND VCC WIRES!
>>If you did it already, your ndsl's fuse was blown.
>>Google it "ndsl fuse blown"


Let's start!

Step 1: Soldering

1. open GBA CART COVER, with Y driver.
(if you dont have Y driver, you can do with soldering iron. just make a circle around screw. then you can take of cover's top. )

2. soldering wires to 3 points.
/WR (3rd), EXTERNAL INTERRUPT(31st), GND (32nd, last) (VCC 1st, optional)

3. assemble your cart.
(before step3, you may need to cut some part of your gba cart cover. just make a hole to wires can pass out. )

(soldering VCC (1st) pin will make you to using ARDUINO without external(additional) power supply.
This is optional.)

CAUTION!
if you soldering wires too closely to your pin's end, it will make your cart don't fit your GBA PORT anymore. soldering wires as possible as away from pin.

Step 2: Connect NDSL With ARDUINO!

let's connect NDSL with ARDUINO.

 NDSL                                            ARDUINO
/WR(3rd) -------------------------  digitalpin 2 or 3.(in my case 2)
EXTERNAL(31st) --------------  any digitalpin (in my case 5)
GND(32nd, last) ----------------  GND
VCC (1st)  ---------------------  3.3v (this is optional)



Step 3: Libraries

for send & receive data, you need both NDSL library and ARDUINO library.

this step will tell you how to use libraries.

1. download from http://code.google.com/p/ds2arduino/
2. extract  it
3. you can see ARDUINO and NDSL directories.

For NDSL
-test homebrew
complie it. If you press UP key, it will send Data.
Receive data will automatically triggered by ARDUINO.

- make your own program
copy include directory and source directory to your project's main directory.
(in other words, make include directory, copy header file. then copy cpp file to your source directory.)

include ds2arduino.h file
initialize with ndslArduino.initialize();
send data with ndslArduino.sendData(DATA WHAT YOU WANT TO SEND);
get data with ndslArduino.getData();

sendData can transmit 32bit once.
getData will return uint32 value.


For ARDUINO
-test program
copy ARDUINO\libraries\ds2arduino to your library directory.
open ds2arduino.pde
uncomments commands what you want.
Let's test it!

- make your own program
include ds2arduino.h file
initialize with ndslArduino.initialize(OUTPUT PIN, INPUT PIN MUST 2 or 3);
(output pin can be anyone among digital pins. input pin must be one of 2 or 3.)
send data with ndslArduino.sendData(DATA WHAT YOU WANT TO SEND);
get data with ndslArduino.getData();

sendData can transmit 32bit once.
getData will return uint32_t value.

CAUTION
-NDSL library use timer1 interrupt.
-ARDUINO library use timer1 interrupt, External interrupt.
-If you repeat sending data too rapidly, it can be corrupt.
- DO NOT link VCC and GND directly!!!!!!! YOUR NDSL'S FUSE WILL BE BLOWN!!
(first time, it's okay. But second time, your NDSL will not power up anymore.)


MY youtube videos.








NDSL sends counter data starts from 0.
Everytime clicking + PAD, counter is incresed.
If data is even number, LED is off.
If data is odd number, LED is on.



Arduino source code is here.
NDLS source code is attached in library archive.

Code:
#include "ds2arduino.h"
uint32_t temp = 0;
void setup()
{
    ndslArduino.initialize(5, 2);
    pinMode(13, OUTPUT);
}

void loop()
{
    temp = ndslArduino.getData();
    if(temp & 1) {
      digitalWrite(13, HIGH);
    } else {
      digitalWrite(13, LOW);
    }
}

Step 4: END.


Thank you for reading.

I tested only with my NDSL and ARDUINO, so there can be problem.

If you have any question or find problem, SEND me the mail.

hounjini at gmail.com