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 projects. Manufactured by Raspberry Pi, this HAT features a high-performance neural processing unit (NPU) optimized for machine learning tasks, enabling real-time AI inference on edge devices. It also includes GPIO pins for seamless integration with sensors, actuators, and other peripherals, making it ideal for AI-driven IoT applications.

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 packed with features to support a wide range of AI and machine learning applications. Below are the key technical details:

General Specifications

Parameter Value
Manufacturer Raspberry Pi
Part ID AI HAT+
Neural Processing Unit 1 TOPS (Tera Operations Per Second)
GPIO Compatibility 40-pin Raspberry Pi GPIO header
Power Supply 5V DC (via Raspberry Pi GPIO or USB-C port)
Operating Temperature -20°C to 70°C
Dimensions 65mm x 56mm x 15mm

Pin Configuration and Descriptions

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

Pin Number Pin Name Description
1 3.3V Power Power supply for the HAT
2 5V Power Main power input for the HAT
3 GPIO2 (SDA1) I2C Data Line
5 GPIO3 (SCL1) I2C Clock Line
7 GPIO4 General-purpose input/output
8 GPIO14 (TXD) UART Transmit
10 GPIO15 (RXD) UART Receive
12 GPIO18 (PWM0) Pulse-width modulation output
16 GPIO23 General-purpose input/output
18 GPIO24 General-purpose input/output
20 GND Ground
22 GPIO25 General-purpose input/output
40 GPIO21 (SDA3) I2C Data Line (alternative)

Usage Instructions

How to Use the AI HAT+ in a Circuit

  1. Attach the HAT to the Raspberry Pi: Align the 40-pin GPIO header on the HAT with the Raspberry Pi's GPIO pins and press gently to secure the connection.
  2. Power the Raspberry Pi: The HAT draws power directly from the Raspberry Pi. Ensure the Raspberry Pi is powered via its USB-C port.
  3. Install Required Software:
    • Update the Raspberry Pi OS:
      sudo apt update && sudo apt upgrade
      
    • Install the AI HAT+ drivers and SDK:
      sudo apt install ai-hat-plus-sdk
      
  4. Connect Peripherals: Use the GPIO pins to connect sensors, cameras, or other devices as needed for your project.
  5. Run AI Models: Deploy pre-trained machine learning models using the HAT's NPU for real-time inference.

Important Considerations and Best Practices

Example Code for Raspberry Pi

Below is an example Python script to perform object detection using the AI HAT+:

# Import necessary libraries
from ai_hat_plus import AIHAT
import cv2

# Initialize the AI HAT+ object
ai_hat = AIHAT()

# Load a pre-trained model (TensorFlow Lite format)
model_path = "/home/pi/models/object_detection.tflite"
ai_hat.load_model(model_path)

# Open the camera feed
camera = cv2.VideoCapture(0)

while True:
    # Capture a frame from the camera
    ret, frame = camera.read()
    if not ret:
        print("Failed to capture frame. Exiting...")
        break

    # Perform object detection
    results = ai_hat.run_inference(frame)

    # Display results on the frame
    for obj in results:
        # Draw bounding boxes and labels
        x, y, w, h = obj['bbox']
        label = obj['label']
        confidence = obj['confidence']
        cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)
        cv2.putText(frame, f"{label} ({confidence:.2f})", (x, y-10),
                    cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)

    # Display the frame
    cv2.imshow("Object Detection", frame)

    # Exit on pressing 'q'
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# Release resources
camera.release()
cv2.destroyAllWindows()

Troubleshooting and FAQs

Common Issues and Solutions

  1. HAT Not Detected:

    • Ensure the HAT is properly seated on the GPIO header.
    • Verify that the AI HAT+ drivers are installed correctly.
  2. High Temperature:

    • Use a heatsink or fan to cool the HAT during intensive tasks.
    • Avoid running the HAT in environments exceeding 70°C.
  3. Model Incompatibility:

    • Check that the model is in TensorFlow Lite or ONNX format.
    • Use the AI HAT+ SDK to convert unsupported models.
  4. Power Issues:

    • Ensure the Raspberry Pi's power supply provides at least 3A at 5V.

FAQs

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