This guide demonstrates the following: creating a virtual environment, cloning a repository, installing its dependencies, and debugging hardware on the RPI 5.
- Main Landing Page ❤️✨: Readme.md
- RPI Board ⚡: RPI Documentation
- OS Choice 🌟: os.md
Ensure your OS is up to date. Many fixes came in January 2024:
sudo apt-get update
sudo apt-get upgrade
Now, install Git and Python3, along with the venv
module to manage virtual environments.
sudo apt-get install -y git python3 python3-venv
Create a directory for your project and navigate into it:
mkdir my_project
cd my_project
Create a virtual environment named my_env_name
:
python3 -m venv my_env_name
Activate the virtual environment:
source my_env_name/bin/activate
This step will ensure compatibility and preserve your devices Python env.
git clone https://github.com/LilaShiba/flask_server_ubi.git
Navigate into the cloned repository:
cd flask_server_ubi
Located in requirements.txt
:
pip install -r requirements.txt
Open the pi terminal and run
sudo raspi-config
This will open the option menu. You will want to select Interface Options, and then enable I2C.
To run the Hardware:
python app/utils/main.py
The I2C pins can be a bit tricky. First, we will install some tools to help peak inside the RPI. Then we will look at the states of the GPIO. Lastly, we will scan the I2C bus for any devices on said port.
Update i2c-tools
sudo apt update
sudo apt install -y i2c-tools
Check the GPIO pins If the sda and scl pins are reading high, your sensors are not detected and may be damaged.
gpio readall
Find devices on I2C bus. This command will give you the address for all I2C devices
i2cdetect -y 1