1.8 KiB
1.8 KiB
cpsy-display-ip
Demonstrates the SSD1306 OLED by showing the IP address on the system boot. Originally at https://github.com/mkyas/cpsy-display-ip and customized for Mechatronics 1 students.
This project contains the file display-ip.py that displays an IP
address on the SSD1306 OLED screen and the file display-ip.service
that executes the script on boot after the Raspberry Pi is connected
to a network.
To use the script, you first must connect the screen to the Pi's I2C bus.
Setup
Do the following steps on your Raspberry Pi.
- Enable I2C in
raspi-config - Go to your home directory:
cd ~ - Clone this repository to your raspberry pi
git clone https://gitea.cs.ru.is/RU-V207/rover-pi - Install pillow, numpy, and venv:
sudo apt install python3-venv python3-pil python3-numpy
- Create a virtual environment, here called cpsy:
python3 -m venv cpsy
- Edit the generated
pyvenv.cfgto setinclude-system-site-packages = true - Activate the environment
source cpsy/bin/activate - Install the display driver:
pip install adafruit-circuitpython-ssd1306 - Edit
display-ip.service:- Replace
foleywith your user name on the Pi. - the
WorkingDirectorypoints to the directory containingdisplay-ip.py - the path to python points to your virtual environment
- Replace
- Copy the edited
display-ip.serviceto/etc/systemd/systemsudo cp display-ip.service /etc/systemd/system/. - Enable the service
sudo systemctl enable display-ip.service - Test by starting the service
sudo systemctl start display-ip.servicewhich should turn on the screen. - If nothing happens, check on the status with
sudo systemctl status display-ipand look for error messages. - If you make additional changes to the service file, you may have to reload the
systemd:sudo systemctl daemon-reload