FaceTrackBot is a Python-Arduino project that uses OpenCV for real-time face detection and controls a 28BYJ-48 stepper motor via Arduino to keep a face centered.
app.py- Main tracking + motor controlcamera.py- Detects working camera indexsketch_oct30a.ino- Arduino stepper sketchrequirements.txt- Python dependencies
- Clone repo:
git clone <repo_url> - Create venv:
python -m venv .venvand activate it - Install dependencies:
pip install -r requirements.txt
- Open
sketch_oct30a.inoin Arduino IDE - Select board: Arduino Uno, select COM port
- Upload sketch and close Serial Monitor
- Run
camera.pyto find working index (0 default) - Use index in
app.pyforcv2.VideoCapture()
python app.py- Motor follows detected face horizontally
- Press
qto quit
KP- Proportional gain (0.01-0.1)DEADZONE- Pixel toleranceMIN_ANGLE/MAX_ANGLE- Arduino stepper limits
- Serial port error: Close Serial Monitor, check COM
- Blank camera: Ensure no other app uses camera
- Stepper not moving: Check wiring and pins
Mugisha Chrispin | GitHub: Mchiir | MIT License