The Adafruit 2.2in PiTFT HAT is a compact and versatile display module featuring a 2.2-inch TFT LCD screen with a resolution of 320x240 pixels. This HAT (Hardware Attached on Top) is specifically designed for compatibility with the Raspberry Pi, making it an excellent choice for projects that require a small display with good resolution and color representation. Common applications include handheld devices, mini gaming consoles, and user interfaces for various Raspberry Pi projects.
Pin Number | Name | Description |
---|---|---|
1 | 3V3 | 3.3V Power Supply |
2 | 5V | 5V Power Supply (for backlight) |
3 | GND | Ground |
4 | MOSI | SPI Data Input to TFT |
5 | SCLK | SPI Clock to TFT |
6 | CS | SPI Chip Select for TFT |
7 | RST | Reset Pin for TFT |
8 | D/C | Data/Command Control Pin |
To use the Adafruit 2.2in PiTFT HAT with your Raspberry Pi, you'll need to install the necessary software and configure the Pi to use the display.
cd ~
sudo apt-get update
sudo apt-get install -y git python3-pip
git clone https://github.com/adafruit/Raspberry-Pi-Installer-Scripts.git
cd Raspberry-Pi-Installer-Scripts
sudo python3 adafruit-pitft.py
Follow On-Screen Prompts: The installation script will guide you through the setup process. Choose the appropriate options for your PiTFT model and desired configuration.
Reboot: Once the installation is complete, reboot your Raspberry Pi.
After installation and configuration, you can test the display using the following Python script:
import os
import pygame
import time
import random
os.putenv('SDL_FBDEV', '/dev/fb1') pygame.init()
size = (320, 240) pygame.display.set_mode(size) screen = pygame.display.get_surface()
colors = [(255, 0, 0), (0, 255, 0), (0, 0, 255), (0, 0, 0)] for color in colors: screen.fill(color) pygame.display.flip() time.sleep(1)
Q: Can I use the PiTFT HAT with any Raspberry Pi model? A: The PiTFT HAT is compatible with most Raspberry Pi models with a 40-pin GPIO header. Check the Adafruit website for specific model compatibility.
Q: How do I calibrate the touchscreen?
A: If your PiTFT HAT includes a touchscreen, you can calibrate it using the adafruit-pitft-touch-cal
script found in the Raspberry-Pi-Installer-Scripts repository.
Q: Can I use the PiTFT HAT with other operating systems besides Raspbian? A: The PiTFT HAT is designed to work with Raspbian, but it may work with other Raspberry Pi-compatible operating systems. Check the documentation for your specific OS for compatibility.
For further assistance, visit the Adafruit support forums or contact Adafruit customer service.