A beekeeping IOT project: A/V streaming and sensor monitoring of hive activity.
- Recommended for development: Raspberry Pi 4B
- Ethernet or WiFi connection to the Pi with >= 10 Mbps up / down
- 32 GB high performance microSD card
- Preferably a card optimised for dashcam storage, e.g. Sandisk High Endurance
- Microphone: I2S microphone
- Camera: Raspberry Pi Camera
- Environment sensing: BME680 / BME688
- Insert the microSD card into your computer
- Confirm that it's the right card, and you've backed up anything important on it!
- Download and run Raspberry Pi Imager
- Choose operating system
- Under Raspberry Pi OS (other), choose Raspberry Pi OS Lite (Legacy)
- The "Legacy" (Debian Buster-based) version must be used for camera A/V streaming support
- 64 bit versions may or may not work on Pi 3 / 4 / 400, but have not been tested
- Choose the correct microSD card
- Write
- Remove the microSD card
- Re-insert the microSD card
- Navigate to the microSD in a terminal window, e.g.
cd /Volumes/boot
- Run
touch ssh
to enable SSH access - If using WiFi:
- At the root of the microSD card (e.g.
/Volumes/boot
), create awpa_supplicant.conf
file, replacing the ssid and psk with the WiFi name, password, and security method as appropriate:
country=GB # Your 2-digit country code
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
ssid="YOUR_NETWORK_NAME"
psk="YOUR_PASSWORD"
key_mgmt=WPA-PSK
}
-
Unmount (software eject) the SD card
-
Remove the microSD card from your computer
-
Ensure all required hardware (Pi camera, microphone, environment sensors) are connected to the Pi
-
Insert the microSD card into the Raspberry Pi and power it on
-
SSH into the Raspberry Pi to confirm it is connected
- Use
arp -a
on your computer to help find the Pi on the network
- Use
Pi setup to run A/V streaming and environment sensing is automated using Ansible.
Ansible runs on your computer and connects to one or more Pis remotely, and ensures that the hive software is installed and running on each Pi.
- Python 3
sshpass
- Debian-like:
sudo apt-get install sshpass
- On OS X:
brew install hudochenkov/sshpass/sshpass
- Debian-like:
- From the root of the repository,
cd deployment/hives
- One time: create a Python virtual environment (virtualenv) to use Ansible with:
python3 -m venv ansible && source ansible/bin/activate && pip3 install -r requirements.txt
- Run
source ansible/bin/activate
to activate the virtualenv and make Ansible available - Run
deactivate
to deactivate the virtualenv when done
See the Python documentation for more information on creating virtual Python environments.
Configurations for hive Pis are kept in deployment/hives/inventory/static.yml
.
In the first instance, the static.yml
file will need to be created. Copy static.example.yml
in the inventory folder to static.yml
and edit accordingly: see the comments in the example file.
In a terminal on your computer:
# Activate the virtualenv if not done already
source ansible/bin/activate
# Run the playbook
# Assuming an inventory of Pis has been set up at inventory/static.yml
# see inventory/static.example.yml
ansible-playbook -i inventory/static.yml -v playbooks/hive.yml