Skip to content

Mohamed-U3/Autotracking-with-camera

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Auto-Tracking Camera System

A sophisticated camera auto-tracking system built with STM32F103 (Blue Pill) that uses stepper motors and FreeRTOS for smooth and precise object tracking. This project demonstrates advanced embedded systems programming with real-time task management and motor control.

πŸš€ Features

  • Real-Time Object Tracking: Responsive camera movement using FreeRTOS task management
  • Smooth Stepper Motor Control: Precision movement with AccelStepper library
  • Multi-Axis Control: Pan and tilt functionality for complete 3D tracking
  • Computer Vision Integration: Processes camera input for target detection and tracking
  • Low-Latency Response: Optimized for real-time performance
  • Professional PCB Design: Custom mainboard integration for reliable operation

πŸ”§ Hardware Requirements

Microcontroller

  • STM32F103C8T6 (Blue Pill development board)
  • Clock Speed: 72MHz
  • Memory: 64KB Flash, 20KB RAM

Motors & Drivers

  • 2x Stepper Motors (NEMA 17 recommended)
  • 2x Stepper Motor Drivers (A4988 or DRV8825)
  • Power Supply: 12V for motors, 3.3V for microcontroller

Additional Components

  • Camera module (compatible with computer vision processing)
  • Custom STM32 Blue Pill mainboard (see related repository)
  • Mechanical mount for pan/tilt assembly

πŸ“‹ Software Dependencies

  • PlatformIO: Development environment
  • STM32duino Framework: Arduino-compatible STM32 development
  • AccelStepper Library: Advanced stepper motor control
  • STM32duino FreeRTOS: Real-time operating system
  • ST-Link: Programming and debugging interface

πŸ›  Installation & Setup

1. Clone Repository

git clone https://github.com/Mohamed-U3/Autotracking-with-camera.git
cd Autotracking-with-camera

2. Install PlatformIO

# Install PlatformIO Core
pip install platformio

# Or use PlatformIO IDE extension for VS Code

3. Hardware Connections

STM32F103 Pin Component Function
PA0-PA3 Stepper 1 Step/Dir/Enable
PA4-PA7 Stepper 2 Step/Dir/Enable
PB0-PB1 Serial Camera Communication
PC13 LED Status Indicator

4. Build & Upload

# Build the project
pio build

# Upload to STM32 (ST-Link required)
pio upload

# Monitor serial output
pio device monitor

βš™οΈ Configuration

FreeRTOS Settings

  • Tick Rate: 1000 Hz (1ms precision)
  • Max Priorities: 5 levels
  • Heap Size: 10KB
  • Preemptive Scheduling: Enabled

Motor Configuration

// Stepper motor parameters (adjustable in main.cpp)
#define STEPS_PER_REV 200
#define MAX_SPEED 1000
#define ACCELERATION 500

🎯 Usage

  1. Power On: Connect 12V power supply and USB for serial monitoring
  2. Initialization: System automatically calibrates stepper motors
  3. Camera Input: Connect computer vision system via serial communication
  4. Tracking: Send target coordinates via serial (X, Y format)
  5. Real-Time Response: Camera smoothly tracks to target position

Serial Communication Protocol

Input Format: "X:123,Y:456\n"
- X: Horizontal position (-1000 to 1000)
- Y: Vertical position (-1000 to 1000)

πŸ“Š Performance Specifications

  • Response Time: < 50ms from input to motor movement
  • Positioning Accuracy: Β±0.1 degrees
  • Max Tracking Speed: 360Β°/second
  • Operating Range: Β±180Β° pan, Β±90Β° tilt
  • Power Consumption: 2A @ 12V (motors), 100mA @ 3.3V (MCU)

πŸ”„ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Camera    │───▢│  Computer    │───▢│   STM32     β”‚
β”‚   Module    β”‚    β”‚   Vision     β”‚    β”‚   F103      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                              β”‚
                                              β–Ό
                                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                    β”‚  FreeRTOS Tasks β”‚
                                    β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
                                    β”‚ β”‚Serial Input β”‚ β”‚
                                    β”‚ β”‚Motor Controlβ”‚ β”‚
                                    β”‚ β”‚Status Updateβ”‚ β”‚
                                    β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
                                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                              β”‚
                                              β–Ό
                                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                    β”‚ Stepper Motors  β”‚
                                    β”‚ Pan & Tilt      β”‚
                                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”§ Development Environment

  • IDE: Visual Studio Code with PlatformIO extension
  • Framework: Arduino-compatible STM32duino
  • Debugger: ST-Link V2
  • Version Control: Git with semantic commits

πŸ“ Related Projects

🀝 Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘¨β€πŸ’» Author

Mohamed Yousry Ragab

πŸ™ Acknowledgments

  • STMicroelectronics for STM32 ecosystem
  • PlatformIO community for excellent development tools
  • FreeRTOS team for real-time operating system
  • Arduino community for accessible embedded programming

⭐ Star this repository if you find it helpful!

This project demonstrates professional embedded systems development with real-time constraints and precision motor control.

About

A sophisticated camera auto-tracking system built with STM32F103 (Blue Pill) that uses stepper motors and FreeRTOS for smooth and precise object tracking via PID control. This project demonstrates advanced embedded systems programming with real-time task management and motor control.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages