# 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. 1. Enable I2C in `raspi-config` 1. Go to your home directory: `cd ~` 1. Clone this repository to your raspberry pi `git clone https://gitea.cs.ru.is/RU-V207/rover-pi` 1. Install [pillow](https://python-pillow.org/), numpy, and venv: > sudo apt install python3-venv python3-pil python3-numpy 1. Create a virtual environment, here called cpsy: > python3 -m venv cpsy 1. Edit the generated `pyvenv.cfg` to set `include-system-site-packages = true` 1. Activate the environment `source cpsy/bin/activate` 1. Install the display driver: `pip install adafruit-circuitpython-ssd1306` 1. Edit `display-ip.service`: - Replace `foley` with your user name on the Pi. - the `WorkingDirectory` points to the directory containing `display-ip.py` - the path to python points to your virtual environment 1. Copy the edited `display-ip.service` to `/etc/systemd/system` ```sudo cp display-ip.service /etc/systemd/system/.``` 1. Enable the service `sudo systemctl enable display-ip.service` 1. Test by starting the service `sudo systemctl start display-ip.service` which should turn on the screen. 1. If nothing happens, check on the status with `sudo systemctl status display-ip` and look for error messages. 1. If you make additional changes to the service file, you may have to reload the `systemd`: ```sudo systemctl daemon-reload ```