App for taking pictures via Raspberry Pi camera and overlaying grow system/sensor details
Set up the Raspberry Pi as normal and make sure networking, SSH etc is all functional
You will need to install the following components via git:
- git
- python3-pip
- python3-venv
- libopenjp2-7
Use the following commands
sudo apt update
sudo apt upgrade
sudo apt install git python3-pip python3-venv libopenjp2-7
git clone [email protected]:plb500/AutoBloomer-Snapper.git
cd AutoBloomer-Snapper
git submodule update --init --recursive
cd AutoBloomer-Snapper
python3 -m venv snapper-env
source snapper-env/bin/activate
pip3 install -r requirements.txt
cd AutoBloomer-Snapper
source snapper-env/bin/activate
cd AutoBloomer-Protobuf/python/pyproto
./protobuf_build_python.sh
App is configured via the file autobloomer_snapper_cfg.json
, found in the repo root. The JSON file has the following options, split into two sections:
server_options
: First section, contains details about the host grow controllerhost_name
: Address of the host controller, used to obtain current sensor data and upload grow system image snapshotport_number
: Port number the host is listening onserver_passphrase
: Host controller security key (optional)
data_options
: Second section, contains details about the images we are storingimage_destination
: Location to store image snapshots on this Pi (MUST exist)grow_system_id
: ID of the grow system we are querying/uploading image data tosensor_details
: Block containing the sensor details we want to annotate on the images. Contains one or more entries, each containing the following options:sensor_id
: ID of the sensor we want to queryreading_id
: Reading we want to display
Inside the repo root is a file called run_snapper.sh
. This will take a single image from the camera, read the sensor data, annotate the image with grow system details and store the image in the directory specified by the config file
To get the program to generate images on a schedule (i.e. take a picture every 5 minutes), the easiest way is to call the above script via crontab. You can edit the crontab file by using
crontab -e
You can generate a crontab entry easily here.
SSH into the Raspberry Pi and run the following command:
libcamera-vid -t0 --width 1920 --height 1080 --framerate 10 --nopreview --codec h264 --profile high --intra 5 --listen -o tcp://0.0.0.0:8888
From a remote computer, open VLC, then select "Open Network" and use the following URL (replace XXX.XXX.XXX.XXX with the address of the Raspberry Pi):
tcp/h264://XXX.XXX.XXX.XXX:8888