View and control a Raspberry Pi Camera mounted on a Waveshare pan/tilt HAT!
- Set up a Raspberry Pi. The GUI is not needed on the Pi, so you can use SSH.
- Obtain and connect a Raspberry Pi Camera.
- Optional: Obtain, assemble, and connect a Waveshare Pan-Tilt HAT.
git clone
this repo andcd
into it.- Optional: Create a virtual environment with
python3 -m venv .venv
and then activate the virtual environment withsource .venv/bin/activate
. - Install dependencies with
pip3 install -r requirements.txt
. (You can find the list of dependencies in therequirements.txt
file. )
To run, first start trying to connect using the
Remote PiCam Viewer.
Then, run
main.py
.
When you disconnect from the PiCam, the script will stop, so you will have to
re-run the script if you want to reconnect.
When you first run the script, a settings.json
file should generate:
{
"camera": {
"name": "picam",
"port": 7896
},
"pan_tilt": {
"enable": true
}
}
camera.name
and camera.port
should match in the PiCam Viewer settings,
otherwise the software won't discover it (name
is not correct) or it will
stay connecting forever and get stuck. (port
is not correct)
pan_tilt.enable
should be true
if you have a Waveshare Pan/Tilt HAT
connected, otherwise false
.