This software allows management of multiple Raspberry Pi camera traps. Requires python3 to be installed.
The camera trap hardware is based on PICT (plant–insect interactions camera trap).
The hardware we are currently using
Each Raspberry Pi needs an SD card with the Raspberry Pi OS installed. This is done by using Raspberry Pi Imager. To avoid entering a password many times you should have a SSH key setup. See GitHub's documentation on Checking for an existing SSH key and Creating a SSH key. You will need to enter the contents of your public key (~/.ssh/*.pub) into the Raspberry Pi Imager.
Steps:
RASPBERRY PI OS LITE (32BIT)
for Operating System
Storage
Set hostname
and enter a unique name for the camera trap (eg ct1-1
)Enable SSH
and choose Allow public-key authentication
and set authorized_keys
to your public keypi
To customize the recording proceedure you can edit:
ct1-1.local
)Example cameratraps.txt
content for two camera traps with names ct1-1 and ct1-2:
ct1-1.local
ct1-2.local
The capture.ini
file contains settings for when to run alarms and video/image config.
The default settings for capture.ini
are as follows:
[settings]
RECORD_TIME_SECONDS = 30
CAPTURE_HOURS = 7,8,11,12,13,16,17,18
UTC_OFFSET_HR = 4
SET_ALARM_AFTER_MINUTE = 55
ALARM_MINUTE_PERIOD = 5
CAPTURE_SCRIPT=./scripts/capture-video.sh
This causes the camera traps to
TODO: Remove need for UTC_OFFSET_HR
To manage your camera traps there is a single ./run.py
script that has multiple commands.
To view help for this command run the following:
./run.py --help
Before you can perform the one-time init step the camera traps they must be turned on and accessible via WiFi.
Run the setup script to copy scripts and install software.
./run.py init
The first time you run this command on a Raspberry Pi you will be prompted to accept the key fingerprint. Something like the following:
The authenticity of host 'ct1-1.local (...)' can't be established.
ED25519 key fingerprint is ....
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
As shown above enter yes. The raspberry pi will likely be rebooted to handle a configuration change for the RTC.
Before you can run this script the camera traps they must be turned on and accessible via WiFi. This script will copy scripts and update the job scheduler (crontab).
./run.py setup
./run.py status
This step requires that you have installed VLC and uses two terminals. You need pass the hostname of the camera trap to stream from.
So to start streaming video from trap ct1-1.local
run the following:
./run.py stream ct1-1.local
Then in another terminal run the command printed bin a new termial to open VLC. When through press Ctrl-C in the first terminal and close VLC.
The RTC must be set initially and if the battery is depleted or disconnected from the PiJuice. To sync the RTC clock from the system clock on the raspberry pi run:
./run.py sync-rtc
./run.py fetch
./run.py convert
./run.py purge
./run.py set-wifi
This is necessary so the next alarm will fire and capturing will begin
./run.py shutdown
See if we can use the present of WiFi to know when to keep the Raspberry Pi active. Otherwise we will not have long enough to download images from the camera traps when they are active. This command might help
iwgetid --raw
Allow setting battery profile so PiJuice can correctly and efficiently charge the battery, correctly monitor the charge percentages and more