Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use Adafruit 2.2in PiTFT HAT: Examples, Pinouts, and Specs

Image of Adafruit 2.2in PiTFT HAT
Cirkit Designer LogoDesign with Adafruit 2.2in PiTFT HAT in Cirkit Designer

Introduction

The Adafruit 2.2in PiTFT HAT (Part ID: 2315) is a compact touchscreen display designed specifically for Raspberry Pi boards. It features a 2.2-inch diagonal screen with a resolution of 320x240 pixels (QVGA), making it ideal for creating portable projects, graphical user interfaces, and interactive displays. The PiTFT HAT integrates seamlessly with Raspberry Pi GPIO pins and includes a resistive touchscreen for user input.

Explore Projects Built with Adafruit 2.2in PiTFT HAT

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Raspberry Pi 4B-Based Multi-Sensor Interface Hub with GPS and GSM
Image of Rocket: A project utilizing Adafruit 2.2in PiTFT HAT in a practical application
This circuit features a Raspberry Pi 4B interfaced with an IMX296 color global shutter camera, a Neo 6M GPS module, an Adafruit BMP388 barometric pressure sensor, an MPU-6050 accelerometer/gyroscope, and a Sim800l GSM module for cellular connectivity. Power management is handled by an MT3608 boost converter, which steps up the voltage from a Lipo battery, with a resettable fuse PTC and a 1N4007 diode for protection. The Adafruit Perma-Proto HAT is used for organizing connections and interfacing the sensors and modules with the Raspberry Pi via I2C and GPIO pins.
Cirkit Designer LogoOpen Project in Cirkit Designer
Raspberry Pi 5 Smart Weather Station with GPS and AI Integration
Image of Senior Design: A project utilizing Adafruit 2.2in PiTFT HAT in a practical application
This circuit integrates a Raspberry Pi 5 with various peripherals including an 8MP 3D stereo camera, an AI Hat, a BMP388 sensor, a 16x2 I2C LCD, and an Adafruit Ultimate GPS module. The Raspberry Pi serves as the central processing unit, interfacing with the camera for image capture, the AI Hat for AI processing, the BMP388 for environmental sensing, the LCD for display, and the GPS module for location tracking, with a USB Serial TTL for serial communication.
Cirkit Designer LogoOpen Project in Cirkit Designer
Raspberry Pi Pico and OV7670 Camera-Based Robotic System with TFT Display
Image of REF Speed Bot V3 CKT: A project utilizing Adafruit 2.2in PiTFT HAT in a practical application
This circuit features two Raspberry Pi Pico microcontrollers interfacing with various peripherals including an OV7670 camera module, a TFT display, and an OLED display. It also includes a multiplexer and a motor driver to control two planetary gearbox motors, powered by a battery and regulated through buck converters. The setup is designed for image capture, display, and motor control applications.
Cirkit Designer LogoOpen Project in Cirkit Designer
Raspberry Pi 4B with I2C Current Sensing and OLED Display
Image of iot task 2: A project utilizing Adafruit 2.2in PiTFT HAT in a practical application
This circuit features a Raspberry Pi 4B as the central processing unit, interfaced with an Adafruit ADS1115 16-bit I2C ADC for analog-to-digital conversion and a 0.96" OLED display for visual output. The ADC is connected to a current sensor for measuring electrical current, with the sensor's output connected to the ADC's AIN0 pin and the burden resistor connected to AIN1. The Raspberry Pi communicates with both the ADC and the OLED display over the I2C bus, using GPIO2 (SDA) and GPIO3 (SCL) for data exchange.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with Adafruit 2.2in PiTFT HAT

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Rocket: A project utilizing Adafruit 2.2in PiTFT HAT in a practical application
Raspberry Pi 4B-Based Multi-Sensor Interface Hub with GPS and GSM
This circuit features a Raspberry Pi 4B interfaced with an IMX296 color global shutter camera, a Neo 6M GPS module, an Adafruit BMP388 barometric pressure sensor, an MPU-6050 accelerometer/gyroscope, and a Sim800l GSM module for cellular connectivity. Power management is handled by an MT3608 boost converter, which steps up the voltage from a Lipo battery, with a resettable fuse PTC and a 1N4007 diode for protection. The Adafruit Perma-Proto HAT is used for organizing connections and interfacing the sensors and modules with the Raspberry Pi via I2C and GPIO pins.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Senior Design: A project utilizing Adafruit 2.2in PiTFT HAT in a practical application
Raspberry Pi 5 Smart Weather Station with GPS and AI Integration
This circuit integrates a Raspberry Pi 5 with various peripherals including an 8MP 3D stereo camera, an AI Hat, a BMP388 sensor, a 16x2 I2C LCD, and an Adafruit Ultimate GPS module. The Raspberry Pi serves as the central processing unit, interfacing with the camera for image capture, the AI Hat for AI processing, the BMP388 for environmental sensing, the LCD for display, and the GPS module for location tracking, with a USB Serial TTL for serial communication.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of REF Speed Bot V3 CKT: A project utilizing Adafruit 2.2in PiTFT HAT in a practical application
Raspberry Pi Pico and OV7670 Camera-Based Robotic System with TFT Display
This circuit features two Raspberry Pi Pico microcontrollers interfacing with various peripherals including an OV7670 camera module, a TFT display, and an OLED display. It also includes a multiplexer and a motor driver to control two planetary gearbox motors, powered by a battery and regulated through buck converters. The setup is designed for image capture, display, and motor control applications.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of iot task 2: A project utilizing Adafruit 2.2in PiTFT HAT in a practical application
Raspberry Pi 4B with I2C Current Sensing and OLED Display
This circuit features a Raspberry Pi 4B as the central processing unit, interfaced with an Adafruit ADS1115 16-bit I2C ADC for analog-to-digital conversion and a 0.96" OLED display for visual output. The ADC is connected to a current sensor for measuring electrical current, with the sensor's output connected to the ADC's AIN0 pin and the burden resistor connected to AIN1. The Raspberry Pi communicates with both the ADC and the OLED display over the I2C bus, using GPIO2 (SDA) and GPIO3 (SCL) for data exchange.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • Portable Raspberry Pi projects
  • Custom graphical user interfaces
  • IoT dashboards and control panels
  • Educational tools and interactive displays
  • Compact gaming consoles

