Automated Setup Guide
Automated installation for pyCRUMBS on Raspberry Pi using the included setup script.
Prerequisites
- Raspberry Pi 4B+ with Raspberry Pi OS Lite 64-bit
- SSH access and internet connection
- Arduino with level shifter for I2C (optional for testing)
Quick Setup
1. Download and Run Setup
ssh username@raspberry_pi_address
sudo apt update && sudo apt install -y git
git clone https://github.com/FEASTorg/pyCRUMBS.git
cd pyCRUMBS
chmod +x setup_pycrumbs.sh
./setup_pycrumbs.sh
2. Verify Installation
./verify_setup.sh
~/test_pycrumbs.sh
What the Script Does
The setup script automatically handles:
- System packages: Installs
i2c-tools,python3-venv, etc. - I2C configuration: Enables I2C using
raspi-configor direct config file modification - User permissions: Adds user to
i2cgroup - Python environment: Creates virtual environment in
./pycrumbs_env - Dependencies: Installs
smbus2package - Helper scripts: Creates convenience scripts in home directory
I2C Auto-Configuration
The script automatically detects and enables I2C:
- Uses
raspi-config nonint do_i2c 0for automatic enabling - Falls back to direct
/boot/firmware/config.txtmodification - Handles both new and legacy config file locations
- Prompts for reboot if needed
Helper Scripts Created
~/activate_pycrumbs.sh - Activates environment:
~/activate_pycrumbs.sh
~/test_pycrumbs.sh - Runs complete test:
~/test_pycrumbs.sh
Testing Communication
After setup, test I2C devices:
i2cdetect -y 1
Run the leader example:
~/activate_pycrumbs.sh
cd ..
python -m pyCRUMBS.examples.leader_example
Example Commands
- Request message:
request,0x08 - Send message:
0x08,1,1,75.0,1.0,0.0,65.0,2.0,7.0,0 - Exit:
exitor Ctrl+C
Troubleshooting
Permission Issues
If I2C permission errors occur:
groups $USER # Check if i2c group is present
sudo reboot # Reboot if group was just added
I2C Configuration Issues
If automatic I2C setup fails:
# Manual enable
sudo raspi-config nonint do_i2c 0
# Verify config
grep "dtparam=i2c_arm=on" /boot/firmware/config.txt
# Check for old location
grep "dtparam=i2c_arm=on" /boot/config.txt
sudo reboot
Module Import Errors
If getting ModuleNotFoundError:
# Ensure running from parent directory
python -m pyCRUMBS.examples.leader_example
# Verify environment activation
~/activate_pycrumbs.sh
Environment Issues
If virtual environment problems occur:
# Delete and recreate
rm -rf ./pycrumbs_env
./setup_pycrumbs.sh
Manual Cleanup
To remove automated setup:
# Remove virtual environment
rm -rf ./pycrumbs_env
# Remove helper scripts
rm ~/activate_pycrumbs.sh ~/test_pycrumbs.sh
# Remove user from i2c group (optional)
sudo deluser $USER i2c
# Remove repository (if desired)
cd .. && rm -rf pyCRUMBS
Setup vs Manual Comparison
| Task | Manual | Automated |
|---|---|---|
| Time | 15-20 min | 3-5 min |
| I2C setup | Manual navigation | Fully automated |
| Error handling | User responsibility | Built-in fallbacks |
| Environment | Manual creation | Automatic with validation |
For manual setup details, see Manual Setup Guide.
Next Steps
After successful setup:
- Connect I2C devices and test communication
- Develop custom applications using the library
- Explore advanced examples in Examples
- Review API Reference for detailed documentation