AI on the Edge With the Raspberry Pi 5

Digital Divide
Be Prepared, or Be Eliminated

Welcome to AI on the Edge, with the Raspberry Pi. This is our all new class, where we will teach you how to be an AI developer. Make no mistake about it. If you are just a user of chatGPT, you will we destroyed by chatGPT. If chatGPT helps you do your job, or does your job for you, you will soon make yourself irrelevant. We have discussed in great depth . . . the future will be made up of those who Drive AI, and those who will be Destroyed by AI. It is anticipated that up to 75-80% of cubicle workers could find themselves out of work in the next 18-24 months. The purpose of this class is to teach you how to future proof your career. We will teach you how to program AI, not just Use AI. Those who simply use AI, typing prompts into AI models will likely be out of work soon. It  is those who can develop it that will enjoy a bright future.

Buckle Up! It is not too late for you to learn, and not too late for you to win, but the journey starts today. Begin taking the lessons. This page will be updated as each new lesson drops so check back frequently.

These lessons are completely free, but if you feel you are benefiting and would like to support my work, please consider supporting me through Patreon:

http://www.patreon.com/paulmcwhorter

CLASS LESSONS: 

AI on the Edge LESSON 1: Introduction and Class Overview

Welcome to AI on the Edge — a complete hands-on course where we turn the Raspberry Pi 5 into a powerful, intelligent edge device. In this opening lesson, I explain the philosophy behind the class, why learning to build AI is becoming essential, and what you can expect as we progress from basic hardware control all the way to advanced computer vision and interactive AI systems. This series is designed for makers who want real skills, not just theory.

AI on the Edge LESSON 2: Raspberry Pi Operating System for Artificial Intelligence

In this lesson, we prepare our Raspberry Pi 5 for serious AI development. I walk you through installing and optimizing the best operating system and tools for running computer vision, machine learning, and real-time AI projects. Proper setup is critical, and this lesson ensures you start with a fast, stable foundation.

AI on the Edge LESSON 3: Learn Python Essentials In One Session

Before we can build intelligent systems, we need strong Python skills. This fast-paced lesson covers all the essential Python concepts you’ll use throughout the entire class — variables, loops, lists, conditionals, user input, and clean code structure. Even if you’re new to programming, by the end of this lesson you’ll have the fundamentals needed to keep up.

AI on the Edge LESSON 4: Python Averaging Grades Homework Solution

This lesson walks through the solution to the first homework assignment — creating a program that accepts multiple grades and calculates the average. Along the way, we reinforce important concepts like lists, loops, and user input. It’s a practical exercise that builds confidence before we start controlling real hardware.

AI on the Edge LESSON 5: Understanding Fusion AI HAT+ For Raspberry Pi

In this lesson, we take a detailed look at the SunFounder Fusion AI Hat+ and all its powerful features. I explain the various sensors, inputs, outputs, microphone, speaker, and expansion capabilities. Understanding this board is key to building the exciting AI projects coming later in the series.

AI on the Edge LESSON 6: Digitial Out, Servos, Analog In and PWM on the Fusion HAT+

We finally start controlling real hardware! This lesson covers digital outputs, servo motor control, reading analog sensors, and using PWM for smooth brightness control. These core skills form the foundation for all future projects where our AI systems need to interact with the physical world.

AI on the Edge LESSON 7: Homework Solution for Dimmable LED

In this lesson, we review the homework solution for building a smooth dimmable LED using a potentiometer. I explain the math behind creating a natural-feeling brightness curve and how to map analog input to PWM output. It’s a practical lesson that teaches important concepts in sensor-to-actuator control.

AI on the Edge LESSON 8: Text to Speech (TTS) On the Raspberry Pi

We give our Raspberry Pi a voice! This lesson introduces Text-to-Speech capabilities using the Fusion Hat. You’ll learn how to make your projects speak clearly and naturally, opening the door to more interactive and user-friendly AI applications.

AI on the Edge LESSON 9: Make Your Raspberry Pi Talk with TTS

Building on the previous lesson, we explore more advanced Text-to-Speech techniques. You’ll learn how to control when and what your Pi says, adjust voice settings, and integrate speech output into your programs. This is where your projects start to feel truly alive.

AI on the Edge LESSON 10: Make Your Raspberry Pi Listen to You with Voice Commands

Now we add ears to our Raspberry Pi! In this lesson, we implement Speech-to-Text so our projects can understand spoken commands. This is a major milestone as we move toward natural human-machine interaction.

AI on the Edge LESSON 11: Control LED on Raspberry Pi With Voice Commands

We combine voice input with hardware control for the first time. You’ll build a working project where you can turn an LED on and off using just your voice. This lesson brings together everything we’ve learned and shows the real power of edge AI.

AI on the Edge LESSON 12: Introduction to Python Threading on the Raspberry Pi

