📜 ⬆️ ⬇️

Touchscreen from Nintendo DS and Arduino

Suddenly I ordered myself a small Nintendo DS touchscreen and I wanted to connect it to the Arduino, about what happened ...
touchscreen nds


Problem


The first problem is how to connect, since there is no connector, there is no place to pick it out, and it is expensive to buy (about $ 4-5, with a screen price of $ 2-3). So, take a scalpel, a blade or small scissors and carefully cut the cable along, after which you can easily solder the wiring, the main thing is to isolate them, for example by doing this:
touchscreen nds


Connection and programming


Free translation from the Arduino forum :
We look at the screen so that the loop is at the bottom right, then the contacts go in the following order:
TOP | LEFT | BOTTOM | RIGHT

We connect to Arduino

LEFT 2
BOTTOM 3
RIGHT 4
TOP 5

We also connect 2 wiring to analog inputs:
TOP 3 ( 5)
RIGHT 4 ( 4)

touchscreen nds arduino


Sketch

Modified code from Robin Whitfield and Marco Nicolato (code for the touchscreen itself)
#define Lo 2 // LEFT 2
#define Bo 3 // BOTTOM 3
#define Ro 4 // RIGHT 4
#define To 5 // TOP 5

#define Ti 3 // TOP 3 ( 5)
#define Ri 4 // RIGHT 4 ( 4)

//
int touchX = 0;
int touchY = 0;

void setup() {
Serial.begin(9600);
}

void loop() {
if (touched()) {
// /
Serial.print(touchX);
Serial.print(",");
Serial.print(touchY);
Serial.println();
delay(100);
}
}

boolean touched() {
boolean touch = false;
pinMode(Lo, OUTPUT);
digitalWrite(Lo, LOW);
pinMode(Ro, OUTPUT);
digitalWrite(Ro, HIGH);
pinMode(To, INPUT);
pinMode(Bo, INPUT);
delay(10);
touchX = analogRead(Ti);
pinMode(Bo, OUTPUT);
digitalWrite(Bo, LOW);
pinMode(To, OUTPUT);
digitalWrite(To, HIGH);
pinMode(Ro, INPUT);
pinMode(Lo, INPUT);
delay(10);
touchY = analogRead(Ri);
if(touchX < 1000 and touchX > 0 and touchY < 1000 and touchY > 0)
touch = true;
return touch;
}

Total


As a result, after launching to the console / terminal / your_processor, the coordinates of the pressure point fall out, the error is + -2 points, the value on both axes is from 100 to 900, but apparently depends on the screen model, they write on the forums from 0 to 1000, and from 200 to 500
')
UPD: tronixstuff.wordpress.com/2010/12/29/tutorial-arduino-and-the-ds-touch-screen - an even simpler connection option

Source: https://habr.com/ru/post/108972/


All Articles