Winstar WEH001602 OLED connection to Pi

I bought this blue Winstar WEH001602OLED display, hoping to pimp my Keithley 2304APSU but since it happen to be not directly compatible, it went to use as Raspberry Pi display on next project.

Display can be bought from Adafruit directly as well. This model is using slightly modified Hitachi HD44780 compatible interface protocol, with parallel 8/4-bit bus and RS/RW/E control signals. OLED specified for operation voltage from 3.0V to 5.3V, so +3.3V available at Pi’s GPIOs will fit nice without any need of level conversion.

As usual, python will be used to talk with display. To make it more practical, let’s show some intro messages and then IP address of eth0 interface of Raspberry Pi. Since I’m using my Pi’s headless with SSH login over LAN, it’s often an issue to connect if networks/address change due to DHCP. Before I had to connect HDMI monitor and login locally to check what is new IP address. Now with OLED display this step can be avoided.

RPi.GPIO python binding will be used to talk with GPIO interface from python. time library used to take care of delays for signal generation. subprocess used to exec shell command to fetch IP address for our use.

This function take care of OLED initialization and sets everything up for us.

Low level lcd_byte() does actual GPIO pin toggling according to parallel 4-bit interfacing protocol, and higher level lcd_string() used to output strings to display. One can reference example output of strings in main() function.

IP address fetching in python and printing on OLED

Python app exec shell command to get IP address of eth0 network adapter. This is done by Popen method.

Now final touch, to have this little python application run every time Pi boots or restarts. To do so I configured system to wait for network connection at boot using raspi-config and added shell script to execute on boot using /etc/rc.local file:

This library and overall idea works very well with minor modify to other HD44780-compatible character displays. Other parallel I/O displays can be interfaced easily too, but may need writing proper low-level function.

Make sure display of the choice have +3.3V logic levels. Interfacing +5V directly at Raspberry Pi GPIO will cause damage, as there is no protection other than ESD-diodes in Broadcom SOC itself. If you need to interface 5V logic use level shift circuits or level buffers.

This negative graphic dot-matrix LCD is based on Sitronix ST7588T controller (Datasheet). Controller have 132 segment outputs / 81 common outputs and internal LCD bias and voltage boost converter. It’s COG type LCD, so use and interfacing is simple. Display rated to run at +3.3V power and have white LED backlight (4 LEDs, two per side). LCD resolution is 132×32 pixel, and datasheet is available

I’ll be using wiringPi library to talk with GPIO and SPI on Raspberry Pi.

LCD connection follows next table:

Raspberry Pi pin

Raspberry Pi function

LCD function

LCD pin

GPIO 4

Chip select

CS

GPIO 24

LCD reset

RESET

GPIO 25

data or command

A0/RS

GPIO 11

Clock input

SCL

GPIO 10

Data input

SDA

It’s possible to use different pinout if something already connected to pins mentioned in table, but make sure pins are configured properly. Some information about pin modes and use presented here on WiringPi page