Arduino Joystick Switch
Please read Liability Disclaimer and License Agreement CAREFULLY
In this article i will describe how to reuse an joystick switch from Sony Ericsson K750, K700, K790, K800, W700, W800, K500, K510, K600, T610.
The part is Panasonic Multi Function Switches Type EVQWH and you can download the datasheet from here.
To use this micro switch on just one analog input of Arduino you will need to create a voltage divider like the one in the picture below
Note: Pin 7 is the metal casing of the switch and must be connected with pin 5.
Part List:
1. Panasonic Multi Function Switches Type EVQWH;
2. Resistors: 2x3.3 kOhm, 1x1 kOhm, 1x4.7 kOhm, 1x10 kOhm, 1x22 kOhm.
3. Wires.
On this part each movement is defined by at least two internal switches:
1. UP Pin 1 + Pin 6 - Req = 0.956 kOhm
2. Down Pin 3 + Pin 4 - Req = 3.197 kOhm
3. Left Pin 1 + Pin 3 - Req = 0.824 kOhm
4. Right Pin 4 + Pin 6 - Req = 6.875 kOhm
5. Center (Push) All pins connected - Req = 0.601 kOhm
Arduino code:
// This program reads the analog value of the resistor paths when the buttons are
// pressed. Combination of buttons generates a unique analog
// voltage reading on pin 0. This analog voltage is then used to identify which
// combination was pressed 1+3=LEFT, 1+6=UP, 3+4=DOWN, 4+6=RIGHT, 1+2+3+4+6=CENTER
//The state of the buttons and readed value is printed into the serial window.
int BP = 0; //The Arduino analog pin where the buttons and resistors are connected to
int BV = 0; //Reading value for analog pin 0
void setup(){
Serial.begin(9600); //start serial and set baud rate
}
void loop(){
BV = analogRead (BP);
if (BV >164 && BV <176){
Serial.print ("LEFT Button is pressed. @");Serial.println(BV);
}
else if (BV >181 && BV <193){
Serial.print ("UP Button is pressed. @");Serial.println(BV);
}
else if (BV >332 && BV <344){
Serial.print ("DOWN Button is pressed. @");Serial.println(BV);
}
else if (BV >408 && BV <420){
Serial.print ("RIGHT Button is pressed. @");Serial.println(BV);
}
else if (BV >508 && BV <520){
Serial.print ("CENTER Button is pressed. @");Serial.println(BV);
}
delay (150);//adjust the delay according to your needs
}
Click to download GVI_RC_CX65.sch
Comments powered by CComment