python code for automatic feeder and hive entrance cams. automatically detects bees and stores short videos to be decoded by bb_pipeline
Raspberry Pi install:
- Download and install Raspberry Pi Imager on your computer.
- Enable SSH and hostname identification in the install options. Note the hostname (e.g. 'exitcam0' - this can then be used to connect via ssh on the local network)
- Flash the OS with appropriate version to the SD card
git clone https://github.com/BioroboticsLab/bb_raspicam.git
cd bb_raspicam
sudo bash setup_raspicam.sh
Already configured by setup_raspicam.sh
:
# Verify it’s syncing
chronyc sources -v
chronyc tracking
See Time server sync setup for more information; shown here are the main steps
-
Setup a time server on a local computer (see Time server sync setup).
-
Ensure the server (here using the name 'roadking') is reachable by name (or use its IP):
sudo apt install -y avahi-utils libnss-mdns
getent ahosts roadking.local # should show an IP; otherwise use the IP directly
- Repoint Chrony to your local server and restart:
# Comment out any existing pool/server lines
sudo sed -i '/^[[:space:]]*\(pool\|server\|sourcedir\)[[:space:]]/s/^/#/' /etc/chrony/chrony.conf
# Add your local server (choose one)
echo "server roadking.local iburst minpoll 3 maxpoll 8" | sudo tee -a /etc/chrony/chrony.conf
sudo systemctl restart chrony
- Verify:
chronyc sources -v
chronyc tracking
You should see roadking.local
(or cirrus.local
) once synchronized.
date --iso-8601=ns
ssh-keygen -t rsa -b 2048
ssh-copy-id pi@SERVERNAME
cd bb_imgstorage_nfs
vim user_config.py
Fill in settings
Update local copies of exitcam.cfg or feedercam.cfg with appropriate device number and settings
sudo raspi-config
-- Go to ‘Advanced Options’ then select Wayland -- Select X11 -- reboot
- Connect to Rpi via SSH and verify the time is updated. Example if the RPi is named 'exitcam0'
ssh [email protected]
date --iso-8601=ns
- Start camera program on RPi. Use either exitcam.cfg or feedercam.cfg as input
tmux new -s cam
cd bb_raspicam
## Exitcam:
python3 raspicam.py exitcam.cfg
## Feedercam:
python3 raspicam.py feedercam.cfg
- Start file transfer on RPi
tmux new -s txfr
cd bb_imgstorage_nfs
python imgstorage.py
Use the included script to setup raspicam and imgstorage as system services that start automatically when the RPi is restarted:
# Usage: ./setup_autostart.sh /path/to/raspicam raspicam_cfg_filename /path/to/imgstorage txfr_cfg_filename
# Example:
bash setup_autostart.sh /home/pi/bb_raspicam exitcam.cfg /home/pi/bb_imgstorage_nfs txfr_exitcam.py
Reboot and then both will start automatically