This repository has been archived on 2024-05-23. You can view files and clone it. You cannot open issues or pull requests or push a commit.
2019-04-17 12:05:46 +08:00
2019-04-17 10:32:16 +08:00
2019-04-17 11:30:20 +08:00
2019-04-17 12:05:46 +08:00

PiDisplay

Setup and use the Pi OLED HAT by Waveshare

The 1.3" OLED Display HAT for Raspberry Pi is a display the same size of a Pi Zero. The information provided by the manufacturer Waveshare Electronics is somewhat awkward, so I decided to document my journey here, along with the Python script I adopted to control the display.

Hardware

The display attaches to a Pi via the GPIO. It is a 128x64 1.3" blue OLED display with a 5-way joystick on one side, and 3 buttons on the other:

  • Driver: SH1106
  • Interface: 4-wire SPI, 3-wire SPI, I2C
  • Display color: blue
  • Resolution: 128 x 64
  • Operating voltage: 3.3V

The display has some jumpers at the back to be soldered to enable/disable the interfaces it uses. I decided to use the default 4-wire SPI which require no soldering at all 😝

Setup

I decided to use Python to control my display. There are other options from the manufacturer but I didn't explore them.

Note: The following steps are deduced from the documents from the manufacturer. I performed them in the exact order listed below, but I'm not sure if is absolutely necessary

Prepare raspbian

  • sudo apt-get update
  • sudo apt-get install python-dev

Install RPi.GPIO

Install spidev

  • Download spidev from https://pypi.python.org/pypi/spidev to somewhere.
  • Extract the content (tar xvfz spidev-x.y.tar.gz)
  • sudo apt-get install python-smbus
  • sudo apt-get install python-serial
  • cd spidev-x.y
  • sudo python setup.py install

Install Python Imaging

  • sudo apt-get install python-imaging

Enable the SPI interface

  • sudo raspi-config
  • Go to '5 Interfacing Options'
  • Go to 'P4 SPI'
  • Choose 'Yes'

Enable the I2C interface

I'm not sure if this is necessary, but well what the hack...

  • sudo raspi-config
  • Go to '5 Interfacing Options'
  • Go to 'P5 I2C'
  • Choose 'Yes'

Install the luma.oled driver

Well I'm not too sure about what is the point to install python-pip then remove it......

  • sudo apt-get install python-pip libfreetype6-dev libjpeg-dev
  • sudo -H pip install --upgrade pip
  • sudo apt-get purge python-pip
  • sudo -H pip install --upgrade luma.oled

Test

That's it, the display is ready to use.

Sample python app

Next step

The Python code in this repo are adopted by me from demo.py provided by the manufacturer.

S
Description
No description provided
Readme
5.2 MiB
Languages
Python 98.8%
Shell 1.2%