How to use ITEAD's 2.8" LCD touch screen for Raspberry Pi (v2.0)

How to use ITEAD's 2.8" LCD touch screen for Raspberry Pi (v2.0)

Small TFT LCD touch screens, such as the "RPI 2.8 TFT Add-on" from ITEAD studio, which mount on top of the Rasperry Pi, make it possible to turn to your Pi into a self-contained "appliance" which you can interact with by touching a colorful graphic display - running your own custom application, or a retro game, or the X desktop. Or maybe you like to see the console messages as your Pi boots, even when it's not plugged into a monitor. Or display a log of readings or status messages. Or...

The RPI 2.8 TFT Add-on is an excellent LCD touch screen - 2.8", 320x240 pixels, 64k colours with resistive touch, plus a GPIO passthrough connector and serial and I2C ports for makers - and it's very inexpensive! That's why we chose to resell these display boards - they're an excellent product at a great price and they're ideal for hardware tinkerers.

Just one problem - ITEAD provide limited documentation.  The essential specs, inlcuding schematics are provided, but to get these boards working, there's a lot you need to figure out for yourself.  So here's what you need to do to setup and use these display boards - it's not so hard when you know how...


To install the hardware, power down your RPi (model A+, B+ or RPi 2), plug the display board into the 40-pin GPIO connector, then apply power to the Pi again.  That's all.  The display should be lit, and every pixel white.  

