AI Sitting Posture Coach With Voice Alerts
by KimY21 in Circuits > Cameras
16 Views, 0 Favorites, 0 Comments
AI Sitting Posture Coach With Voice Alerts
It's hard to notice your own posture while you're working, and most posture-correcting gadgets are either expensive or uncomfortable to wear. This project uses a single camera instead: it measures how far your neck and spine tilt while you sit and plays a spoken reminder when you slouch.
The pose estimation runs locally on the device, so there are no wearable sensors and no video leaves your machine. It works on any Grablo-supported device, and on a laptop the built-in camera and speaker are enough. No coding is involved — the whole thing is built by adding blocks in the Grablo app, and this guide goes through it from a blank project to a working build.
What you'll build:
- An AI pipeline that detects whether a person is present and measures their neck and spine tilt in real time
- Logic that judges good versus bad posture and waits five seconds before raising an alert, so brief movements don't trigger false alarms
- A text-to-speech voice reminder that plays the moment you slouch
- A dashboard with the live camera feed, both tilt angles, and the current posture status
Supplies
Hardware:
- Windows PC, Mac, Raspberry Pi 4+, or any other Grablo-supported device
- USB or CSI camera (not required for laptops with a built-in camera)
- Speaker (not required for laptops with a built-in speaker)
Software:
- Grablo — No-Code IoT Platform (grablo.co)
Quick Start
If you'd rather not build it from scratch, you can copy the finished project from the Grablo Gallery:
- Download and install Grablo on your device from grablo.co/download
- Open the Gallery project and click Copy to My Projects
- Place a camera to your side at roughly shoulder height so it can see your head and back
- Open the project and, in Project Settings → Camera, click Scan to select your webcam
- Connect to your device, hit RUN, sit in view, and tune the tilt thresholds to your setup
To understand how it works, follow the steps below to build it yourself.
Create the Project and Dashboard
Head to app.grablo.co and create a new project named "AI Posture Coach." When asked which device to target, this project works on any Grablo device, so you can select All Devices.
A quick mental model before we start: Grablo organizes everything into logics (independent programs that run in parallel), each containing controls (when-this-happens blocks) that hold actions (do-this steps). We'll use two logics — one to run the AI, and one to react to it.
Now build the dashboard so you can watch everything as you go. Add a Camera widget (we'll attach the camera in the next step) for the live feed, and three Value widgets to display the current neck tilt, spine tilt, and posture status. Watching the tilt numbers move as you shift in your seat is the easiest way to pick thresholds that match your body and camera angle.
Set Up the AI Pose Estimation
First we'll build the logic that kicks off the pose-estimation AI. Because the AI only needs to start once when the project launches, add a control with a Once type condition. Inside that control:
- Add an AI Analysis action. Create a new AI Analyzer, then add a new camera.
- Grablo supports many camera types; for this example we'll use a standard webcam — built into your laptop, or a USB webcam on your desktop. Set the Camera Source to CSI/USB, click Scan to find your camera, pick a resolution, then add and select it.
- For the AI Model, choose Pose Estimation, and set the Mode and GPU Acceleration to match your device hardware.
Now tell the analyzer what to measure. Select the AI Analyzer, set the Command to Add Analysis and the Type to Person Detected, then create a variable to store whether a person is in view and assign it. Duplicate the action, change the Type to Joint Angle with the Joint set to Neck Tilt, and assign it a new variable. Duplicate once more for Spine Tilt into its own variable.
Finally, duplicate the block one last time and change the Command to Start Analysis to kick off the AI. That's the entire first logic — from now on, those three variables (person present, neck tilt, spine tilt) update continuously in the background. Don't forget to go back and select this camera in your dashboard's Camera widget.
Build the Posture Logic and Voice Alert
Now create a second logic to evaluate posture in real time. Add a control with an Always type condition so it's checked constantly. Inside it, add a Set Variable action, create a Digital (true/false) variable for whether the posture is good, and open the Block Editor to define its value.
Here's the idea behind the numbers: sitting upright reads as roughly 0 degrees, and the more you slouch, the further the tilt swings away from zero. In this example our camera makes slouching swing the angle positive, so we call it good posture when Neck Tilt is under 30° AND Spine Tilt is under 10°. The sign depends on which side your camera faces — from the other side a slouch swings negative, so you'd flip the operator and use negative thresholds. Run a quick test later and adjust to fit your body.
Next, turn that decision into something you can see and hear. Add a control with a Compare condition: Person Detected Equal True. Everything about reporting posture lives inside this control, so it only runs when someone's actually there:
- Good posture — inside, add a control comparing Is Good Posture to True, then a Set Variable action that creates a Text variable called Status and sets it to Good.
- Bad posture — add a control comparing Is Good Posture to False. Turn on the Hold Time option so it only triggers after posture stays bad for 5 seconds straight (this is what prevents false alarms from brief movements). Inside, set Status to Bad, then add a Text To Speech action: create a new TTS, set the language and model, set Command to Play, and type your message, e.g. "Please correct your posture."
Finally, back at the top level, add a control comparing Person Detected to False and set Status to No Person. That completes the logic.
Run and Test
Run
- Open the Grablo app, select your project, and connect to your device
- Hit RUN
- Sit in front of the camera and try both an upright and a slouched pose
Expected results:
- The camera feed shows you in real time and the tilt angles update live as you move
- Sitting upright shows "Good" right away
- Slouching for more than five seconds shows "Bad" and plays the voice reminder
- Stepping away shows "No Person"
Video Tutorial
Expand Your Project
Expand Your Project
- Log posture data over time to see how your habits change through the day
- Swap in a push notification or Telegram message in place of (or alongside) the voice reminder
- Add a break reminder that suggests standing up and stretching after long sitting sessions
- Track additional joints, such as shoulder level, for a more complete posture score
- Mount it on a Raspberry Pi for an always-on, low-power desk companion
Troubleshooting
- Posture status never changes: watch the live tilt angles as you slouch and note which way they move. Depending on which side your camera faces, a slouch may produce a negative angle, so flip the comparison operator and use negative thresholds.
- Voice alert not playing: check the speaker connection and the device's audio output, and confirm the text-to-speech language and model are set.
- Pose not detected: improve the lighting, make sure your upper body is fully in frame, and keep the camera roughly level with your torso.
- Alerts trigger too easily or too late: raise or lower the five-second hold time and adjust the tilt thresholds until it feels right.