Articles

AI Squats Counter Using RDK X5 D-Robotics

Last Updated on September 15, 2026 by Engr. Shahzada Fahad

Description:

Today I am going to turn this small AI computer into a personal gym trainer “Squats Counter”.



Small AI Computer Squats Counter – RDK X5 D-Robotics
Small AI computer used as an AI-powered squats counter.

It will watch my body…




AI Squats Counter Watching Body Movement Using RDK X5
AI squats counter monitors body movement to detect and count squats.

detect my movement…



AI Squats Counter Automatically Counting Squat Repetitions
AI squats counter automatically counts each squat repetition.

and count my squats automatically.

No smart watch.

No phone.

Just pure computer vision.



Pure Computer Vision Squats Counter Using RDK X5
Pure computer vision system used to detect and count squats automatically.

But here is the interesting part…

I will test three different AI methods.

Method 1: A simple bounding box trick.

Simple Bounding Box Trick for AI Squats Counter Using RDK X5
Simple bounding box method used to detect and count squats.

Method 2: A body skeleton system.



Body Skeleton System for AI Squats Counter Using RDK X5
Body skeleton system used to detect and count squats with AI.

Method 3: A high-performance BPU powered AI model.

High-Performance BPU Powered AI Model for Squats Counter Using RDK X5
High-performance BPU-powered AI model used for real-time squat detection and counting.

And the results are honestly surprising.

So, without any further delay let’s get started!!!

Amazon Links:

RDK X5

RDK Stereo Camera

USB Camera

HDMI Screen

Keyboard and Mouse

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

Project Introduction

The brain of this project is the RDK X5 AI development board from D-Robotics.




RDK X5 AI Squats Counter for Real-Time Squat Detection
RDK X5 used as an AI-powered squats counter for real-time exercise tracking.

This board is designed for real-time AI applications.

It has:

CPU

GPU and a powerful

BPU (Brain Processing Unit) for AI acceleration.

To make this possible, we will be using a MIPI camera to capture everything in real time,



MIPI Camera for RDK X5 AI Squats Counter
MIPI camera used with the RDK X5 for real-time squat detection and counting.

 Because it gives us lower latency and much better performance compared to a USB camera.

The AI will detect a person…

Track body movement…

And count how many squats we do.

We will also use an LED so the system can give feedback during exercise.



LED Feedback System for RDK X5 AI Squats Counter
LED provides real-time feedback during AI-powered squat exercises.

Led is optional, it’s just to show, you can also control hardware.

Led is connected to the GPIO37.



GPIO37 LED Control for RDK X5 AI Squats Counter
GPIO37 used to control the LED for real-time squat counter feedback.

But before jumping to the advanced AI method…

Let’s start with the simplest idea possible.

Method 1

Bounding Box Squat Counter (YOLO)

Our first method uses YOLO object detection.

YOLO stands for You Only Look Once.

It is one of the most popular real-time object detection models.

This model detects objects like:

  • Person
  • Car
  • Chair
  • Phone
  • And many others.

In our case, we only care about one object: the person.

Most Popular Real-Time Object Detection Models for AI Squats Counter
Real-time object detection model used for AI-powered squat counting.

When YOLO detects a person, it draws a bounding box around the body.

From this box we can get the top coordinate of the head.

And here is the simple idea.

When a person stands up, the head is higher.




Head Higher Position in AI Squats Counter Using RDK X5
Head remains higher when the person is standing during squat detection.

When a person squats down, the head moves lower.

Head Moves Lower During Squat Detection Using RDK X5
The head moves lower as the person enters the squat position.

So we can measure this vertical movement.

The program first calibrates the standing height.

Then it checks how much the head moves downward.

If the head drops more than a certain number of pixels, we say the person is in the squat position.



Head Moves Lower During Squat in AI Squats Counter
Head moves lower as the person squats down during AI squat detection.

When the person stands back up, we count one repetition.

Person Stands Back Up During AI Squats Counter Detection
Person stands back up after completing the squat movement.

And that’s it.

A very simple logic.

Code:

Code Explanation

The system loads the YOLOv5 model.

Then the camera captures frames.

Each frame is sent to the AI model.

The model detects a person and returns the bounding box.

From the bounding box we track the top point of the head.

Then we calculate the displacement.

If the head moves down enough → state becomes DOWN.

If the head moves back up → we count one squat.

We also turn ON the LED when the person goes down.

This gives real-time feedback during exercise.

Pros and Cons — Method 1

Advantages

This method is very beginner friendly.

It is easy to understand.

It only requires object detection.

Head Higher Position in AI Squats Counter Using RDK X5
Head remains higher when the person is standing during squat detection.

No complicated math.

So beginners learning computer vision can build this quickly.

Disadvantages

But there are also problems.

The system only tracks the head position.

So if the person:

Bends forward

Moves sideways



Person Moving Sideways During AI Squats Counter Detection
Sideways movement can affect squat detection accuracy.

Or the camera angle changes

The squat detection becomes inaccurate.

Method 2

Body Landmark Detection (MediaPipe)

Instead of detecting just the person…

What if we detect the entire body skeleton?

That is exactly what MediaPipe Pose does.



MediaPipe Pose for AI Squats Counter Using RDK X5
MediaPipe Pose tracks body landmarks for real-time squat detection.

This system detects 33 body landmarks.

For example:

Shoulders

Hips

Knees

Ankles

Wrists

And many more.

This means we can track actual body joints.

So instead of guessing the squat using head movement…

We can calculate the knee angle.

How the Squat Detection Works

Let me explain; how it works.

When a person stands up…

Knee Angle Close to 180 Degrees in AI Squats Counter
Knee angle remains close to 180 degrees when standing during squat detection.

The knee angle is close to 180 degrees.

When the person squats…

Person Squatting During AI Squats Counter Detection
Person squats down as the AI system detects the exercise movement.

The knee angle becomes smaller.

Usually around 90 to 100 degrees.

So we track three points:

  1. Hip
  2. Knee
  3. Ankle

Then we calculate the angle at the knee joint.

If the angle goes below a threshold, we say the person is squatting.

When the angle goes back above another threshold, we count one rep.

Code:

Code Concept

The program captures the image from the camera.

Then MediaPipe detects the body landmarks.

We extract the coordinates of:

  • Hip
  • Knee
  • Ankle

Then we calculate the joint angle using trigonometry.

If the angle drops below the squat angle, we mark the DOWN state.

When the angle increases again, we count the squat.

We also turn an LED ON when squatting.

And turn it OFF when standing.

Pros and Cons — Method 2

Advantages

This method is much more accurate.




Much More Accurate AI Squats Counter Using Body Pose Detection
More accurate squat detection using AI body pose estimation.

Because it tracks real body joints.

It works even if:

The person bends forward

Person Bends Forward During AI Squats Counter Detection
Person bending forward during squat detection with the AI squats counter.

The head moves

The body shifts slightly

It is also great for beginners learning pose estimation.

Disadvantages

However…

MediaPipe runs mostly on the CPU.

MediaPipe Runs Mostly on the CPU for AI Squats Counter
MediaPipe runs primarily on the CPU during real-time squat detection.

Which means it can become slow on embedded systems.

Especially when processing every video frame.

So the FPS may drop.

This is why professional systems use hardware AI accelerators.

And that brings us to the final method.

Method 3

Gym Level Squat Counter (BPU Powered)

Now we move to the most powerful solution.

Instead of running AI on the CPU…

We use the BPU of the RDK X5.

BPU Brain Processing Unit for RDK X5 AI Squats Counter
BPU provides AI acceleration for real-time squat detection.

BPU stands for Brain Processing Unit.

It is designed specifically for deep learning workloads.

This means the AI model can run much faster and more efficiently.

In this setup we run a body detection and keypoint model optimized for the BPU.

The model detects:

Full Skeleton Keypoints for RDK X5 AI Squats Counter
Full body skeleton keypoints used for real-time squat detection.

Body

Face

Hands

And full skeleton keypoints.

And the best part is…

The skeleton detection runs directly on the AI accelerator.

We track the hip, knee, and ankle joints.

Tracking Hip Knee and Ankle Joints for AI Squats Counter
AI squats counter tracks the hip, knee, and ankle joints to analyze squat movement.

Calculate the squat angle.

And count repetitions in real time.

AI Squats Counter Counting Exercise Repetitions in Real Time
AI squats counter counts exercise repetitions in real time.

This method is fast, stable, and accurate.

This is the kind of system that could be used in:

Smart gyms

Fitness mirrors

AI trainers

Rehabilitation systems

As accurate, reliable, and efficient as this system is, building it can be quite tricky.

When I first started working on this project, it took me almost one full week to make everything work properly.

There were many things to configure.

Model settings…

AI pipeline…

ROS nodes…

And the keypoint detection system.

So it can get a little tricky, especially if you are doing this for the first time.

But don’t worry.

I have already prepared everything for you.

All the project files are ready to download from my Patreon page.

You just download the project…and you are basically good to go.

Along with the code, I also included a step-by-step guide document.

Inside that document, I explain every single step.

From creating the project directory…to copying the files…to running the system.

Everything is explained clearly so you don’t get stuck.

And trust me… this document will make your life much easier.

Because once you understand this workflow…you can use the same steps to build many other amazing AI projects.

For example:

AI security systems…

Gesture recognition…

Fitness tracking…

Or even smart robotics.

Final Comparison

Let’s quickly compare all three methods.

Method 1 — Bounding Box

Simple Bounding Box Trick for AI Squats Counter Using RDK X5
Simple bounding box method used to detect and count squats.

Very simple

Beginner friendly

But not very accurate

Method 2 — MediaPipe Skeleton

MediaPipe Pose for AI Squats Counter Using RDK X5
MediaPipe Pose tracks body landmarks for real-time squat detection.

More accurate

Better movement understanding

But slower on embedded hardware

Method 3 — BPU AI Model

BPU Brain Processing Unit for RDK X5 AI Squats Counter
BPU provides AI acceleration for real-time squat detection.

Very fast

Very accurate

Hardware accelerated

This is the professional solution.

With systems like the RDK X5, we can build amazing AI fitness tools.

Smart gyms.

AI personal trainers.

Or even health monitoring systems.

So, that’s all for now.

Support me on Patreon:

If you enjoy my work and find these projects helpful, please consider supporting me on Patreon. With just $1, you can get access to all project source codes, schematics, and extra resources that I share with my supporters. Your support helps me continue creating new electronics tutorials, experiments, and open projects for the community. Thank you so much for being part of this journey and for supporting my work!

Watch Video Tutorial:

I Tested 3 AI Methods to Count My Squats (RDK X5)


Discover more from Electronic Clinic

Subscribe to get the latest posts sent to your email.

Engr. Shahzada Fahad

Engr. Shahzada Fahad is an Electrical Engineer with over 15 years of hands-on experience in electronics design, programming, and PCB development. He specializes in microcontrollers (Arduino, ESP32, STM32, Raspberry Pi), robotics, and IoT systems. He is the founder and lead author at Electronic Clinic, dedicated to sharing practical knowledge.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button

Discover more from Electronic Clinic

Subscribe now to keep reading and get access to the full archive.

Continue reading

Electronic Clinic
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.