Category Archives: AI On the Edge

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

n Lesson 6, we’re really starting to get our hands dirty with real hardware control. Today we dive into the core fundamentals of physical computing on the SunFounder Fusion AI Hat — learning how to use Digital Outputs, control Servos, read Analog Inputs, and generate PWM signals.

This is a big lesson because it bridges the gap between writing simple Python scripts and actually making the Raspberry Pi interact with the physical world. You’ll learn how to turn LEDs on and off using digital outputs, precisely control the position of a servo motor, read values from a potentiometer using the Analog-to-Digital Converter, and smoothly adjust brightness using PWM (Pulse Width Modulation).

I take my time in this video to explain not just how to do these things, but why they work the way they do. Understanding PWM is especially important because it’s a technique we’ll use heavily later in the class when controlling motors, adjusting LED brightness, generating audio tones, and more.

By the end of this lesson, you’ll have a solid foundation in hardware control using the Fusion HAT. These skills are critical as we move forward in the AI on the Edge journey — because no matter how smart your AI code is, it eventually has to do something useful in the real world, whether that’s moving a camera, turning on lights, or controlling a robot.

This lesson marks the point where we shift from just blinking LEDs to building real, useful control systems. The combination of reading sensors (Analog In) and controlling actuators (Servos + PWM) is exactly what intelligent edge devices need to sense and act.

So grab your Fusion AI Hat, hook up an LED, a servo, and a potentiometer, and let’s start giving your Raspberry Pi real physical superpowers!

As always, I strongly encourage you to code along with me in the video. Try different servo angles, change the PWM frequency, and experiment with mapping the potentiometer to different outputs. That hands-on practice is where the real learning happens.

You’re doing great — we’re building something special here. Let’s keep going!

The schematic for the circuit we will be using in today’s lesson if below. We describe it in more detail in the video. The schematic is:

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

In the video lesson we demonstrated the following programs:

Digital output to blink an LED:

PWM Example to Control RGB LED Color and Brightness.

Reading Analog Voltages on the Pi 5 Using the Fusion HAT+

Controlling Servos With the Fusion AI HAT+

 

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

In today’s lesson we will become familiar with the capabilities of the Fusion AI Hat+ for the Raspberry Pi. This hat will be a core part of our class moving forward. The hat makes it easy to get data from the outside world, and to control things in the outside would. We will get an understanding of the core capabilities of the board, and your homework will be to build the first circuit with the board.  This schematic shows the various parts of the board:

Fusion AI Hat for Raspberry Pi Schematic

Then for the homework, we need you to go ahead and build this circuit. This circuit will allow us to learn how to make Digital Output commands, PWM commands, and how to read analog inputs.

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

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

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

In Lesson 3, I gave you your first real programming homework — to create a program that lets the user enter multiple grades and then calculates the average. In today’s Lesson 4, we go through the solution together step-by-step.

This lesson is all about learning how to work with lists (also called arrays), using for loops effectively, and building clean, organized code. Even though averaging grades might seem simple, these are fundamental programming skills that we will use constantly as we move forward in this class. Whether we’re averaging sensor readings, smoothing camera data, calculating confidence scores from AI models, or processing batches of information — the ability to collect data, store it, and process it is extremely important.

In the video, I walk you through a clean solution that uses a list to store all the grades, then loops through that list to calculate the total before dividing by the number of grades. You’ll also see how to display the original grades back to the user and present the final average in a nice, readable way.

I really enjoy these early lessons because this is where you start developing good programming habits. The techniques you learn here — using lists, loops, and organizing your code — will become the building blocks for much more powerful AI projects later in the series.

By the end of this lesson, you should feel much more comfortable working with lists and loops in Python. These skills are going to be used over and over again as we start reading sensors, processing camera frames, and handling data from AI models.

So if you tried the homework, awesome! If you got stuck, that’s perfectly okay — that’s exactly why we go through the solution together. Take the code, run it, and then I strongly encourage you to modify it. Try adding letter grades (A, B, C), calculate the highest and lowest grade, or make it keep running until the user wants to quit. The more you play with it, the faster you’ll learn.

You’re doing great! These early Python lessons are the foundation we need before we start combining code with real hardware and AI in the coming lessons. Keep going — we’re building something really cool here!

This is my homework solution.

 

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

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

In today’s lesson, we’re doing something really important. Since this entire class is going to be taught using Python, I wanted to make sure everyone — even complete beginners — has a solid foundation before we start attaching hardware and diving into real AI projects.

In this marathon session, I take you through all the Python essentials you’ll need for the rest of the class. We cover variables, data types, if statements, for loops, while loops, lists, getting user input, and how to organize your code in a clean, readable way. I even share my personal philosophy on keeping code simple (you’ll notice I avoid nested else statements like the plague because I like my logic clean and easy to follow).

This lesson is designed to be a complete “Python boot camp” in one video. Even if you’ve never written a line of code before, by the end of this lesson you’ll have the core skills needed to keep up with everything we’re going to build in this series. And if you’re already comfortable with Python, this is still a great refresher with my specific style and approach that we’ll be using throughout the class.

I really believe that strong programming fundamentals are the key to success in AI on the Edge. Once you’re comfortable with these basics, we can focus on the fun stuff — controlling hardware, reading sensors, processing camera images, using voice commands, and building intelligent systems.

So whether you’re brand new to programming or just need a solid review, grab a cup of coffee, settle in, and let’s spend some quality time getting you up to speed with Python. I encourage you to code along with me in the video and actually type every example. That hands-on practice is what makes it stick.

By the end of this lesson, you’ll be ready for the homework assignment, which will test everything we covered today. Once you’ve got that down, we’ll be ready to start connecting real hardware in the very next lessons.

You’ve got this! Let’s turn you into a confident Python programmer so we can go build some amazing AI projects together.

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

The major challenge we face in this AI on the Edge class is getting a Raspberry Pi 5 configures where you have all the AI Models, Libraries, Modules and Methods installed, and where they all play nicely together. Often, when you add a new model, the old model becomes broken. This is because when you install something new, it often times updates the dependencies. That means it updates a library already on your system. For example, lets say you have numpy 14, working with YOLO 11. Now you install mediapipe, and it updates numpy 14 to numpy 15. This then ‘Breaks’ your YOLO, as it wanted a different version of numpy.  Likely you will get frustrated and quit before you get the dependency problems solved. In order to get around this, you can use a special education version of the Bookworm OS, which has all the needed libraries installed already and working nicely with each other. The video above shows you how to install this OS. Once you do, no not update it, do not upgrade it, do not touch it. Use it to develop your programs and projects for this class. If you want to do something else with your pi, have a separate SD card.