Installing autopolls software

Installing autopolls software#

Installation notes#

Note

[ Github here ]

### Tested configuration (May 2026)

  • Raspberry Pi 4 Model B Rev 1.5 (2 GB)

  • Raspberry Pi OS 64-bit, released 2026-04-01 (Raspberry Pi Imager)

  • Raspbian GNU/Linux 12 (bookworm) / Debian 13.4

  • Kernel: Linux 6.12.75+rpt-rpi-v8 aarch64

Environment variables

Several environment variable are used for configuration/running. To accesss the AutoPollS UI, you will need to set up a custom user and password, which you will do in the bashrc script. Open Terminal on your pi and run the following command:

sudo nano ~/.bashrc

This will open the bashrc file in the nano text editor. Now add the lines to the bashrc script. NB: these must be at the TOP of your bashrc (before the ‘If not running interactively’… line).

export PCAM_USER="camera login user name"
export PCAM_PASSWORD="camera login password"

Save and exit with Ctrl+X, then Y.

Clone this repository

Prepare for and clone this repository

. ~/.bashrc
cd
git clone https://github.com/Crall-Lab/Autopolls.git -b test

Note: select `y` if prompted to continue.

Install pre-requisites

sudo apt update
sudo apt install python3-numpy python3-opencv python3-requests python3-flask python3-systemd nginx-full vsftpd virtualenvwrapper apache2-utils python3-gst-1.0 gstreamer1.0-tools nmap jq
echo "source /usr/share/virtualenvwrapper/virtualenvwrapper.sh" >> ~/.bashrc

Setup virtualenv

. ~/.bashrc
mkvirtualenv --system-site-packages autopolls -p `which python3`
workon autopolls
echo "source ~/.virtualenvs/autopolls/bin/activate" >> ~/.bashrc

Install pandas for CSV export support and libssystemd

pip install pandas
sudo apt install libsystemd-dev

Install tfliteserve

cd ~/Autopolls/tfliteserve

# Latest installs may require a pinned setuptools version
pip3 install setuptools

# Install Edge TPU support
echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | sudo tee /etc/apt/sources.list.d/coral-edgetpu.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get install libedgetpu1-std

# Install the tfliteserve package
pip3 install -e .

Install the AutoPollS pcam packages

cd ~/Autopolls/pcam
pip install -e .
pip install uwsgi

Move latest object detection model to tfliteserve folder

sudo cp ~/Autopolls/utils/configs ~/Desktop/configs
sudo chmod 777 ~/Desktop/configs

To edit config values, you can edit directly or use the included GUI editor:

Setup storage location You will need a properly formatted external hard drive. The instructions below format the drive directly on the Pi — this will erase all existing data on the drive. If your drive is already formatted, skip to the “Mount storage location” section. .. note:

**NB this will delete all existing data on your hard drive**
  1. Connect your external USB hard drive to the pi.

  2. The software assumes you’re using an external storage drive that is initally mounted at /dev/sda1. To confirm this, check the thumbdrive mounting location using - “sudo fdisk -l” in Terminal. You should see ‘/dev/sda1’ the ‘Device’ output.

  1. To format the drive as ntfs (the most tested format for AutoPollS, and which allows for >2TB volumes), first open ‘fdisk’ in Terminal using the following command:

sudo umount /dev/sda1
sudo fdisk /dev/sda
  1. Type ‘g’: this will switch to gpt

  2. Type ‘d’: this will delete existing partitions, if any

  3. Type ‘n’: this makes a new partion that takes up all disk space. NB use all defaults for partition number, first sector, and last sector (i.e., hit ‘enter’ three time)

  4. Type ‘t’ then ‘11’ when prompted for partition type: this will switch the partion type to microsoft basic data

  5. Type ‘w’: this writes the changes through fdisk

  6. Run the following command in Terminal to make the filesystem:

# make ntfs filesystem
sudo mkfs.ntfs -f /dev/sda1

Mount storage location

echo "/dev/sda1 /mnt/data auto defaults,nofail,user,uid=1000,gid=124,umask=002  0 0" | sudo tee -a /etc/fstab
sudo mkdir /mnt/data
sudo mount /mnt/data
sudo mkdir -p /mnt/data/logs
sudo chown $USER /mnt/data
sudo chgrp ftp /mnt/data
sudo chmod 775 /mnt/data

Change hostname file permissions .. code-block:: python

sudo chmod 777 /etc/hostname

# Setup web server (for UI)

sudo htpasswd -bc /etc/apache2/.htpasswd pcam $PCAM_PASSWORD
sudo rm /etc/nginx/sites-enabled/default
sudo ln -s /home/pi/AP/Autopolls/services/pcam-ui.nginx /etc/nginx/sites-enabled/

Setup systemd services This will set up the systemd services to run the AutoPollS software in the background. NB: the overview service and timer are not needed for usb cameras, and may be removed in a future update

Run the configuration script to set the correct username in all service files: .. code-block:: python

bash ~/Autopolls/pcam/services/configure_services.sh

cd ~/Autopolls/pcam/services
for S in \
    tfliteserve.service \
    pcam-discover.service \
    pcam-overview.service \
    pcam-overview.timer \
    pcam@.service \
    pcam-ui.service; do \
sudo ln -s ~/Autopolls/pcam/services/$S /etc/systemd/system/$S
done
# enable services to run on boot
for S in \
    tfliteserve.service \
    pcam-discover.service \
    pcam-overview.timer \
    pcam-ui.service; do \
sudo systemctl enable $S
done
# start services
for S in \
    tfliteserve.service \
    pcam-discover.service \
    pcam-ui.service; do \
sudo systemctl start $S
done
sudo systemctl restart nginx