Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use Raspberry Pi AI HAT+ (26T): Examples, Pinouts, and Specs

Image of Raspberry Pi AI HAT+ (26T)Design with Raspberry Pi AI HAT+ (26T) in Cirkit Designer

Introduction

The Raspberry Pi AI HAT+ (26T) is an advanced add-on board designed to bring artificial intelligence (AI) capabilities to Raspberry Pi devices. Manufactured by Raspberry Pi, this HAT (Hardware Attached on Top) features a neural network accelerator, enabling efficient machine learning (ML) computations directly on the edge. It is ideal for applications requiring real-time AI processing, such as image recognition, natural language processing, and robotics.

Explore Projects Built with Raspberry Pi AI HAT+ (26T)

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 Raspberry Pi 5 Smart Weather Station with GPS and AI Integration: A project utilizing Raspberry Pi AI HAT+ (26T) 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.

Open Project in Cirkit Designer
Image of Raspberry Pi 4B-Based Multi-Sensor Interface Hub with GPS and GSM: A project utilizing Raspberry Pi AI HAT+ (26T) 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.

Open Project in Cirkit Designer
Image of Raspberry Pi 5 Controlled Robotic Vehicle with LIDAR and IMU: A project utilizing Raspberry Pi AI HAT+ (26T) in a practical application
Raspberry Pi 5 Controlled Robotic Vehicle with LIDAR and IMU

This circuit features a Raspberry Pi 5 as the central controller, interfaced with a TF LUNA LIDAR sensor for distance measurement and an MPU-6050 for motion tracking via I2C communication. It also includes two L298 motor drivers powered by a 12V battery to control four DC motors, with the Raspberry Pi's GPIO pins used to manage the direction and speed of the motors.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

The Raspberry Pi AI HAT+ (26T) is designed to integrate seamlessly with Raspberry Pi boards, offering powerful AI capabilities in a compact form factor.

Key Technical Details

Specification Details
Manufacturer Raspberry Pi
Part ID AI HAT+
Neural Network Accelerator 26 TOPS (Tera Operations Per Second)
Supported Frameworks TensorFlow Lite, ONNX, PyTorch, Caffe
Interface GPIO (40-pin header), I2C, SPI, UART
Power Supply 5V DC (via Raspberry Pi GPIO or external power source)
Operating Temperature -20°C to 70°C
Dimensions 65mm x 56mm x 15mm
Weight 25g
Compatibility Raspberry Pi 4 Model B, Raspberry Pi 3 Model B+, Raspberry Pi Zero 2 W

Pin Configuration and Descriptions

The AI HAT+ connects to the Raspberry Pi via the 40-pin GPIO header. Below is the pin configuration:

Pin Number Pin Name Description
1 3.3V Power supply for the HAT
2 5V Power supply for the HAT
3 SDA1 I2C Data Line
5 SCL1 I2C Clock Line
8 TXD UART Transmit
10 RXD UART Receive
19 SPI_MOSI SPI Master Out Slave In
21 SPI_MISO SPI Master In Slave Out
23 SPI_SCLK SPI Clock
24 SPI_CE0 SPI Chip Enable 0
26 GPIO7 General Purpose Input/Output (customizable)

Usage Instructions

How to Use the AI HAT+ in a Circuit

  1. Attach the HAT: Align the AI HAT+ with the 40-pin GPIO header on your Raspberry Pi and gently press it down to ensure a secure connection.
  2. Power the System: Power the Raspberry Pi using a 5V DC power supply. The HAT will draw power directly from the GPIO header.
  3. Install Drivers: Download and install the required drivers and libraries from the official Raspberry Pi repository.
  4. Load AI Models: Use supported frameworks (e.g., TensorFlow Lite, ONNX) to load pre-trained AI models onto the HAT.
  5. Run Inference: Execute AI inference tasks using the HAT's neural network accelerator for high-speed processing.

Important Considerations and Best Practices

Example Code for Raspberry Pi (Using TensorFlow Lite)

Below is an example Python script to run an image classification task using TensorFlow Lite on the AI HAT+:

import tflite_runtime.interpreter as tflite
import numpy as np
from PIL import Image

# Load the TensorFlow Lite model
model_path = "model.tflite"  # Replace with your model file path
interpreter = tflite.Interpreter(model_path=model_path)

# Allocate tensors for the model
interpreter.allocate_tensors()

# Get input and output details
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()

# Load and preprocess the input image
image = Image.open("image.jpg").resize((224, 224))  # Replace with your image file
input_data = np.expand_dims(np.array(image, dtype=np.float32) / 255.0, axis=0)

# Set the input tensor
interpreter.set_tensor(input_details[0]['index'], input_data)

# Run inference
interpreter.invoke()

# Get the output tensor
output_data = interpreter.get_tensor(output_details[0]['index'])

# Display the results
print("Inference Results:", output_data)

Notes:

Troubleshooting and FAQs

Common Issues and Solutions

  1. HAT Not Detected by Raspberry Pi

    • Solution: Ensure the HAT is properly seated on the GPIO header. Check for bent pins or loose connections.
    • Tip: Verify that the required drivers are installed and up to date.
  2. Overheating During AI Tasks

    • Solution: Attach a heatsink or fan to the HAT. Reduce the workload by optimizing AI models.
    • Tip: Monitor the temperature using the Raspberry Pi's built-in tools (vcgencmd measure_temp).
  3. Low Inference Performance

    • Solution: Use quantized models (e.g., INT8) and ensure the AI HAT+ firmware is updated.
    • Tip: Close unnecessary background processes to free up system resources.
  4. Power Supply Issues

    • Solution: Use a high-quality 5V power supply capable of delivering at least 3A.
    • Tip: Avoid using USB power banks or low-quality adapters.

FAQs

This concludes the documentation for the Raspberry Pi AI HAT+ (26T). For further assistance, refer to the official Raspberry Pi support resources.