3.2 ITDB02 Shield -----> 2.8 ITDB02 Shield

So I broke my touch screen ...

I've been busy with a new project where I use the 3.2" TFT Touch screen from ITEAD Studio. While testing the application I noticed that the back-light's brightness change every time I push a button on the screen. AHAA!! - Bad connection! So I started pressing on the edges of the screen, to find out where this is coming from...


The screen broke...

Changes to my code

Well, I did not want to re-do all the UI code (I'm using the UTFT libraries) and therefore looked for another display from ITEAD Studio. Unfortunately the only replacement I could get, on short notice, was the slightly smaller 2.8" ITDB02 Shield.

In order for my code to work I had to make the following changes:

The initialization code had to change

Since the display's pinouts are different, I had to change the UTFT LCD initialization and the TOUCH initialization ^1. (I just commented the previous values and left it there for when I get the bigger screen again).

UTFT          myGLCD (ITDB28,A5,A4,A3,A2);    //myGLCD(ITDB32S,38,39,40,41);
UTouch        myTouch(A1,10,A0,8,9);   //myTouch(6,5,4,3,2);

One driver file had to change

Once again, thanks to David^1, this change was also fairly easy. Inside of the HW_AVR_Defines.h file, uncomment line number 7. (This file can be found in the \Arduino\libraries\UTFT\hardware\avr directory)

// Enable or disable the use of a display shield designed for use on
// an Arduino Uno (or compatible) on an Arduino Mega
// ** Currently only available for 8bit display shields **
// Uncomment the following line to enable this feature

 The On-Screen buttons

When running the application for the first time, on the new screen, I noticed that the touch on the screen was flipped on the x-axis. This is quite anoying, if the button is on the left of the screen, you have to press on the right of the screen, etc.

Luckily I found this post^4 from Tumbleweed, who had the same problem and solved it with a bit of easy math. Unfortunately I couldn't used his exact method but I did apply it in the UTouch library and the touch detection on my buttons are now working fine.

Find the UTFT_Buttons.cpp file in the \Arduino\libraries\UTFT_Buttons\ and change it to look like the highlighted code.

int UTFT_Buttons::checkButtons()
if (_UTouch->dataAvailable() == true)
int result = -1;
int touch_x = 240 - _UTouch->getX(); //Added 240- in order to remove the flipped axis
int touch_y = _UTouch->getY();
word _current_color = _UTFT->getColor();

for (int i=0;i<MAX_BUTTONS;i++)
if (((buttons[i].flags & BUTTON_UNUSED) == 0) and ((buttons[i].flags & BUTTON_DISABLED) == 0) and (result == -1))
if ((touch_x >= buttons[i].pos_x) and (touch_x <= (buttons[i].pos_x + buttons[i].width)) and (touch_y >= buttons[i].pos_y) and (touch_y <= (buttons[i].pos_y + buttons[i].height)))
result = i;


At this stage everything seems to be working. If I need to make any additional changes, I'll update it here.


1.  Thanks to David for the review on the Itead Studio website. The only difference between his setup and mine is the screen identifier: Mine is the ITDB28 and not the ITDB24E8, which he used.

2.  ITEAD Studio website for the ITDB28 display

3.  ITEAD Studio Wiki for the ITDB28 display

4.  Tumbleweed's post


Leave a Reply

Your email address will not be published. Required fields are marked *