With a raspberry pi zero 2 w, camera module, 2x SG90 servo's, custom 3D printed case and this software you can create an AI powered webcam that follows a person and can autofocus and pan/tilt.
- Raspberry Pi Zero 2 W
- Raspberry Pi 5 8MP IMX219 Camera Module
- 2x SG90 Servo Motors
- Custom 3D Printed Case (available on Thingiverse)
- Micro USB to USB-A male OTG Cable
To set up the AI powered webcam on your Raspberry Pi (zero 2w), follow these steps:
-
Clone the repository:
git clone https://github.com/AlbertovanEckeveld/ai-webcam.git
-
Install the required packages:
sudo apt install python3-pip python3-dev libatlas-base-dev libopenjp2-7 libtiff5 v4l2-ctlq
-
Install the required Python packages:
pip3 install -r requirements.txt
-
Add to config.txt on the boot partition:
dtoverlay=dwc2
-
Add to cmdline.txt after rootwait:
modules-load=dwc2,g_ether rootwait
-
Place usb-webcam.sh script in /usr/bin/ and make it executable
sudo cp usb-webcam.sh /usr/bin/usb-webcam.sh sudo chmod +x /usr/bin/usb-webcam.sh
-
Add the script to crontab to start automatically on boot:
sudo crontab -e
Add the following line:
@reboot /usr/bin/usb-webcam.sh @reboot python3 main.py
-
Reboot the Raspberry Pi:
sudo reboot now