[These instructions assume that you're using Raspbian, as it's the operating system recommended by the Raspberry Pi Foundation, and that you're working at the command (shell) prompt. If you want to set up Raspbian, see my guide here.] 

To begin, ensure that Raspbian distribution is up to date, with:

sudo apt-get update
sudo apt-get dist-upgrade

then press 'Enter' to continue, and then reboot with 'sudo reboot'.

When the Pi has rebooted, check the Linux kernel revision with 'uname -r'.  At the time of writing, the current revision is "4.1.7-v7+".  If your kernel is still at an earlier revision (lower number) than this, the distribution upgrade step failed and these instructions might not work for you.

Recent kernels include a "framebuffer driver" which supports this display.  To enable and configure it, we need to add a line to the "/etc/modules" file.

Use your favourite editor to edit "/etc/modules" (you'll need to use 'sudo' to access it, e.g. 'sudo nano /etc/modules') and then add the following as a separate line:


If you followed my Raspbian setup instructions, enabling the SPI and I2C interfaces, your "/etc/modules" file should now contain:


Now create a "/etc/modprobe.d/fbtft.conf" file (as usual, you'll need to use 'sudo', e.g. 'sudo nano /etc/modprobe.d/fbtft.conf') and then add the following as a single line - you may need to scroll right to see it all:

options fbtft_device name=itdb28 gpios=reset:5,dc:6,wr:12,cs:13,db00:20,db01:21,db02:22,db03:23,db04:24,db05:25,db06:26,db07:27 rotate=270

After a reboot ('sudo reboot'), the display should now clear to black, indicating that the display driver is working, and the "dev" directory should now contain a "fb1" file (the device interface for our new display).

Now to display something on it!

Displaying console text

If you want to see console messages on the LCD display as your Pi boots (personally I find it reassuring to see that there's something happening when my Pi is booting...), append 'fbcon=map:10' to the end of the single line of text in "/boot/cmdline.txt". As usual, you'll need to use 'sudo' to access it, e.g. 'sudo nano /boot/cmdline.txt'.

Your "/boot/cmdline.txt" file should now consist of the single line:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbcon=map:10

When you reboot ('sudo reboot'), the boot status messages should appear on the LCD screen.

That's great, but the text is a bit big - a smaller font would be better suited to the small display.

You can select a smaller font for the console with: 'sudo dpkg-reconfigure console-setup'.

Select "UTF-8" encoding (cursor up/down to select, then press Enter), then "Guess optimal character set", and then the "Terminus" font.  FInally, you get to select the font size: "6x12" works well with the RPI 2.8 TFT display.

When you reboot again, more console messages will be visible - but still quite readable!


Finally, now that you have a little console display, it can be frustrating to have it blank out after 30 minutes, especially when there's no easy way to "press a key" to unblank it.  The "correct" way to disable console blanking is to edit the "/etc/kbd/config" file (you'll need to use 'sudo' to access it), and change "BLANK_TIME=30" to "BLANK_TIME=0".  

Unfortunately, this setting is ignored in the recent "Jessie" release of Raspbian, so if you're running Jessie you need to append 'consoleblank=0' to the end of the line of text in "/boot/cmdline.txt".

Your "/boot/cmdline.txt" file should now consist of the single line:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbcon=map:10 consoleblank=0

And, as usual, you'll need to reboot for this change to take effect.

X Windows

If you want to display the Raspbian graphical desktop on the LCD screen (perhaps you have have an X Windows application you'd like to run on it), the first step is to modify the "/usr/share/X11/xorg.conf.d/99-fbturbo.conf" file.  By default, this file tells X to use an "fbturbo" display on /dev/fb0 and we don't want that, because our LCD display is on /dev/fb1.

There are a couple of possibilities here, depending on whether you intend to use X Windows on more than one display.

If you have more than one graphical display, such as the LCD screen and an HDMI-connected monitor, you can disable the reference to /dev/fb0 by placing a '#' at the start of the line containing 'Option "fbdev" "/dev/fb0"', which comments that line out.
You could then start X Windows on the LCD screen with 'FRAMEBUFFER=/dev/fb1 startx'.
And then if you wanted to start X Windows on your other screen, you'd to the same, but with /dev/fb0 instead of /dev/fb1.

However, if you're only going to use X Windows on your new LCD screen, it's easier to change the framebuffer reference from "fb0" to "fb1".

To do this, edit the "99-fbturbo.conf" with, for example:

sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf

You should at least replace "/dev/fb0" with "/dev/fb1", but you can also change the other lines to something more appropriate if you wish, such as:

Section "Device"
        Identifier      "TFT framebuffer FBDEV"
        Driver          "fbdev"
        Option          "fbdev" "/dev/fb1"

You can now start X Windows, with simply:


The familiar Raspbian desktop should now appear on the LCD screen, and if you plug a mouse into your Rasbperry Pi, you should be able to move the mouse pointer and open programs on the little LCD...

Setting up the touch screen

Of course, since we have a touch screen, it would be much better to be able to touch the screen to control our graphical applications, instead of a mouse!

To enable the touch screen, we need to tell the Linux "device tree" system to load the appropirate driver when the Pi boots.

Edit the "/boot/config.txt" file with e.g. 'sudo nano /boot/config.txt' and then add the following line:


If you followed my Raspbian setup instructions, enabling the SPI and I2C interfaces, your "/boot/config.txt" file should now contain, in addtion to a lot of commented lines:



After rebooting, you can check that the touch screen driver loaded ok with: 'dmesg | grep -i ads7846'

You should see lines similar to:

[ 4.115161] ads7846 spi0.1: touchscreen, irq 497
[ 4.122790] input: ADS7846 Touchscreen as /devices/platform/soc/3f204000.spi/spi_master/spi0/spi0.1/input/input0
[ 6.872900] fbtft_device: ads7846 spi0.1 2000kHz 8 bits mode=0x00

Before using the touch screen, we need to calibrate it.

​First, install the packages we need, with:

sudo apt-get update
sudo apt-get install libts-bin evtest xinput python-dev python-pip
sudo pip install evdev

Then calibrate the touch screen with:

sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/event0 ts_calibrate

Touch the screen at each point (marked by crosshairs) in turn - one in each corner and a final one in the centre - preferably with a stylus for greater accuracy.


At this point, if you have for example a Python program (perhaps built with pygame), you can use it with your new LCD touch screen.

But if you plan to use X Windows, you'll need to tell X to use the touch screen as an input device.

To do that, edit the "/etc/X11/xinit/xinitrc" file with e.g. 'sudo nano /etc/X11/xinit/xinitrc' and add the following line before ". /etc/X11/Xsession":

DISPLAY=:0 xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axis Inversion' 1 0

your "/etc/X11/xinit/xinitrc" file should now contain:

# Touchpanel: Invert X axis
DISPLAY=:0 xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axis Inversion' 1 0

# invoke global X session script
. /etc/X11/Xsession


If you now start X Windows ('startx'), you should be able to use a stylus, or your finger, to control the desktop.


That's it!  Congratulations, we're done!

Posted by David Meiklejohn

Products related to this article

Add to Cart

Related Articles

Setting up a new Raspberry Pi for electronics hobbyists and makers

Installing Raspbian on an RPi and setting it up for electronics / making - with I2C, SPI, SSH and WiFi enabled

2 comments on this article - view comments

0 Comments To "How to use ITEAD's 2.8" LCD touch screen for Raspberry Pi (v2.0)"

Write a comment

Your Name:

Enter the code in the box below:

Your Comment:
Note: HTML is not translated!
Powered By OpenCart
Gooligum Electronics © 2017