Deployment scripts for setting up the HamBot robotics environment and the optional OLED network display on a Raspberry Pi 4 running 64-bit Raspberry Pi OS (Bookworm).
These scripts automate:
- Cloning the relevant repositories
- Creating Python virtual environments with system packages enabled
- Installing required Python dependencies (
pip install .) - Configuring global venv auto-activation (HamBot)
- Installing/removing systemd + NetworkManager hooks (OLED)
This project assumes you are running a Raspberry Pi 4 with 64-bit Bookworm OS.
The following packages are already included in the default image and do not need to be installed separately:
gitpython3-venvpython3-pippython3-picamera2python3-numpy
You only need to install:
sudo apt update
sudo apt install -y \
python3-opencv \
network-manager \
wireless-toolsAll scripts live in the scripts/ folder.
bash scripts/setup_hambot.sh- Clones
https://github.com/biorobaw/HamBotinto~/HamBot - Creates
hambot_venvinside that repo - Installs the
robot_systemspackage - Modifies
~/.bashrcso all new terminals auto-activate the venv
Notes:
pythonandpipuse the venv by defaultpython3andpip3remain the system defaults
bash scripts/setup_oled.sh- Clones
https://github.com/biorobaw/HamBot_OLEDinto thehambotuser’s home directory - Creates a
.venvin that repo and installs the OLED package - Installs a NetworkManager dispatcher hook (
/etc/NetworkManager/dispatcher.d/99-hambot-oled) - Installs and enables a systemd oneshot service (
hambot_oled.service) that runs at boot
Use the dispatcher script to install both components at once:
bash scripts/install.sh bothOptions:
bash scripts/install.sh hambotbash scripts/install.sh oledbash scripts/install.sh both(default)
To remove installed components and undo the setup:
bash scripts/uninstall.sh hambot # removes HamBot repo, venv, and .bashrc snippet
bash scripts/uninstall.sh oled # removes OLED repo, venv, service + dispatcher hook
bash scripts/uninstall.sh both # removes everythingNotes:
uninstall.shis idempotent (safe to run multiple times).- After uninstalling HamBot, open a new terminal to reload your
.bashrcwithout the venv auto-activation snippet. - After uninstalling OLED, the
hambot_oled.serviceand dispatcher hook are gone, and NetworkManager is restarted.
setup_hambot.shuses--system-site-packagesfor the venv so it can see system-wide libraries.- It is critical that
picamera2,numpy, andopencvare installed via apt (system packages) and not via pip.- Installing these with pip will cause the HamBot environment to fail because they depend on Raspberry Pi–specific builds and drivers provided only by the system packages.
- Correct install:
sudo apt install -y python3-picamera2 python3-numpy python3-opencv
- Both setup scripts explicitly
cdinto the cloned repo before runningpip install .so the correctpyproject.tomlis picked up. - The installer is safe to re-run: existing repos will
git pull, and existing venvs will be reused.
After installing HamBot:
# Open a new terminal
echo $VIRTUAL_ENV # should show ~/HamBot/hambot_venv
which python # should be ~/HamBot/hambot_venv/bin/python
which python3 # remains /usr/bin/python3
python -c "import robot_systems; print('HamBot OK')"After installing OLED:
systemctl status hambot_oled.service --no-pager
ls /etc/NetworkManager/dispatcher.d/99-hambot-oledMIT