The Raspberry Pi Zero is wonderful to use outside (it consumes little power, is cheap, ...). But the development of OTCamera is more fun on a big Pi. Everything is much faster.
You will need a Raspberry Pi 2B/3B(+)/4 (the 2 GB works well), and a camera module (no USB webcam).
Download and install latest Raspberry Pi OS Lite (32-bit) on a micro SD card using the Raspberry Pi Imager.
Add a empty file named
ssh to the boot partition to enable ssh on first boot.
Boot the Pi on LAN or wifi (add your wifi first).
Generate SSH-Keys for password-less connection. On your desktop computer run
to generate a public private key combination. Add the private key to your ssh-agent (you may need to update OpenSSH on Windows).
Connect to the pi using ssh (
ssh pi@raspberry)to the Pi using password authentication.
Create and edit the needed
mkdir -p ~/.ssh nano ~/.ssh/authorized_keys
Copy your public key on the host and paste it on the pi, save&close using Ctrl+X - Enter - Y. You should now be able to connect to the Pi without password.
Setup the Raspberry¶
Update the pi by running apt and reboot.
sudo apt update && sudo apt upgrade -y sudo reboot
Reconnect to your pi and run the raspberry configuration tool.
Change the following settings to appropriate values:
- System Options
- Interface Options
- Camera (enable)
- Localization Options
- Locale (for example de_DE.UTF-8 UTF-8 as default)
- Timezone (Europe/Berlin)
- WLAN Country (DE)
Reboot the Pi afterwards.
Setup VS Code Remote Development Extension¶
Install the Remote-SSH extension on your desktop using the marketplace.
Add the Pi as remote host. Connect to the Pi using the Remote-SSH extension (rightclick on the ne host - "Connect to Host in New Window"). When asked for the operating system of the host, choose "Linux". VS code will download and install the necessary dependencies on the Pi.
Open the extension manager in the new windows an install all nessacery extensions.
Setup Git and GitHub¶
Install git using apt.
sudo apt install git
To setup your git commit name and email, login to your github account and copy your private commit email.
On the pi run
git config --global user.name "Your Name" git config --global user.email "firstname.lastname@example.org"
The easiest way to setup your GitHub credentials is to use vs code. In the file explorer panel click "Clone Repository" and choose "Clone from GitHub". Depending on your desktop computer settings, a browser tab will open to login into your GitHub account. Afterwards, you can search for "OpenTrafficCam/OTCamera" inside the vs code command prompt and select a folder to pull (choose /home/pi by default).
Setup Python and Dependencies¶
By default, Raspberry OS light doesn't come with PIP installed. We will need it, to install required packages.
sudo apt-get install python3-pip
Raspberry OS ships with python 2 and python 3. By default python 2 is used. You may want to change that to python 3 by adding two single lines to
nano ~/.bashrc # add the following two lines at the end of the file (without #) # alias python='/usr/bin/python3' # alias pip=pip3 # save & exit (Ctrl+X - Y) source ~/.bashrc python --version pip --version
Both commands should state, that they are (using) python 3.(x).
Install Screen to Run OTCamera in Background¶
Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells.
To install screen on the developer pi just run
sudo apt-get install screen
You can now start
screen and use it as an usual terminal. You can run the
python OTCamera to start the camera in an active screen session. Hit Ctrl+A and then D to detach the current session. Screen will still run in background including the OTCamera. If you start screen including the
-r option you can reconnect to this terminal session:
You can safely disconnect you ssh connection to the pi, while the screen session is still running.
Ready to Develop¶
You should now be ready to pull the OTCamera repository and start developing.