# Adafruit 2.2" PiTFT HAT - 320x240 Display

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/021/877/medium800/adafruit_products_2315_top_display_01_ORIG.jpg?1419020120)

The cute PiTFT got even more adorable with this little primary display for Raspberry Pi in HAT form! It features a 2.2" display with 320x240 16-bit color pixels. The HAT uses the high speed SPI interface on the Pi and can use the mini display as a console, X window port, displaying images or video etc. Best of all it plugs right in on top of your Model A+ or B+ and fits into our case quite nicely.  
  
It's designed to plug directly onto the Pi Model A+ or B+. While not specifically designed for Pi Model A or B, [you can use it with A/B if you solder in an extra-tall 2x13 header (not included)](https://www.adafruit.com/product/1658) instead of the included 2x20 header

![](https://cdn-learn.adafruit.com/assets/assets/000/021/878/medium800/adafruit_products_2315_iso_demo_case_ORIG.jpg?1419020167)

This design uses the hardware SPI pins (SCK, MOSI, MISO, CE0, CE1) as well as GPIO #25. All other GPIO are unused. Since we had a tiny bit of space, there's 4 flat tactile switches wired to four GPIOs, that you can use if you want to make a basic user interface. For example, you can use one as a power on/off button.

All the other pins are available on a 25-pin long breakout line.

![](https://cdn-learn.adafruit.com/assets/assets/000/021/879/medium800/adafruit_products_2315_top_display_02_ORIG.jpg?1419020219)

To make it super easy for use: we've created a custom kernel package based of off Notro's awesome framebuffer work, so you can install it over your existing Raspbian (or derivative) images in just a few commands.

![](https://cdn-learn.adafruit.com/assets/assets/000/021/880/medium800/adafruit_products_2315_kit_ORIG.jpg?1419020239)

Comes as a fully assembled display PCB and an additional 2x20 GPIO header. Some light soldering is required to attach the 2x20 GPIO header to the HAT but it's fast and easy for anyone with a soldering iron and solder

This tutorial series shows you how to install the software, play small videos, or display images such as from your PiCam and more!

# Adafruit 2.2" PiTFT HAT - 320x240 Display

## Easy Install

![](https://cdn-learn.adafruit.com/assets/assets/000/021/876/medium800/adafruit_products_2315_top_display_01_ORIG.jpg?1419020088)

The PiTFT requires some device tree support and a couple other things to make it a nice stand-alone display. If you just want to get going, check out the following for easy-install instructions!

Info: 

# Install Raspberry Pi OS on an SD Card

You'll need to start with Raspberry Pi OS or Raspberry Pi OS Lite.

Try the latest version of Raspberry Pi OS first. If that doesn't work. the last known for-sure tested-and-working version is Dec 11, 2023 (https://downloads.raspberrypi.org/raspios\_lite\_arm64/images/raspios\_lite\_arm64-2023-12-11/) from [https://downloads.raspberrypi.org/raspios\_lite\_arm64/images/](https://downloads.raspberrypi.org/raspios_lite_arm64/images/)

Raspberry Pi OS does often 'break' stuff when new versions come out so to be safe, if you are having problems try this version!

# Setup Virtual Environment

If you are installing on the Bookworm version of Raspberry Pi OS or later, you will need to install your python modules in a virtual environment. You can find more information in the [Python Virtual Environment Usage on Raspberry Pi](https://learn.adafruit.com/python-virtual-environment-usage-on-raspberry-pi) guide. To Install and activate the virtual environment, use the following commands:

```terminal
sudo apt install python3-venv
python -m venv env --system-site-packages
```

To activate the virtual environment:

```terminal
source env/bin/activate
```

To deactivate, you can use&nbsp;`deactivate`, but leave it active for now.

# Installer script

This script will do all the work for you, and install both device tree overlay support as well as configure rotation and any HDMI mirroring. PiTFT no longer needs any custom kernels or modules, so you can continue to update/upgrade your Pi and it will work with the most recent releases.

Here's the commands to run. Make sure your Pi has network access, it needs to download the software!

The latest installer script was rewritten in Python, so it can be installed with just a few commands. First, start by installing a few dependencies and downloading the repo:

```terminal
cd ~
sudo apt-get update
sudo apt-get install -y git python3-pip
pip3 install --upgrade adafruit-python-shell click Flask-SQLAlchemy
git clone https://github.com/adafruit/Raspberry-Pi-Installer-Scripts.git
cd Raspberry-Pi-Installer-Scripts
```

![](https://cdn-learn.adafruit.com/assets/assets/000/129/126/medium800/adafruit_products_PiTFT_Installation.png?1712071226)

## Easy Single Command Install Options

The latest script allows you to specify all of your options within the command so you can sit back and watch the installation. We'll cover interactive installation below if you want to answer each prompt for a customized installation.

### **“Console Mode” Install Commands**

If you just want a Linux text console to appear on the display, use one of the following commands:

For the **PiTFT**  **2.4", 2.8", or 3.2" Resistive touchscreens** , use the following command:

```terminal
sudo -E env PATH=$PATH python3 adafruit-pitft.py --display=28r --rotation=270 --install-type=console
```

For the **PiTFT**  **2.8" Capacitive touchscreen** , use the following command:

```terminal
sudo -E env PATH=$PATH python3 adafruit-pitft.py --display=28c --rotation=270 --install-type=console
```

For the **PiTFT**  **2.2" Display** , use the following command:

```terminal
sudo -E env PATH=$PATH python3 adafruit-pitft.py --display=22 --rotation=270--install-type=console
```

For the **PiTFT**  **3.5" Resistive touchscreen** , use the following command:

```terminal
sudo -E env PATH=$PATH python3 adafruit-pitft.py --display=35r --rotation=270 --install-type=console
```

For the **Mini**  **PiTFT 1.3", BrainCraft HAT, 1.3" Color TFT Bonnet, or 1.5" Display** , use the following command:

```terminal
sudo -E env PATH=$PATH python3 adafruit-pitft.py --display=st7789_240x240 --rotation=0 --install-type=console
```

For the **Mini PiTFT 1.14" Display** , use the following command:

```terminal
sudo -E env PATH=$PATH python3 adafruit-pitft.py --display=st7789_240x135 --rotation=270 --install-type=console
```

### **Mirrored Install Commands**

If you want to **mirror the HDMI output to the display** , known as “FrameBuffer Copy” or FBCP for short, use one of the following commands:

For the **PiTFT**  **2.4", 2.8", or 3.2" Resistive touchscreens** , use the following command:

```terminal
sudo -E env PATH=$PATH python3 adafruit-pitft.py --display=28r --rotation=90 --install-type=mirror
```

For the&nbsp; **PiTFT** &nbsp; **2.8" Capacitive touchscreen** , use the following command:

```terminal
sudo -E env PATH=$PATH python3 adafruit-pitft.py --display=28c --rotation=90 --install-type=mirror
```

For the **PiTFT**  **2.2" Display** , use the following command:

```terminal
sudo -E env PATH=$PATH python3 adafruit-pitft.py --display=22 --rotation=90 --install-type=mirror
```

For the **PiTFT**  **3.5" Resistive touchscreen** , use the following command:

```terminal
sudo -E env PATH=$PATH python3 adafruit-pitft.py --display=35r --rotation=90 --install-type=mirror
```

For the **Mini**  **PiTFT 1.3", BrainCraft HAT, 1.3" Color TFT Bonnet, or 1.5" Display** , use the following command:

```terminal
sudo -E env PATH=$PATH python3 adafruit-pitft.py --display=st7789_240x240 --rotation=0 --install-type=mirror
```

For the **Mini PiTFT 1.14" Display** , use the following command:

```terminal
sudo -E env PATH=$PATH python3 adafruit-pitft.py --display=st7789_240x135 --rotation=270 --install-type=mirror
```

### Rebooting

When it asks you to **reboot** , then choose yes because the setting won't take full effect until you do so.

![](https://cdn-learn.adafruit.com/assets/assets/000/095/662/medium800/adafruit_products_PiTFT_Reboot.png?1602528352)

## Interactive Installation

For an interactive install, you can just run the script without any options:

`sudo -E env PATH=$PATH python3 adafruit-pitft.py`

Once you run it you will be presented with menus for configuration.

### Display Selection

Start by selecting the board that best corresponds with your PiTFT. There's lots of options and we will likely be adding more in the future.

![](https://cdn-learn.adafruit.com/assets/assets/000/095/669/medium800/adafruit_products_Display_Select.png?1602532785)

### Rotation

Next you will be asked for the rotation you want, don't worry if you're not 100% sure which you want, you can always change this later by re-running the script

![](https://cdn-learn.adafruit.com/assets/assets/000/095/670/medium800/adafruit_products_Rotation_Select.png?1602532797)

It will take a few minutes to install the software and download all the things...

![](https://cdn-learn.adafruit.com/assets/assets/000/095/674/medium800/adafruit_products_Downloading.png?1602538804)

# Configuring what shows where

You have a few different ways to set up the PiTFT, we ask **2** questions to figure out what you want

## PiTFT as Text Console (best for Raspberry Pi OS 'Lite')

This is the simplest to set-up type of use.&nbsp;Its great if you have a simple text based or pygame/SDL based interface. If you want the PiTFT to act as a text console you can expect:

- HDMI will be 'deactivated' - nothing appears on the HDMI output but a black screen
- The login prompt appears on the Pi
- The Pi is all text, not a GUI (no PIXEL desktop)
- Keyboard and mouse are used only by the PiTFT interface
- Framebuffer-capable software (such as **fbi** for displaying images, **mplayer** for videos, or pygame software, etc) appear on the PiTFT
- OpenGL accelerated software _will not appear on the PiTFT_ (it is unaccelerated framebuffer only)
- But, non-OpenGL-accelerated graphics software is a bit faster than using HDMI mirroring (not tons faster but you're not running **fbcp** which will always make it faster)

If you want that, say **Yes** to the question `Would you like the console to appear on the PiTFT display`

![](https://cdn-learn.adafruit.com/assets/assets/000/095/671/medium800/adafruit_products_Console_to_Appear.png?1602532882)

Then simply reboot. Once rebooted you will not see anything on HDMI, but the console will appear on the PiTFT. That's it!

## PiTFT as HDMI Mirror (Best for Raspberry Pi OS with Desktop)

This option is easier to understand. This works more like a monitor, though slightly different depending on which desktop environment you are running.

As of Bookworm with the Wayland Graphical Environment, this operates a little different than it previously did. It works more in the way that multiple monitors do on desktop systems. The display is set up as its own monitor and will extend the desktop in addition to the HDMI.

With X11, this worked more as a mirror: whatever appears on the HDMI display will be 'mirrored' to the PiTFT. Note that HDMI is much higher resolution so it's not like it turns the PiTFT into a 1080p display. This is great for when you want to run OpenGL-optimized software, PIXEL desktop software, or really anything. The down-side is its a little slower than drawing directly to the framebuffer. You may not notice it but it's worth us mentioning!

- HDMI will be 'activated' but at a lower resolution - you can change this later but it looks best at 320x240 (PiTFT 2.2", 2.4", 2.8" and 3.2") or 480x320 (PiTFT 3.5")
- The login prompt or GUI appears on both HDMI and PiTFT at the same time
- Keyboard and mouse are shared, since the display is mirrored
- All graphics appear on both HDMI and PiTFT, thanks to&nbsp; **fbcp**

If you want that, say **Yes** to the question **`Would you like the HDMI display to mirror to the PiTFT display?`(**or in the case of Wayland it will ask **`Would you like the to use the PiTFT as a desktop display?`)**

![](https://cdn-learn.adafruit.com/assets/assets/000/095/672/medium800/adafruit_products_Mirror_HDMI.png?1602532928)

## PiTFT as Raw Framebuffer Device

For advanced users who are comfortable using framebuffer devices, it is possible to have the PiTFT and HDMI graphics be&nbsp;_both_ active and display different data.

- HDMI will be active and act like a normal Pi
- The login prompt or GUI (PIXEL) appears on the HDMI
- PiTFT appears black, nothing appears on it
- Keyboard and mouse are used by the HDMI interface but can, in theory, be captured and used to change graphics on PiTFT through programming
- Framebuffer-capable software (such as **fbi** for displaying images, **mplayer** for videos, or pygame software, etc)&nbsp;_can_ appear on the PiTFT if you set it up to display to **/dev/fb1**
- OpenGL accelerated software _will never appear on the PiTFT_ (it is unaccelerated framebuffer only)

If you want that, say **No** to both of the configuration questions!

Info: 

## Creating Your Own Automated Command

Under the **Easy Single Command Install Options** section, there are a bunch of different installation flags that you can choose between. If you want to create your own command, you can find the latest options by typing:

`sudo python3 adafruit-pitft.py --help`

![](https://cdn-learn.adafruit.com/assets/assets/000/095/675/medium800/adafruit_products_Help_Options.png?1602538981)

The main options to pay attention to are the `--display`, `--rotation`, and `--install-type` arguments.

For the **display** , you can either choose the number you type for the options or the display type, which has the options listed under help. For instance, to us the 2.8" Resisitive display you could use

`--display=1` or` --display=28r`

For the **rotation** , you can either choose the number you type for the options or the angle, which has the options also listed under help. To use 90 degrees, you could use

`--rotation=1` or `--rotation=90`

For **install type** , You can either choose **mirror** , **console** or **uninstall**. To mirror, you would simply supply

`--install-type=mirror`

### Automated Reboot Option

To go with a fully automated installation, you can provide a `--reboot` flag. To always reboot, use:

`--reboot=yes`

This is useful if you want to use the display right after running the script. To never reboot immediately, use

`--reboot=no`

This is useful if you want it as part of a larger script that installs many things.

### Custom User Directory

By default, it is installed under the current user directory, but you can provide the `-u` or `--user` flag along with the folder that you want to install to.

## Uninstalling The Driver

To uninstall, you would either run the script interactively and choose Uninstall or you can provide the uninstall flag:

`--install-type=uninstall`

# Unsupported Full Images

Historically, we provided full 'images' of Raspbian, which is now called Raspberry Pi OS. This worked OK until Raspbian started doing releases every few months. These are no longer supported, and won't even boot on Pi 3B+, so we recommend the script above.

There's the larger 'classic Jessie' image that will boot into X by default, and requires a 8G image, it has a lot more software installed. There's also the smaller 'Jessie Lite' that will boot into the command line, and can be burned onto a 2G card! Click below to download and install into a new SD card. [Unzip and follow the classic SD card burning tutorials](http://elinux.org/RPi_Easy_SD_Card_Setup)

## PiTFT 2.2" Images

- [Raspbian Jessie 2016/10/23-based image](https://s3.amazonaws.com/adafruit-raspberry-pi/2016-10-18-pitft-22.zip)
- [Raspbian Jessie Lite 2016/10/23-based image](https://s3.amazonaws.com/adafruit-raspberry-pi/2016-10-18-pitft-22-lite.zip)
- [Raspbian Jessie 2016/03/25-based image](https://adafruit-download.s3.amazonaws.com/2016-03-25_Jessie_PiTFT22.zip)
- [Raspbian Jessie Lite 2016/03/25-based image](https://adafruit-download.s3.amazonaws.com/2016-03-25_Jessie_Lite_PiTFT22.zip)
- [Raspbian Jessie 2015/09/24-based image](https://s3.amazonaws.com/adafruit-download/2015-09-24-raspbian-jessie-pitft22.zip)
- [Raspbian Wheezy 2015/09/09-based image](http://adafruit-download.s3.amazonaws.com/2015-05-05-raspbian-wheezy-pitft22_150909.zip)

## PiTFT 2.4"/2.8"/3.2" Resistive Images

- [Raspbian Jessie 2016/9/23-based image](https://s3.amazonaws.com/adafruit-raspberry-pi/2016-10-18-pitft-28r.zip)
- [Raspbian Jessie Lite 2016/9/23-based image](https://s3.amazonaws.com/adafruit-raspberry-pi/2016-10-18-pitft-28r-lite.zip)
- [Raspbian Jessie 2016/03/25-based image](https://adafruit-download.s3.amazonaws.com/2016-03-25_Jessie_PiTFT28r.zip)
- [Raspbian Jessie Lite 2016/03/25-based image](https://adafruit-download.s3.amazonaws.com/2016-03-25_Jessie_Lite_PiTFT28r.zip)
- [Raspbian Jessie 2015/09/24-based image](https://s3.amazonaws.com/adafruit-download/2015-09-24-raspbian-jessie-pitft28r.zip)
- [Raspbian Wheezy 2015/09/09-based image](http://adafruit-download.s3.amazonaws.com/2015-05-05-raspbian-wheezy-pitft28r_150909.zip)
- [Raspbian 2014/06/20-based image](http://adafruit-download.s3.amazonaws.com/PiTFT28R_raspbian140620_2014_08_25.zip)
- [Raspbian 2014/09/09-based image](http://adafruit-download.s3.amazonaws.com/PiTFT28R_raspbian140909_2014_09_18.zip)

## PiTFT 2.8" Capacitive

- [Raspbian Jessie 2016-09-23-based image](https://s3.amazonaws.com/adafruit-raspberry-pi/2016-10-18-pitft-28c.zip)
- [Raspbian Jessie Lite 2016-09-23-based image](https://s3.amazonaws.com/adafruit-raspberry-pi/2016-10-18-pitft-28c-lite.zip)
- [Raspbian Jessie 2016-03-25-based image](https://adafruit-download.s3.amazonaws.com/2016-03-25_Jessie_PiTFT28c.zip)
- [Raspbian Jessie Lite 2016-03-25-based image](https://adafruit-download.s3.amazonaws.com/2016-03-25_Jessie_Lite_PiTFT28c.zip)
- [Raspbian Jessie 2015/09/24-based image](https://s3.amazonaws.com/adafruit-download/2015-09-24-raspbian-jessie-pitft28c.zip)
- [Raspbian Wheezy 2015/09/24-based image](http://adafruit-download.s3.amazonaws.com/2015-05-05-raspbian-wheezy-pitft28c_150909.zip)
- [Raspbian 2014/09/18-based image](http://adafruit-download.s3.amazonaws.com/PiTFT28C_raspbian140909_2014_09_18.zip)
- [Raspbian 2014/06/20-based image](http://adafruit-download.s3.amazonaws.com/PiTFT28C_raspbian140620_2014_08_26.zip)
- [Raspbian image from 2015/03/03](http://adafruit-download.s3.amazonaws.com/2015-02-16-raspbian-pitft28c_150312.zip)

## PiTFT 3.5" Images

- [Raspbian Jessie 2016/9/23-based image](https://s3.amazonaws.com/adafruit-raspberry-pi/2016-11-08-pitft-35r.zip)
- [Raspbian Jessie Lite 2016/9/23-based image](https://s3.amazonaws.com/adafruit-raspberry-pi/2016-11-08-pitft-35r-lite.zip)
- [Raspbian Jessie 2016/03/25-based image](https://adafruit-download.s3.amazonaws.com/2016-03-25_Jessie_PiTFT35r.zip)
- [Raspbian Jessie 2016/03/25-based image](https://adafruit-download.s3.amazonaws.com/2016-03-25_Jessie_Lite_PiTFT35r.zip)
- [Raspbian Jessie 2015/09/24-based image](https://s3.amazonaws.com/adafruit-download/2015-09-24-raspbian-jessie-pitft35r.zip)
- [Raspbian Wheezy 2015/09/24-based image](http://adafruit-download.s3.amazonaws.com/2015-05-05-raspbian-wheezy-pitft35r_150909.zip)
- [Raspbian 2014/09/09-based image](http://adafruit-download.s3.amazonaws.com/PiTFT35R_raspbian140909_2014_09_18.zip)
- [Raspbian 2015/03/12 image](http://adafruit-download.s3.amazonaws.com/2015-02-16-raspbian-pitft35r_150312.zip)

# Adafruit 2.2" PiTFT HAT - 320x240 Display

## Console Configuration

Warning: 

![](https://cdn-learn.adafruit.com/assets/assets/000/036/699/medium800/raspberry_pi_adafruit_products_2097_demo_screen_05_ORIG.jpg?1476835347)

One fun thing you can do with the display is have it as your main console instead of the HDMI/TV output. Even though it is small, with a good font you can get 20 x 40 of text. For more details, check out [https://github.com/notro/fbtft/wiki/Boot-console](https://github.com/notro/fbtft/wiki/Boot-console "Link: https://github.com/notro/fbtft/wiki/Boot-console")  
  
First up, we'll update the boot configuration file to use the TFT framebuffer **/dev/fb1** instead of the HDMI/TV framebuffer /dev/fb0

> `sudo nano /boot/cmdline.txt `

you can also edit it by putting the SD card into a computer and opening the same file.  
  
At the end of the line, find the text that says `rootwait` and right after that, enter in:  
`fbcon=map:10 fbcon=font:VGA8x8` then save the file.  
  
On the next boot, it will bring up the console.   
  
**Note that the kernel has to load up the display driver module before it can display anything on it so you won't get the rainbow screen, a NooBs prompt, or a big chunk of the kernel details since the module is loaded fairly late in the boot process.**

![](https://cdn-learn.adafruit.com/assets/assets/000/012/544/medium800/raspberry_pi_fbcon.png?1385664321)

I think the VGA8x8 font is a bit chunky, you probably want 12x6 which is what is shown in the photo above. To change the font, run **sudo dpkg-reconfigure console-setup** and go thru to select Terminus 6x12

![](https://cdn-learn.adafruit.com/assets/assets/000/012/545/medium800/raspberry_pi_UTF-8.png?1385664549)

![](https://cdn-learn.adafruit.com/assets/assets/000/012/546/medium800/raspberry_pi_guess.png?1385664558)

![](https://cdn-learn.adafruit.com/assets/assets/000/012/547/medium800/raspberry_pi_Terminus.png?1385664568)

![](https://cdn-learn.adafruit.com/assets/assets/000/012/548/medium800/raspberry_pi_Term6x12.png?1385664577)

# Turn off Console Blanking

You may notice the console goes black after 30 minutes, this is a sort of 'power saving' or 'screensaver' feature.

## Raspbian Jessie

&nbsp;Add the following line to /etc/rc.local

> `sudo sh -c "TERM=linux setterm -blank 0 >/dev/tty0"`

on the line before the final `exit 0`

## Raspbian Wheezy

You can disable this by editing **/etc/kbd/config** and looking for&nbsp;

`BLANK_TIME=30`

and setting the blank time to 0 (which turns it off)

`BLANK_TIME=0`

![](https://cdn-learn.adafruit.com/assets/assets/000/025/057/medium800/raspberry_pi_2455_top_display_2B_ORIG.jpg?1430341674)

# Adafruit 2.2" PiTFT HAT - 320x240 Display

## Displaying Images

You can display every day images such as GIFs, JPGs, BMPs, etc on the screen. To do this we'll install **fbi** which is the **frame buffer image** viewer (not to be confused with the FBI agency!)  
  
**sudo apt-get install fbi** will install it

![](https://cdn-learn.adafruit.com/assets/assets/000/012/552/medium800/raspberry_pi_fbi.png?1385666718)

![](https://cdn-learn.adafruit.com/assets/assets/000/012/553/medium800/raspberry_pi_adapiluv320x240.jpg?1385667208)

Grab our lovely wallpapers with

> `wget http://adafruit-download.s3.amazonaws.com/adapiluv320x240.jpgwget http://adafruit-download.s3.amazonaws.com/adapiluv480x320.png`

For 320x240 PiTFTs (2.2", 2.4", 2.8" or 3.2") view it with

> `sudo fbi -T 2 -d /dev/fb1 -noverbose -a adapiluv320x240.jpg`

or for 3.5" PiTFTs:

> `sudo fbi -T 2 -d /dev/fb1 -noverbose -a adapiluv480x320.png`

That's it!

![](https://cdn-learn.adafruit.com/assets/assets/000/012/554/medium800/raspberry_pi_P1000082.jpg?1385667496)

# Adafruit 2.2" PiTFT HAT - 320x240 Display

## Playing Videos

![](https://cdn-learn.adafruit.com/assets/assets/000/012/542/medium800/raspberry_pi_1601bird_LRG.jpg?1385663855)

# How To Play Videos

You can play many types of videos on the screen, using mplayer you don't even need to run X and you can script the movies to play using Python. We'll show you how to just play one video for now.  
To demo, we'll use an mp4 of Big Buck Bunny for 320 pixel wide screens. Below we show you how to create/resize videos, but to make it easy, just download our version with:

`wget http://adafruit-download.s3.amazonaws.com/bigbuckbunny320p.mp4`

Warning: 

If you don't have **mplayer** yet, run

`sudo apt-get update`

`sudo apt-get install mplayer `

to install it. It may take a few minutes to complete

![](https://cdn-learn.adafruit.com/assets/assets/000/012/549/medium800/raspberry_pi_aptgetmplayer.png?1385664862)

OK now you just have to run:

`sudo SDL_VIDEODRIVER=fbcon SDL_FBDEV=/dev/fb1 mplayer -vo sdl -framedrop bigbuckbunny320p.mp4`

If your video is not sized for 320 wide, you may need to add a `-zoom` after `-framedrop` so that it will resize - note that this is quite taxing for the Pi, so it may result in a choppy or mis-synced video!

![](https://cdn-learn.adafruit.com/assets/assets/000/012/551/medium800/raspberry_pi_1601titles_LRG.jpg?1385666305)

# Converting/Resizing Videos
It's possible to play full length videos on the TFT plate, but since the screen is small and the Pi cant use hardware accelleration to play the videos its best to scale them down to 320x240 pixels. This will be easier for the Pi to play and also save you tons of storage space. For this demo, we'll be using the famous [Big Buck Bunny](http://www.bigbuckbunny.org/) video, which is creative commons and also very funny!  
  
You can download it from the link above, we'll be using the 720p AVI version.  
![](https://cdn-learn.adafruit.com/assets/assets/000/012/463/medium800/raspberry_pi_dlbigbuck.png?1385480844)

To do the conversion itself, we suggest [HandBrake](http://handbrake.fr/) which works great and is open source so it runs on all operating systems! Download and install from the link. Then run the installed application and open up the AVI file from before. The app will pre-fill a bunch of information about it.

![](https://cdn-learn.adafruit.com/assets/assets/000/012/465/medium800/raspberry_pi_handbrakeopened.png?1385482578)

Under **Destination** click **Browse...** to select a new MP4 file to save. Then under **Picture** change the **Width** to 320 (the height will be auto-calculated)

![](https://cdn-learn.adafruit.com/assets/assets/000/012/466/medium800/raspberry_pi_320p.png?1385482594)

Click **START** to begin the conversion, it will take a minute or two.

![](https://cdn-learn.adafruit.com/assets/assets/000/012/464/medium800/raspberry_pi_handbrakeconverting.png?1385482564)

That's it! You now have a smaller file. Don't forget to play it on your computer to make sure it plays right before copying it to your Pi

# Adafruit 2.2" PiTFT HAT - 320x240 Display

## Using FBCP

![](https://cdn-learn.adafruit.com/assets/assets/000/032/128/medium800/raspberry_pi_gaming-large.jpg?1462296668)

 **The Ideal:** Adafruit’s PiTFT displays are razor sharp. Whereas small composite screens on the Raspberry Pi usually require some video scaling (resulting in blurriness), PiTFT uses the GPIO header, digitally controlled pixel-by-pixel for a rock steady image. Though not a _lot_ of pixels, it works great for retro gaming (and the display neatly stacks above the board, no side protuberances for video cables).

**The Downside:** this GPIO link entirely bypasses&nbsp;the Pi’s video hardware, including the graphics accelerator. Many games and emulators _depend_&nbsp;on the GPU for performance gains. So&nbsp;the PiTFT has traditionally been limited to just a subset of specially-compiled emulators that can work and run well enough without the GPU.

**The Solution:** &nbsp;our latest PiTFT drivers, along with a tool&nbsp;called _fbcp_ (framebuffer copy), careful system configuration, and (optionally) the more potent Raspberry Pi 2 board open the doors to many more gaming options. Existing emulator packages (such as RetroPie, with _dozens_ of high-performance emulators and ports) — previously off-limits to the PiTFT — can run quite effectively now!

[Click here to go to our FBCP tutorial!](https://learn.adafruit.com/running-opengl-based-games-and-emulators-on-adafruit-pitft-displays/)
# Adafruit 2.2" PiTFT HAT - 320x240 Display

## Backlight Control

Warning: You cannot use I2S audio and control the backlight at the same time. They both use GPIO #18!

Unlike the resistive 2.8" PiTFT, this little PiTFT does not have a resistive touch controller chip that we can take advantage of as an extra backlight control pin. Instead, you can set use GPIO #18 as an on/off or PWM control.

Note that if you are playing audio out the headphone jack, you can't use the PWM capabilities of GPIO #18 at the same time, the PWM function is reassigned to do audio. However,&nbsp; you can use it as a simple on/off pin

There's python code available for controlling the PWM on #18 but you can also just use the kernel module and shell commands.

With these basic shell commands, you can set the GPIO #18 pin to PWM mode, set the output to 100 (out of 1023, so dim!), set the output to 1000 (out of 1023, nearly all the way on) and 0 (off)

```
sudo apt-get install wiringpi
gpio -g mode 18 pwm
gpio -g pwm 18 100
gpio -g pwm 18 1000
gpio -g pwm 18 0
```

![](https://cdn-learn.adafruit.com/assets/assets/000/023/909/medium800/adafruit_products_gpiopwm.png?1426539367)

Try other numbers, from 0 (off) to 1023 (all the way on)!

# Adafruit 2.2" PiTFT HAT - 320x240 Display

## Extras!

# Boot to X Windows on PiTFT

Use the Pi installer script, select **N** on having the console appear on the Pi, and say **Y** to mirroring HDMI. Then enable PIXEL using **sudo raspi-config** (boot to desktop)

# Adafruit 2.2" PiTFT HAT - 320x240 Display

## HELP! (FAQ)

### 

If you messed with `/boot/config.txt` or `/etc/rc.local` you may have removed or disabled some of the elements required for the PiTFT to work. Try re-running the Easy Installer script!

### 

The Raspberry Pi 4 and the Raspberry Pi 400 have dual HDMI outputs. However, only one of those is a primary port. The is likely caused by connecting to HDMI1. Please try connecting the display to the other HDMI port and rebooting.

For the Pi 4, HDMI 0 is closer to the USB-C port. For the Pi 400, it's the port closer to the MicroSD Card slot.

### 

 **It looks like the Pi is 'halting' or 'locking' up during boot** but what is really happening is the console is switching from the HDMI output to the PiTFT console output.

Check your PiTFT connections, particularly make sure you seated the PiTFT on the Pi properly, nothing is in the way, and the TFT flex connector is seated properly.

![](https://cdn-learn.adafruit.com/assets/assets/000/032/127/medium800/raspberry_pi_Ears.png?1462238411)

### 

Sounds like you tried to configure your Pi to 'boot straight to X', that is, start up the graphics interface on boot. This doesn't work by default because the Pi operating system is not expecting a PiTFT so it boots to the HDMI output. See below for how to set up your Pi to boot to X on the PiTFT

To 'fix' this, you can either connect an HDMI monitor, then in a terminal window run **sudo raspi-config** and configure the Pi to boot to the command line not X! If you do not have an HDMI monitor, you can also try a console cable

### 

don't forget you have to remove the turbo file!  
**sudo mv /usr/share/X11/xorg.conf.d/99-fbturbo.conf ~**

### 

Some programs are graphics-optimized, particularly the video playback tools and some other programs like Minecraft. They write 'directly' to the HDMI output, and cannot write to the PiTFT so there is no way to directly make them work. However, you _can_ have the output go to HDMI and then mirror the HDMI onto the PiTFT with **fbcp**. Using the Easy Installer, select **Mirror HDMI**

### 

On some older PiTFTs we had one of the buttons labeled #21 - that's the original RasPi name for that pin. If you're using a V2 (chance is, you are!) that is now called #27.  
All the PiTFT's we ship now have the button labeled #21 and #27

### 

You can change the SPI frequency (overclock the display) by editing **/boot/config.txt** and changing the **dtoverlay** options line to:

> **dtoverlay=pitft28r,rotate=90,speed=62000000,fps=25**

Or whatever you like for speed, rotation, and frames-per-second. BUT, here's the thing, the Pi only supports a _fixed number_ of SPI frequencies. So tweaking the number a little won't do anything. The kernel will round the number to the closest value. You will always get frequencies that are 250MHz divided by an even number. Here's the only SPI frequencies this kernel supports

- 15,625,000 (a.k.a 16000000 = 16 MHz)
- 17,857,142 (a.k.a. 18000000 = 18 MHz)
- 20,833,333 (a.k.a 21000000 = 21 MHz)
- 25,000,000 (= 25 MHz)
- 31,250,000 (a.k.a 32000000 = 32MHz)
- 41,666,666 (a.k.a 42000000 = 42MHz)
- 62,500,000 (a.k.a 62000000 = 62MHz)

So if you put in 48000000 for the speed, you won't actually get 48MHz, you'll actually only get about 42MHz because it gets rounded down. We tested this display nicely with 32MHz and we suggest that. But you can put in 42MHz or even try 62MHz and it will update faster

You can tweak fps (frames per second) from 20 to 60 and frequency up to 62MHz for tradeoffs in performance and speed. Reboot after each edit to make sure the settings are loaded properly. There's a trade off that if you ask for higher FPS you're going to load the kernel more because it's trying to keep the display updated.

### 

[We took the screenshots for this tutorial with](http://fbgrab.monells.se/)**[fbgra](http://fbgrab.monells.se/)[b](http://fbgrab.monells.se/)**  

> wget [http://fbgrab.monells.se/fbgrab-1.2.tar.gz](http://fbgrab.monells.se/fbgrab-1.2.tar.gz "Link: http://fbgrab.monells.se/fbgrab-1.2.tar.gz")  
> tar -zxvf fbgrab\*gz  
> cd fbgrab/  
> make  
> ./fbgrab screenshot.png

![](https://cdn-learn.adafruit.com/assets/assets/000/015/917/medium800/raspberry_pi_framegrab.png?1398108663)

### 

Make sure your Pi boots to the graphical PIXEL desktop on the HDMI output monitor, then using the Easy Installer, select **Mirror HDMI**

### 

Check to make syre that the flat flex cable&nbsp;is fully seated in the connetor and the 'ears' are pushed in to secure it. See the picture for what it should look like:

![](https://cdn-learn.adafruit.com/assets/assets/000/023/588/medium800/raspberry_pi_Ears.png?1425164829)

### 

This happens on the Raspberry Pi the first time you run startx, no matter what display. You can just re-start X and it wont appear again.

### 

Yes! &nbsp;Please see this post:

[https://forums.adafruit.com/viewtopic.php?f=47&t=77528&p=393280#p393322](https://forums.adafruit.com/viewtopic.php?f=47&t=77528&p=393280#p393322)

### 

[Here's a hack for the device tree overlay that can force different SPI modes, sometimes that helps!](https://forums.adafruit.com/viewtopic.php?f=50&t=104964)

### 

X11 (the graphical system) has changed how it gets touchscreen input, so if you rotate the display and the calibration isn't being picked up:

Check /usr/share/X11/xorg.conf.d for a file called 10-evdev.conf&nbsp;

If you don't see that file

1. You need to `sudo apt-get install xserver-xorg-input-evdev`, and then...
2. If you do have a 40-libinput.conf in that same directory, you must remove it even if/once evdev is installed, since it will override the 10-evdev.conf otherwise.

[Thanks to cerebrate in the forums for the hint!](https://forums.adafruit.com/viewtopic.php?f=50&t=111045)

### White Screen Issue

A small number of Adafruit PiTFT - Touchscreen Display for Raspberry Pi were manufactured in error in 2018. If you have a display from that era with a white screen issue, see [this forum post](https://forums.adafruit.com/viewtopic.php?t=132799&start=15) for diagnosis and remedy.

# Adafruit 2.2" PiTFT HAT - 320x240 Display

## Downloads

- [The latest kernel fork that adds all the TFT, touchscreen, and other addons is here on github](https://github.com/adafruit/adafruit-raspberrypi-linux "Link: https://github.com/adafruit/adafruit-rpi-fbtft/")
- [ILI9340 (datasheet)](http://www.adafruit.com/datasheets/ILI9340.pdf) controller with built in pixel-addressable video RAM buffer
- [Display datasheet](http://www.adafruit.com/datasheets/TM022HDH26_V1.0.pdf)
- [EagleCAD PCB files on GitHub](https://github.com/adafruit/Adafruit-PiTFT-2.2-Inch-HAT-PCB)
- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library)

## Schematic and Fab Print rev B
![](https://cdn-learn.adafruit.com/assets/assets/000/141/183/medium800/adafruit_products_schempitft.png?1763488714 )

![](https://cdn-learn.adafruit.com/assets/assets/000/141/185/medium800/adafruit_products_fabpitft.png?1763488978 )

# Schematic rev A

click to enlarge

![adafruit_products_schem.png](https://cdn-learn.adafruit.com/assets/assets/000/021/903/medium800/adafruit_products_schem.png?1712098804)

# Fabrication Print rev A
![](https://cdn-learn.adafruit.com/assets/assets/000/021/904/medium800/adafruit_products_fabprint.png?1419022672)

![](https://cdn-learn.adafruit.com/assets/assets/000/021/905/medium800/adafruit_products_fabprintmm.png?1419022754)


## Featured Products

### Adafruit PiTFT 2.2" HAT Mini Kit - 320x240 2.2" TFT - No Touch

[Adafruit PiTFT 2.2" HAT Mini Kit - 320x240 2.2" TFT - No Touch](https://www.adafruit.com/product/2315)
The cute PiTFT got even more adorable with this little primary display for Raspberry Pi in HAT form! It features a 2.2" display with 320x240 16-bit color pixels. The HAT uses the high-speed SPI interface on the Pi and can use the mini display as a console, X window port, displaying images...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2315)
[Related Guides to the Product](https://learn.adafruit.com/products/2315/guides)
### GPIO Stacking Header for Pi A+/B+/Pi 2/Pi 3

[GPIO Stacking Header for Pi A+/B+/Pi 2/Pi 3](https://www.adafruit.com/product/2223)
Connect your own PCB to a Raspberry Pi B+ and stack on top with this normal-height female header with extra long pins. &nbsp;The female header part is about 8.5mm tall, good for small HATs that do not to clear the USB/Ethernet jacks. This header has extra long 10mm pins, compared with our <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/2223)
[Related Guides to the Product](https://learn.adafruit.com/products/2223/guides)
### Stacking Header for Pi A+/B+/Pi 2/Pi 3 - 2x20 Extra Tall Header

[Stacking Header for Pi A+/B+/Pi 2/Pi 3 - 2x20 Extra Tall Header](https://www.adafruit.com/product/1979)
Stack multiple plates, breakouts etc onto your Raspberry Pi Model B+ with this custom-made extra-tall and extra-long 2x20&nbsp;female header. The female header part has extra spaces to make it 23mm tall: when placed on your Pi, a PCB will clear the Ethernet and USB jacks. The stacky pin part...

In Stock
[Buy Now](https://www.adafruit.com/product/1979)
[Related Guides to the Product](https://learn.adafruit.com/products/1979/guides)
### GPIO Header for RaspberryPi A+/B+/Pi 2/Pi 3

[GPIO Header for RaspberryPi A+/B+/Pi 2/Pi 3](https://www.adafruit.com/product/1992)
Connect your own PCB to a Raspberry Pi B+ with this extra-tall female header. The female header part has extra spaces to make it&nbsp;16.5mm&nbsp;tall: when placed on your Pi, a PCB will clear the Ethernet and USB jacks. This header has 3mm of pins, compared with our <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/1992)
[Related Guides to the Product](https://learn.adafruit.com/products/1992/guides)

## Related Guides

- [Running OpenGL-based Games & Emulators on Adafruit PiTFT Displays](https://learn.adafruit.com/running-opengl-based-games-and-emulators-on-adafruit-pitft-displays.md)
- [2.2" PiTFT HAT Enclosure](https://learn.adafruit.com/3d-printed-2-2-pitft-raspberry-pi-a-plus-enclosure.md)
- [Processing on the Raspberry Pi & PiTFT](https://learn.adafruit.com/processing-on-the-raspberry-pi-and-pitft.md)
- [PiTFT Python + Pillow Animated Gif Player](https://learn.adafruit.com/pitft-linux-python-animated-gif-player.md)
- [PiGRRL Zero](https://learn.adafruit.com/pigrrl-zero.md)
- [Pi Hole Ad Detection Display with PiTFT](https://learn.adafruit.com/pi-hole-ad-pitft-tft-detection-display.md)
- [Adafruit ICM20649 Wide-Range 6-DoF IMU Accelerometer and Gyro](https://learn.adafruit.com/adafruit-icm20649-wide-range-6-dof-imu-accelerometer-and-gyro.md)
- [Embedded Linux Board Comparison](https://learn.adafruit.com/embedded-linux-board-comparison.md)
- [Adafruit LED Arcade Button 1x4 STEMMA QT](https://learn.adafruit.com/adafruit-led-arcade-button-qt.md)
- [Adafruit Feather 32u4 Bluefruit LE](https://learn.adafruit.com/adafruit-feather-32u4-bluefruit-le.md)
- [Adafruit H3LIS331 and LIS331 High-g 3-Axis Accelerometers](https://learn.adafruit.com/adafruit-h3lis331-and-lis331hh-high-g-3-axis-accelerometers.md)
- [Introducing Bluefruit LE Micro](https://learn.adafruit.com/bluefruit-le-micro-atmega32u4-microcontroller-usb-bluetooth-le-in-one.md)
- [Adafruit NeoKey 5x6 Ortho Snap-Apart](https://learn.adafruit.com/adafruit-neokey-5x6-ortho-snap-apart.md)
- [Analog Devices ADXL343 Breakout Learning Guide](https://learn.adafruit.com/adxl343-breakout-learning-guide.md)
- [Adafruit Bluefruit LE Shield](https://learn.adafruit.com/adafruit-bluefruit-le-shield.md)
