Files
rover-pi/oled-display/README.md
T

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.

  1. Enable I2C in raspi-config
  2. Go to your home directory: cd ~
  3. Clone this repository to your raspberry pi git clone https://gitea.cs.ru.is/RU-V207/rover-pi
  4. Install pillow, numpy, and venv:

    sudo apt install python3-venv python3-pil python3-numpy

  5. Create a virtual environment, here called cpsy:

    python3 -m venv cpsy

  6. Edit the generated pyvenv.cfg to set include-system-site-packages = true
  7. Activate the environment source cpsy/bin/activate
  8. Install the display driver: pip install adafruit-circuitpython-ssd1306
  9. 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
  10. Copy the edited display-ip.service to /etc/systemd/system sudo cp display-ip.service /etc/systemd/system/.
  11. Enable the service sudo systemctl enable display-ip.service
  12. Test by starting the service sudo systemctl start display-ip.service which should turn on the screen.
  13. If nothing happens, check on the status with sudo systemctl status display-ip and look for error messages.
  14. If you make additional changes to the service file, you may have to reload the systemd: sudo systemctl daemon-reload