This is an IoT project. It uses a camera to see your face. It moves a motor to follow your face.
- Finds faces in camera picture
- Watches face movement left and right
- Turns motor left or right when face moves
- Shows boxes and lines on screen
- Sends commands to Arduino
- Can work without Arduino for testing
- You can change settings
- Arduino board
- Stepper motor
- Camera (webcam or laptop camera)
- USB cable
- Python 3.7 or newer
- OpenCV
- NumPy
- PySerial
- Get project files
- Install programs:
pip install -r requirements.txt - Upload Arduino code to board
- Connect motor to Arduino pins 8,9,10,11
- Connect Arduino to computer
Run: python3 index.py
Press 'q' to stop.
In index.py, change numbers:
- MOVEMENT_THRESHOLD = 10 (how much face moves to turn motor)
- LEFT_ROTATION = -25 (degrees left)
- RIGHT_ROTATION = 25 (degrees right)
- SCALE_FACTOR = 1.1 (face finder sensitivity)
- MIN_NEIGHBORS = 3 (face finder strictness)
- Find face in picture
- Find center of face
- Check if face moved
- Send turn command to Arduino
- Arduino turns motor
Python sends: rotate 25 or rotate -10
Number is degrees (positive = one way, negative = other way).
- "Arduino not found": Check USB and cable
- No face found: Good light, closer to camera
- Motor not moving: Check Arduino code and wires
- Wrong turn: Change LEFT_ROTATION and RIGHT_ROTATION
- index.py - Main program
- stepper_motor_angle_control.ino - Arduino code
- requirements.txt - Programs to install
- USAGE.md - More help
- Add up/down motor
- Smoother motor moves
- Auto center button
- Web page control
- Follow different people
Free to use and share.