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

Hey everyone, welcome to Lesson 15 of the AI on the Edge series!

In today’s lesson, we take a very important step forward. We finally bring the Raspberry Pi Camera into our OpenCV world so we can capture live video and start building real computer vision projects.  Today we learn how to pull live frames directly from the official Raspberry Pi camera using picamera2 and display them smoothly with OpenCV.

This lesson is all about building a clean, reliable foundation. I walk you through how to properly configure the Pi Camera with the modern picamera2 library — setting the resolution to 1280×720, choosing the right format, and pushing the frame rate up to 60fps. Then we bring those frames straight into OpenCV so we can see live video in a window. You’ll also learn why we use RGB888 format and how to organize your code so it stays clean as our projects get more complex.

Getting reliable live video from the Pi Camera is one of those foundational skills that opens the door to everything we’re going to do in this class — face detection, object tracking, color tracking, motion detection, and all the exciting AI projects still ahead. Once you have solid camera access, the real fun begins.

I kept this lesson straightforward on purpose. I want you to have a rock-solid base that you can build upon without fighting technical problems later. By the end of this video, you’ll have a clean, responsive live video stream running from your Raspberry Pi Camera, ready for all the computer vision magic we’re about to add in the coming lessons.

So fire up your Raspberry Pi, grab your camera module, and let’s get that live video rolling! As always, I encourage you to type the code along with me and experiment with it. Change the resolution, try different frame rates, and make it your own.

Are you ready? Let’s dive in!

In today’s lesson, this is the code which we developed:

This is the schematic we are using in these lessons:

Fusion Hat Circuit Diagram
This is the circuit we will use moving forward in the class

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

In Lesson 14 of AI on the Edge, we’re doing something really fun and powerful — we’re building a voice-controlled RGB LED that listens to you, changes colors on command, and even talks back with some personality! This is true edge AI running 100% locally on your Raspberry Pi with the Fusion HAT. No cloud, no internet, just fast, private, and responsive voice interaction right on your desk.

You simply speak a color — red, green, blue, cyan, magenta, yellow, off, or even quit — and the RGB LED instantly springs to life with beautiful color. But that’s not all. Every time you give a command, the system replies with a fun, playful spoken response using the Piper text-to-speech engine. It turns your Raspberry Pi into a charming little LED companion that feels alive and interactive.In this lesson, you’ll learn how to combine local Speech-to-Text with the STT library and natural-sounding Text-to-Speech with Piper. You’ll master PWM control of a full-color RGB LED through the Fusion HAT, and you’ll see how to use Python threading plus a queue to keep the voice listening running smoothly in the background without ever locking up your main program. The code is clean, well-structured, and includes proper startup greetings, graceful shutdown, and excellent resource cleanup — exactly the kind of solid practices we love in this series.What makes this project extra special is how it brings everything together. You get real-time voice recognition, instant hardware response, and spoken feedback — all happening locally on the edge. It’s fast, it’s private, and it’s incredibly satisfying to watch that LED light up exactly as you command while your Pi chats back at you.

Go ahead and watch the full Lesson 14 video, grab the complete code from the description, and build this project step by step with me. Once you have it running, I want you to play with it! Add new colors, create your own funny responses, or start thinking about how you could combine this voice control with sensors or other hardware in future projects.

This is the kind of hands-on, creative AI application that makes learning so exciting. You’re not just watching — you’re building real, useful skills that put you in the driver’s seat with artificial intelligence.

Fire up that Raspberry Pi, get your Fusion HAT ready, and let’s make some colors shine while the Pi talks back. I can’t wait to see what you create with this one!

Happy building, everyone — I’ll see you in the next lesson!

This is the schematic we are using for the project:

Fusion Hat Circuit Diagram
This is the circuit we will use moving forward in the class

This is the code we developed in the video:

 

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

Hey everyone, welcome back to the AI on the Edge series!

In today’s lesson, we’re taking another big step forward in building truly interactive AI projects that run right on our Raspberry Pi 5. We’re going to give our hardware a voice — literally. You’ll learn how to control the brightness of an LED using simple voice commands like “low”, “medium”, “high”, “on”, and “off”.

This lesson builds directly on the speech-to-text skills we learned earlier. Using the Fusion Hat’s microphone and the excellent STT library, we create a system where you can speak naturally to your Pi and it responds instantly by changing the LED brightness. We also bring in Python threading so the voice listening doesn’t block the main program — which is a critical skill as our projects get more complex.

One of the things I really like about this project is how it shows the power of combining AI with real hardware. You’re not just making the LED turn on and off anymore — you’re giving it smooth, adjustable brightness control using nothing but your voice. It’s a perfect example of the kind of interactive, intelligent edge computing we’re working toward in this class.

