A Simple Arduino project that uses the camera (python script) to turn coordinates into degrees for servos attached to an arduino and turn on a water pump to spray water. (Turret)
- Arduino board
- 4 servo motors (horizontal, vertical and 2 servo's to turn the pump on/off)
- LED
- Webcam
- USB cable for Arduino connection
- Water pump
- Breadboard if you don't have an Arduino sensor board
- horservo: Pin 8
- verservo: Pin 7
- LED: Pin 6
- servo_on: Pin 5
- servo_off: Pin 4
- Python 3.x
- OpenCV (cv2)
- pyserial
- Arduino IDE
- Install the required Python packages:
pip install opencv-python pyserial-
Upload the Arduino sketch (
facetrack.ino) to your Arduino board using the Arduino IDE. -
Connect the hardware according to the pin configuration.
-
Update the
ARDUINO_PORTinfacerec.pyto match your Arduino's port.
-
Connect the Arduino to your computer.
-
Run the Python script:
python facerec.py-
The system will:
- Initialize the camera and Arduino connection
- Display the camera feed
- Control the servos to track detected faces
- Turn on the water pump to spray water when a face is detected.
-
ctrl + c to quit
- Resolution: 640x480