In this lesson, we take a major step forward by learning Python Threading. As our projects become more advanced, we need to run multiple tasks at the same time — such as listening for voice commands while still blinking LEDs or processing data. I give you a clear, beginner-friendly introduction to threads and queues so your programs can stay responsive and handle multiple operations smoothly.

AI on the Edge LESSON 13: Control LED Brightness with Voice Commands on Raspberry Pi 5

Building on our voice control foundation, this lesson shows you how to adjust LED brightness using natural voice commands like “low”, “medium”, “high”, “on”, and “off”. We combine speech recognition, threading, and PWM control to create a smooth and impressive voice-controlled dimmer. This project really starts to show the power of interactive AI running on the edge.

AI on the Edge LESSON 14: Control LED Color With Voice Commands on Raspberry Pi 5

In this lesson, we focus entirely on giving your Raspberry Pi the ability to listen and understand spoken commands. Using the Fusion Hat’s microphone, we build a solid voice command system that can reliably detect words like “on”, “off”, and “quit”. This is a critical skill as we move toward more natural human-AI interaction in the class.

AI on the Edge LESSON 15: Use the Raspberry Pi Camera in openCV to Create Live Video

This is a big and exciting milestone! We finally bring the Raspberry Pi Camera into the OpenCV world. You’ll learn how to properly configure the camera using picamera2, set resolution and frame rate, and display smooth live video in an OpenCV window. Getting reliable live video is the essential foundation for all the computer vision and face detection projects coming in future lessons.

AI on the Edge LESSON 16: Control Pan/Tilt Camera Position Using Voice Commands

In this exciting lesson we combine voice commands with physical movement for the first time. You will build a voice-controlled pan/tilt camera system that lets you point the Raspberry Pi camera in any direction simply by saying “left”, “right”, “up”, “down”, or “quit”. We integrate servo control from the Fusion HAT+, live video streaming with picamera2 and OpenCV, and Python threading so the camera can listen and display video smoothly at the same time. This project is a major milestone that brings together everything we have learned so far and sets the stage for voice-controlled object tracking and face following in upcoming lessons.

AI on the Edge LESSON 17: Decorating and Annotating Video Frames in openCV

In this lesson we take our live Raspberry Pi camera feed to the next level by learning how to draw directly on the video frames using OpenCV. You’ll discover how to create rectangles (both outlined and filled), lines, arrows, circles, and nicely scaled text overlays that stay properly sized no matter what resolution you’re running. These annotation skills are essential because once you start doing real AI — like face detection or object recognition — you’ll need to clearly show what your model is seeing by drawing boxes, labels, and other visual feedback right on the image. By the end of this lesson you’ll have the tools to turn raw video into professional, informative output ready for your future computer vision projects.

AI on the Edge LESSON 18: Display Frames Per Second (FPS) on OpenCV Video Window

In this lesson, we learn how to benchmark our video pipeline by calculating and rendering a real-time Frames Per Second (FPS) counter directly onto the live camera stream. To prevent the overlay text from jittering wildly, we implement a smooth low-pass filter mathematical formula that averages past and present frame times. Mastering this skill gives developers a reliable diagnostic tool to measure hardware performance as we begin adding heavy AI processing loads to our Raspberry Pi 5.

AI on the Edge LESSON 19: Create a Bouncing Box in OpenCV On Raspberry Pi

This lesson introduces dynamic graphics by teaching students how to animate a bounding box that automatically travels across a live video window and realistically bounces off the screen boundaries. We dive deep into using coordinate tracking, directional signs, and logical boundary conditions to manipulate pixel coordinates frame-by-frame. This exercise provides a crucial bridge into future artificial intelligence tracking lessons where our programs will have to draw boundary markers over moving, real-world targets.

AI on the Edge LESSON 20: Resizing, Moving, Converting and Tiling Video frames in OpenCV

In this session, we tackle spatial screen layouts by using programmatic math to resize, color-convert, and position multiple OpenCV windows on the desktop simultaneously. Students learn to handle frame manipulations using cv2.resize and cv2.cvtColor while mapping out clean grid coordinates that account for operating system taskbar offsets and decorative borders. The lesson culminates in building a perfectly aligned three-window layout that neatly showcases a main camera feed alongside downscaled color and grayscale variations.

AI on the Edge LESSON 21: Managing Multiple Windows in OpenCV on the Raspberry Pi

In this lesson we take a big step forward in OpenCV by learning how to create, resize, and position multiple windows on the screen at the same time. We build a complete multi-window layout featuring a large main camera view, a smaller color preview, a grayscale version, and five tiny grayscale thumbnails — all running smoothly together in real time. Mastering multiple windows is an essential skill that allows you to build much more powerful and professional computer vision projects on the Raspberry Pi.

AI on the Edge LESSON 22: Understanding Pictures and Video Frames as a Data Structure

