Manual Setup Guide
Step-by-step manual setup for pyCRUMBS on Raspberry Pi. For faster setup, see Automated Setup.
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)
Manual Setup Steps
1. System Update and Packages
ssh username@raspberry_pi_address
sudo apt update && sudo apt upgrade -y
sudo apt install -y i2c-tools git python3 python3-venv python3-pip
2. Enable I2C
sudo raspi-config
Navigate: Interface Options → I2C → Enable → Reboot
3. Python Virtual Environment
python3 -m venv pycrumbs_env
source pycrumbs_env/bin/activate
pip install smbus2
4. User Permissions
sudo adduser $USER i2c
Log out and back in for changes to take effect.
5. Clone Repository
git clone https://github.com/FEASTorg/pyCRUMBS.git
cd pyCRUMBS
6. Test Installation
# From parent directory
cd ..
python -m pyCRUMBS.examples.leader_example
7. Verify I2C Devices
i2cdetect -y 1
Testing Commands
In the leader example:
- 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
Common Issues
Externally-Managed Environment Error
Problem: Pip shows “externally-managed-environment” error.
Solution: Use virtual environment:
python3 -m venv pycrumbs_env
source pycrumbs_env/bin/activate
pip install smbus2
ModuleNotFoundError
Problem: Cannot import pyCRUMBS module.
Solutions:
- Run from parent directory:
python -m pyCRUMBS.examples.leader_example - Ensure virtual environment is activated
- Install in editable mode:
pip install -e .
I2C Communication Errors
Problem: Input/output errors when accessing I2C devices.
Solutions:
- Check device connections and wiring
- Verify I2C is enabled:
lsmod | grep i2c - Scan for devices:
i2cdetect -y 1 - Check address is correct (0x08-0x77 range)
- Ensure level shifters for 5V devices
Permission Denied
Problem: Access denied to I2C bus.
Solutions:
- Add user to i2c group:
sudo adduser $USER i2c - Log out and back in
- Check group membership:
groups $USER - Run with sudo as temporary workaround
Wiring Issues
Problem: Devices not detected or unreliable communication.
Solutions:
- Verify SDA/SCL connections through level shifter
- Check power connections (3.3V/5V and GND)
- Add pull-up resistors if not present (4.7kΩ recommended)
- Test with shorter wires
- Check for loose connections
Hardware Requirements
- Raspberry Pi: 4B+ or compatible with Raspberry Pi OS
- Level Shifter: Bi-directional for 5V devices
- Wiring: SDA/SCL with proper voltage levels
- Pull-ups: 4.7kΩ resistors (if not built-in)
Comparison with Automated Setup
| Aspect | Manual | Automated |
|---|---|---|
| Time | 15-20 minutes | 3-5 minutes |
| I2C Setup | Manual raspi-config | Automatic detection |
| Error Handling | Manual troubleshooting | Built-in error recovery |
| Environment | Manual creation | Automatic with validation |
| Dependencies | Manual installation | Automatic with error checking |
Next Steps
- Test Communication: Use leader example with actual hardware
- Develop Applications: Create custom scripts using pyCRUMBS
- Advanced Usage: Review Examples for patterns
- API Reference: See API Reference for details
For automated setup that handles these steps automatically, see Automated Setup Guide.