Menu
- About
- Ham Radio
- NL SwapShop
- NL SOTA Association
- 3D Models
- Linux
- Raspberry Pi
- Windows
- Software
- Photo Gallery
- Contact
- Search

Raspberry Pi Project

Installing And Using A TFT Touch Screen On A Raspberry Pi

To add onto the already neat raspberry pi I purchased a 2.8" 320x240 touch screen. The
screen works out to be roughtly the same size of the PI which makes installation and making
a case for it easy. It also does not require any external power and can be powered directly
off the PI's internal power system. The particular screen I used is the Adafruit 1601. I used the
instructions from the adafruit website, but below are the instructions I followed to get the screen up
and running.
Physical Assembly
To get to use the screen you have to get some soldering done and assemble the pins onto the screen's circuit board. It isnt as hard as it seems follow the included paper leaflet and take your time and make sure you dont solder across the pins. Once soldered turn off the PI and simply place and insert the touchscreen onto pi. Turn the pi back on and boot into the OS as normal the raspberry pi.
Software Installation
With the hardware part behind us we now need to install the software so we can use the screen. First Click here to download all the software required and extract the files via the following:
Before we install the files we want to update your PI:
Now install the touch screen software:
Now reboot to let the above take affect:
Software Drivers
Test the drivers by running the following. The screen will flicker on and off and then the last 2 commands will start X on the screen. It wont function as a touchscreen yet but you should get a desktop.
Hit CTRL+C to cancel and go back to the console....now we will make the screen auto load on start up
Edit the modules file:
add the following lines to the file
Modify Modprobe:
add the following into that file:
Explanation:
The rotate= variable tells the driver to rotate the screen 0 90 180 or 270 degrees.
0 is portrait, with the bottom near the "Adafruit Logo"
90 is landscape, with the bottom of the screen near the buttons.
180 is portrait, with the top near the "Adafruit Logo"
270 is landscape, with the top of the screen near the buttons.
The frequency= variable tells the driver how to fast to drive the display. 32MHz (32000000)
is a pretty nice 20 FPS rate but if your screen is acting funny, try taking it down to 16MHz
(16000000)
Now reboot to make changes stick
look at the console output (or run dmesg in the console window after logging in) you will see the modules install. Look in particular for the STMPE610 detection and the ILI9340 screen frequency. Once
rebooted log in and we can finish the rest of the setup.
The following will let the touchscreen work in landscape mode (your display and touchscreen
have to be the same):
In this new file enter the following
Now try X windows again...
If all goes well X should start again....hit CTRL+C to get back to the console
If you dont want to have to keep typing "FRAMEBUFFER=/dev/fb1" every time you want to start X you
can put it in your profile so it does it automatically for you.
And add the following under the line that starts with "#mask..."
Calibrate Touchscreen
Although I found mind pretty spot on every touch screen should be calibrated to make sure your touch is precisely measured.
In this new file enter the following:
Remove and re-install the touchscreen with
The touchscreen file should point to eventX where X is some number, that number will be different on different setups depending whats plugged into what slot
Install the calibrate software
After running the following touch the screen in several areas. You should get various output of where you
have placed your finger:
Now finally run the follwing and run through the prompts to calibrate your screen. Ideally use a
stylus but a finger will do.
Test the drawing ability of the screen via:
Playing Video
Ideally the video should be sized to 320x240, this will save a lot of cpu time and resouces. But run the following and replace the FILE.MP4 with your movie file. If you dont have mplayer installed run "sudo apt-get install mplayer" first.
Displaying Images
You can display images directly from the console but first you need the software to do so
Now run the following replaceing MYFILE.JPG with your file
Controlling The Backlight
Either to save some voltage or just to save wear and tear on the screen LED you can turn on and off the light that drives the screen. First we set up access to the lighting which turns off the light as well.
To turn on the screen
To turn off the screen