Technical Specifications

Below are the key technical details of the Adafruit 2.2in PiTFT HAT:

Specification Details
Screen Size 2.2 inches (diagonal)
Resolution 320x240 pixels (QVGA)
Touchscreen Type Resistive touchscreen
Interface SPI (Serial Peripheral Interface)
Backlight Control GPIO-controlled
Power Supply Voltage 3.3V (via Raspberry Pi GPIO)
Dimensions 65mm x 56mm x 6mm
Weight ~20g

Pin Configuration and Descriptions

The PiTFT HAT connects directly to the Raspberry Pi GPIO header. Below is the pin configuration:

Pin GPIO Pin Function
1 3.3V Power supply
6 GND Ground
19 GPIO10 (MOSI) SPI data input
21 GPIO9 (MISO) SPI data output
23 GPIO11 (SCLK) SPI clock
24 GPIO8 (CE0) SPI chip select
18 GPIO24 Backlight control
22 GPIO25 Touchscreen interrupt

Usage Instructions

How to Use the Component in a Circuit

  1. Hardware Setup:

    • Align the Adafruit 2.2in PiTFT HAT with the Raspberry Pi GPIO header.
    • Gently press the HAT onto the GPIO pins to ensure a secure connection.
    • Power on the Raspberry Pi.
  2. Software Setup:

    • Install the required libraries and drivers for the PiTFT HAT:
      sudo apt-get update
      sudo apt-get install -y python3-pip
      sudo pip3 install adafruit-blinka adafruit-circuitpython-ili9341
      
    • Configure the Raspberry Pi to use the SPI interface:
      sudo raspi-config
      
      • Navigate to Interfacing Options > SPI and enable it.
      • Reboot the Raspberry Pi.
  3. Display Test:

    • Run the following Python script to test the display:
      import board
      import digitalio
      from adafruit_ili9341 import ILI9341
      import displayio
      
      # Initialize SPI interface
      spi = board.SPI()  # Uses GPIO10 (MOSI), GPIO11 (SCLK), GPIO8 (CE0)
      tft_cs = digitalio.DigitalInOut(board.CE0)  # Chip select
      tft_dc = digitalio.DigitalInOut(board.D25)  # Data/command
      tft_reset = digitalio.DigitalInOut(board.D24)  # Reset
      
      # Create the display object
      display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs,
                                       reset=tft_reset)
      display = ILI9341(display_bus, width=320, height=240)
      
      # Fill the screen with a solid color
      splash = displayio.Group()
      display.show(splash)
      color_bitmap = displayio.Bitmap(320, 240, 1)
      color_palette = displayio.Palette(1)
      color_palette[0] = 0xFF0000  # Red
      bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette,
                                     x=0, y=0)
      splash.append(bg_sprite)
      
      while True:
          pass  # Keeps the display running
      

Important Considerations and Best Practices

  • Ensure the Raspberry Pi is powered off before attaching or detaching the PiTFT HAT.
  • Use a stable 5V power supply for the Raspberry Pi to avoid display flickering.
  • Avoid applying excessive pressure to the resistive touchscreen to prevent damage.
  • For optimal performance, use the latest Raspberry Pi OS and keep all libraries updated.

Troubleshooting and FAQs

Common Issues and Solutions

  1. The display is not turning on:

    • Ensure the PiTFT HAT is securely connected to the Raspberry Pi GPIO header.
    • Verify that the SPI interface is enabled in the Raspberry Pi configuration.
    • Check the power supply voltage and ensure it meets the requirements.
  2. Touchscreen is unresponsive:

    • Confirm that the touchscreen interrupt pin (GPIO25) is properly configured.
    • Reinstall the touchscreen drivers using Adafruit's setup guide.
  3. Display shows a blank screen:

    • Verify the Python script is correctly configured for the ILI9341 driver.
    • Check the SPI connections and ensure no pins are loose or misaligned.
  4. Backlight is not working:

    • Ensure GPIO24 is configured for backlight control.
    • Test the backlight functionality using a simple GPIO toggle script.

FAQs

Q: Can I use this display with Arduino boards?
A: The Adafruit 2.2in PiTFT HAT is designed for Raspberry Pi and uses the GPIO header. While it may be possible to adapt it for Arduino using SPI, it is not officially supported.

Q: Does the PiTFT HAT support multitouch?
A: No, the resistive touchscreen supports single-touch input only.

Q: Can I use this display in portrait mode?
A: Yes, the display orientation can be configured in software to support portrait or landscape modes.

Q: Is the display sunlight-readable?
A: The display is not optimized for outdoor use and may be difficult to read in direct sunlight.