Blog Arşivleri

Usage of Joystick With Arduino Mega R3

Circuit of Joystick

Circuit of Joystick

At my this project i tried to use a joystick. This component has five pins.
These are Vcc, Gnd, voltage reference 1, voltage reference 2 and switch input.
This joystick based on two potentiometers that gives an analog inputs to the
arduino. This analog signals have values between 0 to 1023.

If you use my connection ;
you will have 0,0 at right up corner and 1023,1023 at left down corner.
We also have a switch. If you press the joystick through
down it will be active.

Best wishes


/* Usage of Joystick With ARduino Mega
* Equipments : 
* 1 x Arduino Mega 2560 R3
* 1 x Jojstick
* My personal blog
* This programme based from

 int joyPin1 = A1; // First analog input for Jostick
 int joyPin2 = A2; // Second analog input for Jostick
 int value1 = 0; // variable to read the value from the analog pin 0
 int value2 = 0; // variable to read the value from the analog pin 1

 void setup() {
 pinMode(joyPin1, INPUT);  
 pinMode(joyPin2, INPUT); 

 void loop() {

 value1 = analogRead(joyPin1); 
 value2 = analogRead(joyPin2); 

 Serial.print("first value : ");
 Serial.print("second value : ");


Shield Design for Arduino Mega 2560 R3

As you noticed my 3.2″ TFT screen has 40 terminal pin and almost all of them will be used.
It is not an plug-in and use screen. So i have desing and shield for my LCD . Be aware to enlarge
other pins. Because after our shield design unused pins must not be under the shield as discarded (inert).

Another important point is; Arduino’s output high level is 5v but screens high input is 3.3V.
(I mentioned about that before). I used 330 ohms resistor and 1K ohms in series as a voltage divider.

PCB Design


My design can be shown from photos.

3.2″ TFT LCD (new)

In my this writing i will introduce my new TFT LCD display.

Front Side

Front Side

Rear side

I bought that screen because my previous screen was not good enough. It couldn’t run all UFTF library and technical support was not sufficient. So i ordered new one from ebay, sellers name is electronics_lee . It is 3.2″ touch screen (1)

first of all i only connected TFT connections without SD card and TOUCH screen pins.
My connections are same as at “UTFT_Requirements” files in page 2 and 4. (2)

Then i faced different problems at the screen. Some random lines/strip occur aat the screen while a process happening in the screen. If you have same problem i highly recommed  to power of the screen because this lines are occur because of high voltage.

Without voltage divider resistor - while screen output is changing

Without voltage divider resistor – while screen output is changing

Without voltage divider resistor - while screen output is constant

Without voltage divider resistor – while screen output is constant

Arduino’s output high level is 5 volts and screen’s high volt is 3.3 volt but tolerated to 5 volts. I used 330 ohms and 1K ohms resisters as a voltage divider for all outputs of arduino. Divided (reduced) voltage goes to the screen.  After this correnction , screen works fine.

After arduino's output is reduced to 3.3 volts by using resistors.

After arduino’s output is reduced to 3.3 volts by using resistors.

(1) 3.2″inch TFT LCD Display module + touch panel & SD card cage for Arduino

(2) Download “UTFT.rar”

Usage of a TFTLCD with Arduino

hi everyone. In this topic , i will share my exrerience about an TFTLCD. I finally managed to work mine. Maybe same of you can have same problems as mines. First of all i want to say where i bought my TFTLCD. I bougth this screen from This website is useful to buy electronics components. Anyway i ordered an 3.5′ TFTLCD for my ARDUINO MEGA 2560 R3. From the info of screen(mcufriend) is says; ” 3.5 inch TFT LCD Screen For Arduino MEGA 2560 Board Description: Parameters:

Dimension :3.5inch

Controller :R61581

Resolution: 480×320

data bits: 8 -16

Interface pin number :37 pin Distance:1 mm Board Colour: Red ”





the problem was that ;

* it was actually 3.2inches

* controller was ili9327

* in wasn’t compatible with utft library (1)

* for this screen, suppliers using a library after modified and without any permission from developer (H.K.) After lots of try i contacted with supplier and send me an old and modified UTFT library. It works barely. I have done what i want to do for my project. I won’t add the files of modified UTFT library or won’t give the name of supplier. But best way getting the files is from the supplier. If you are confused about ordering an TFTLCD choose a proper one from (1) Henning Karlsen’s website. “UTFT_Supported_display_modules_&_controllers”. Proper codes of lcd has at website of Henning Karlsen’s (1). So have a nice project to you. (1) – UTFT Library is an ” Arduino and chipkit Universal TFT display library ” that created and developed by Henning Karlsen. Further more information visit :