By the end of this lesson, you’ll have a solid understanding of how to use voice commands to control hardware, how to manage multiple things happening at the same time with threading, and how to create a much more natural and user-friendly interface for your projects.

This is the kind of thing that makes your Raspberry Pi projects feel alive and responsive. Whether you eventually want to control motors, lights, robots, or entire systems with your voice, the techniques you learn in this lesson will serve as a strong foundation.

So grab your SunFounder Fusion AI Hat, hook up that red LED, and let’s get your Raspberry Pi listening and responding to your voice commands like a proper smart device!

As always, I encourage you to type the code along with me in the video, then play around with it. Try adding more commands, change the LED color, or combine it with other sensors. That’s where the real learning and creativity happens.

I’m really excited to see what you build with this one!

This is the schematic we are using, from LESSON #5.

Fusion Hat Circuit Diagram
This is the circuit we will use moving forward in the class

In the video, this is the code we developed:

 

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

Hey everyone, and welcome back to the AI on the Edge series!

In today’s lesson, we’re tackling one of the most important programming concepts you’ll need as we build more advanced AI and robotics projects — Python Threading.

Up until now, our programs have been pretty linear — they do one thing at a time. But as our projects get smarter and more interactive, we often need several things happening at the same time. That’s exactly where threading comes in. In this lesson, I give you a gentle, practical introduction to threading by creating a program that blinks an LED while simultaneously listening for your commands to change the blink speed — all without one task blocking the other.

You’ll see how to create a separate thread that handles user input while the main program continues blinking the LED smoothly. We also use a Queue to safely pass data between the threads. This is a foundational skill that becomes incredibly valuable later in the class when we need to run voice recognition, camera processing, sensor reading, and motor control all at the same time.

I designed this lesson to be very beginner-friendly. If you’ve never used threading before, don’t worry — I walk you through every line of code and explain why we do things the way we do. By the end of this video, you’ll have a solid understanding of how to launch background threads, manage shared variables safely, and keep your main program responsive.

This lesson is a big stepping stone in our AI on the Edge journey. The ability to run multiple tasks concurrently is what separates simple scripts from real-world intelligent systems that can listen, think, and act at the same time.

So grab your SunFounder Fusion AI Hat, hook up an LED, and get ready to take your Raspberry Pi programming skills to the next level. Once you understand threading, a whole new world of possibilities opens up!

As always, I strongly encourage you to code along with me in the video and then experiment on your own. Try adding more LEDs, change the commands, or combine it with things we’ve learned in previous lessons. That hands-on practice is where the real learning happens.

I’m really excited for you to learn this one — it’s going to make the rest of the class a lot more fun and powerful!

In today’s lesson, this is the code we developed.

 

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

In today’s lesson, we’re taking our first exciting step into giving our Raspberry Pi the ability to understand and respond to our voice. That’s right — we’re going to control a physical LED using nothing but spoken commands! This is a huge milestone in the class because it marks the beginning of building truly interactive AI projects that can listen to us and take action in the real world.

Using the SunFounder Fusion AI Hat’s built-in microphone and the excellent STT (Speech-to-Text) library, we create a simple but powerful voice assistant that can turn an LED on and off with commands like “on”, “off”, and “quit”. I walk you through every single line of the code so you can clearly see how we capture voice input, process the command, and control real hardware.

This lesson is intentionally straightforward because I want you to build a strong foundation. Once you understand how to take a voice command and turn it into physical action, we can start adding more complexity — like controlling multiple devices, adjusting brightness, or even combining voice control with computer vision in future lessons.

One of the things I love most about this project is how it makes the Raspberry Pi feel “alive.” Instead of clicking buttons or typing commands, you can now talk directly to your project. This is the kind of interaction that makes edge AI projects so much fun and so powerful.

By the end of this lesson, you’ll have a working voice-controlled LED and the confidence to start expanding your voice control skills. This is exactly the kind of capability we need as we move forward in the AI on the Edge journey — giving our intelligent systems natural, human-friendly ways to interact with us.

So grab your Fusion AI Hat, hook up that LED, and let’s turn your Raspberry Pi into a voice-controlled device! As always, I strongly encourage you to code along with me in the video and then play around with the program. Try adding more commands, control multiple LEDs, or even have it say something back to you.

This is where things start getting really fun. Let’s get that LED responding to your voice!

This is the schematic of the circuit we are using for our AI class. We go into great detail on this schematic in LESSON #5 if you want to learn more about it.

Fusion Hat Circuit Diagram
This is the circuit we will use moving forward in the class

Now this is the code we developed in this lesson:

 

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