This lesson explores how video frames function as multidimensional NumPy arrays, allowing us to manipulate visual data by directly modifying pixel values within the grid. We learned to extract specific Regions of Interest (ROI) and apply image processing techniques like grayscale conversion to demonstrate how memory slicing enables more efficient computer vision. By mastering these fundamental data structures, you are preparing to feed and process the complex numerical inputs required for building advanced AI models.

AI on the Edge LESSON 23: Creating Regions of Interest (ROI) in OpenCV with Slicing

This lesson demonstrates how to isolate and manipulate specific rectangular portions of a video frame using Python’s NumPy matrix slicing notation. Students learn the critical structural importance of using the .copy() method to modify targeted sub-regions independently without accidentally altering the underlying main camera feed. Finally, the tutorial builds a multi-window desktop layout to seamlessly organize and display multiple synchronized image matrices in real time.

AI on the Edge LESSON 24: Processing Mouse Events in OpenCV on Pi 5

This lesson introduces interactive computer vision by teaching students how to capture and process real-time mouse events within an OpenCV window. It highlights the critical architectural distinction between standard Cartesian coordinate tracking $(x, y)$ and NumPy’s row-column matrix indexing $[y, x]$ to avoid system crashes during pixel lookups. By implementing a global frame structure and callback function, the tutorial establishes the foundational mechanics required to build responsive, point-and-click user interfaces on edge hardware.

AI on the Edge LESSON 25: Create Region of Interest (ROI) in openCV Using the Mouse

In this lesson, you will learn how to enhance your computer vision projects by using mouse callback functions to dynamically define a Region of Interest (ROI) within a live video feed. By restricting processing to a specific area of the frame, you can significantly improve system efficiency and focus your AI models on relevant data rather than background noise. This practical, interactive approach allows you to build more professional, real-world vision systems by capturing mouse events to draw bounding boxes in real-time.

AI on the Edge LESSON 26: Understanding the HSV Color Space in OpenCV

This lesson demonstrates how to shift from traditional RGB/BGR pixel math into the HSV Color Space to achieve robust, real-time object tracking that remains completely immune to shifting shadows and room lighting. By leveraging OpenCV’s bitwise masking and the Picamera2 library, the script smoothly processes a high-speed 60 FPS video pipeline on the Jetson Orin. Finally, it closes the loop between software and the physical world by driving a SunFounder Fusion HAT+ to dynamically pulse an external RGB LED, matching its colors perfectly to whatever pixel your mouse selects on the screen.

AI on the Edge LESSON 27: Track Objects of Interest in OpenCV Using Contours

In this lesson we turn on the Pan/Tilt servos to allow our project to track an object of interest based on color.

AI on the Edge LESSON 28: Use Pan Tilt Camera to Track Object of Interest in OpenCV

AI on the Edge LESSON 29: Improved Proportional Object Tracking with Pan Tilt Camera

AI on the Edge LESSON 30: Tune Object Tracker with Mouse Selected ROI

AI on the Edge LESSON 31: Facial Recognition in OpenCV Using Haarcascades

AI on the Edge LESSON 32: Facial Recognition and Eye Tracking in OpenCV

AI on the Edge LESSON 33: Tracking Faces with Pan Tilt Camera in OpenCV on Pi 5

AI on the Edge LESSON 34: Project Combining TTS, STT, Face Recognition and Servos on Pi 5

AI on the Edge LESSON 35: Running Multiple Pi Cameras and USB Cameras on the Pi 5

AI on the Edge LESSON 36: Select Active Camera in OpenCV With Voice Commands

AI on the Edge LESSON 37: Using RTSP and IP Cameras in OpenCV on Raspberry Pi 5

AI on the Edge 38: Using Mediapipe for Face Recognition on the Raspberry Pi 5

AI on the Edge LESSON 39: Understanding MediaPipe Data Structures

AI on the Edge LESSON 40: Active Face Tracker with Pan Tilt Camera and MediaPipe

AI on the Edge LESSON 41: Creating FaceMesh Using MediaPipe in OpenCV

AI on the Edge LESSON 42: Create Composite Images Using Masks in OpenCV and MediaPipe

AI on the Edge LESSON 43: Adding an SSD1306 OLED Screen to Your Raspberry Pi Projects

AI on the Edge LESSON 44: Displaying Live MediaPipe FaceMesh Avatar on SSD1306 OLED in OpenCV

AI on the Edge LESSON 45: Adding a NeoPixel Ring To Your Raspberry Pi Project

AI on the Edge LESSON 46: Ultimate Dazzleing Running Rainbow On a NeoPixel Ring

AI on the Edge LESSON 47: Emotion Detector Using MediaPipe, OpenCV and Raspberry Pi

AI on the Edge LESSON 48: Hand Detection in OpenCV and MediaPipe on the Raspberry Pi

AI on the Edge LESSON 49: Live Animated Avatars on the SSD1306 OLED With OpenCV

AI on the Edge LESSON 50: Control NeoPixel Ring With Hand Gestures and MediaPipe

Making The World a Better Place One High Tech Project at a Time. Enjoy!