Real-time vision · Serial control · Edge hardware

See it.
Lock it.
Track it.

SkyGuard AI turns a webcam, YOLOv8, and an Arduino UNO into a live object-tracking system — green when locked, red when scanning, servo always following the largest target in frame.

  • YOLOv8COCO detection
  • 20°–160°smooth pan range
  • ~60 msserial feedback loop

Why SkyGuard

Built for demos, labs, and learning loops

A full perception-to-actuator path in one repo — no cloud inference required at runtime, no opaque black boxes. You see the frame, the box, the angle, and the hardware response.

Real-time lock-on

YOLOv8 scores every frame and SkyGuard locks onto the largest bounding box, so the system stays focused on the dominant target instead of flickering between noise.

Stable servo motion

Horizontal error is mapped to pan angle with a dead zone and smoothing factor — less chatter, cleaner motion, safer hobby-servo travel.

Instant status feedback

Serial commands flip LEDs and LCD state: DETECTED lights green, LOST lights red. Operators know system state without reading logs.

Everyday object coverage

Works with standard COCO classes — person, bottle, phone, cup, and dozens more — so demos work with objects you already have on the desk.

Local-first, low latency

Inference and control run on your machine over USB serial. No API keys, no round-trips to a remote vision service for the core loop.

Education-ready stack

Clear Python control loop, simple Arduino firmware, and a documented serial protocol — ideal for CV + embedded systems courses and hackathon builds.

Pipeline

From pixels to pan in six steps

The same loop implemented in detect.py — capture, detect, select, map, smooth, actuate.

  1. Capture

    OpenCV reads a webcam frame and computes the horizontal center reference line.

  2. Detect

    Ultralytics YOLOv8 runs multi-class detection with confidence thresholding (default 0.4).

  3. Select

    The largest box by area becomes the active track target for that frame.

  4. Map

    Normalized offset from frame center becomes a servo angle in a safe 20°–160° window.

  5. Smooth

    Angle updates ease toward the target; tiny errors inside the dead zone are ignored.

  6. Actuate

    Python writes angles and DETECTED / LOST over serial; Arduino drives servo, LEDs, and LCD.

Webcam
Python · YOLOv8
Serial 9600
Arduino UNO
Servo LEDs LCD

Technology

A transparent control stack

Vision

  • Ultralytics YOLOv8s (or YOLOv8n for speed)
  • OpenCV capture + HUD overlay
  • Largest-box target selection
  • Live class name + confidence readout

Control

  • Dead-zone error filtering
  • Exponential-style angle smoothing
  • Angle clamp for mechanical safety
  • Edge-triggered LED state changes

Hardware link

  • pyserial @ 9600 baud
  • DETECTED / LOST status lines
  • Integer angle commands 0–180
  • Arduino UNO firmware for servo + LCD

Bill of materials

What you need on the bench

All common maker parts — no proprietary modules required for the base build.

Part Role
Arduino UNOMicrocontroller & serial endpoint
WebcamLive video source
SG90 / MG90S servoPan axis tracking
16×2 I2C LCDOn-device status & angle
Green + red LEDsLock / lost indicators
220Ω resistors, breadboard, jumpersSafe LED drive & prototyping

Default pins

  • D7 Green LED
  • D6 Red LED
  • D9 Servo signal
  • A4 / A5 LCD SDA / SCL

Serial protocol

  • DETECTED → green lock
  • LOST → red scan
  • 90 (any 0–180) → servo angle

Where it shines

Practical use cases

Classroom demos

Show end-to-end AI → hardware interaction in minutes. Students see bounding boxes become motion.

Prototype sentry cams

Explore attention systems that point sensors or lights toward activity without a full robot stack.

Maker R&D

A clean base for pan/tilt upgrades, class filters, buzzers, or a future remote dashboard.

CV + embedded practice

Bridge computer vision, control theory basics, and serial firmware in one cohesive project.

Open source

Clone it. Wire it. Track something.

Full source, wiring guide, Arduino sketch, and Python tracker live on GitHub. Swap yolov8s.pt for yolov8n.pt when you need more FPS on lighter machines.