Page 1 of 2

SSD1327 4-bit greyscale OLED displays

Posted: Fri Jun 09, 2017 5:53 pm
by mcauser
I've created a driver for working with SSD1327 OLED displays, such as my Grove OLED 96x96.
https://github.com/mcauser/micropython-ssd1327

It's 4-bit greyscale and uses framebuf's GS4_HMSB.

Code: Select all

import ssd1327
from machine import I2C, Pin

i2c = I2C(sda=Pin(4), scl=Pin(5))
display = ssd1327.SEEED_OLED_96X96(i2c)

for y in range(0,12):
    display.text('Hello World', 0, y * 8, 15 - y)
display.show()
Image

Re: SSD1327 4-bit greyscale OLED displays

Posted: Tue Apr 21, 2020 9:18 am
by alexchu
Hello mcauser,
Thanks for the ssd1327 library. I'm trying this library on my 1.5inch display which has 128x128 pixel resolution, it appears that the display format is not 100% right if I set the display resolution to 128x128.

Code: Select all

from machine import Pin,I2C
import ssd1327

i2c = I2C(sda=Pin("Y8"), scl=Pin("Y6"))
oled = ssd1327.SSD1327_I2C(128, 128, i2c, addr=0x3c)

while True:

    oled.fill(0)
    oled.text("hello world 0", 0, 0)
    oled.text("hello world 30", 0, 16)
    oled.text("hello world 50", 0, 50)
    oled.text("hello world 80", 0, 80)
    oled.show()
    pyb.delay(2000)

it looks like this:
Image
the product is from: https://www.smart-prototyping.com/Zio/Z ... ch-128x128
from the picture you can see the display format is not right, the first line text "hello world 0" displays from (0, 96), not from (0, 0)
I searched on google, it seems like no one has made a SSD1327 128x128 pixels display work, the one you used is a 96x96 pixel version.
If I set the display resolution to 128x96, the format looks right. But I can't use the full size of display.
Image

It would be much appreciated if you could help. I'd like to send you the display to you if you need it for testing.
Thanks for your time again!

Re: SSD1327 4-bit greyscale OLED displays

Posted: Tue Apr 21, 2020 10:41 am
by mcauser
Should be an easy fix with some init registers. I’ll take a look at some of the Arduino drivers and let you know what needs to change

Re: SSD1327 4-bit greyscale OLED displays

Posted: Tue Apr 21, 2020 11:38 am
by mcauser
Give this a try:

Code: Select all

i2c = I2C(sda=Pin("Y8"), scl=Pin("Y6"))
display = ssd1327.SSD1327_I2C(128, 128, i2c)

# Unlock
display.write_cmd(0xFD)
display.write_cmd(0x12)

# Display off
display.write_cmd(0xAE)

# Set column address 0-127
display.write_cmd(0x15)
display.write_cmd(0x00) # was 0x08 on 96x96 ((128-width)/depth)=8
display.write_cmd(0x7F) # was 0x37 on 96x96 (63-((128-width)/depth))=55

# Set row address 0-127
display.write_cmd(0x75)
display.write_cmd(0x00)
display.write_cmd(0x7F) # was 0x5F on 96x96 (height-1=95)

# Set start line = 0
display.write_cmd(0xA1)
display.write_cmd(0x00)

# Display offset = 0
display.write_cmd(0xA2)
display.write_cmd(0x00) # was 0x20 on 96x96 (128-height=32)

# Display normal
display.write_cmd(0xA4)

# Set multiplex ratio
display.write_cmd(0xA8)
display.write_cmd(0x7F) # was 0x5F on 96x96 (height-1=95)

# Test
display.fill(0)
display.text('ABCDEFGHIJKLMNOP',0,0*8,15)
display.text('b Line 2',0,1*8,15)
display.text('c Line 3',0,2*8,15)
display.text('d Line 4',0,3*8,15)
display.text('e Line 5',0,4*8,15)
display.text('f Line 6',0,5*8,15)
display.text('g Line 7',0,5*8,15)
display.text('h Line 8',0,7*8,15)
display.text('i Line 9',0,8*8,15)
display.text('j Line 10',0,9*8,15)
display.text('k Line 11',0,10*8,15)
display.text('l Line 12',0,11*8,15)
display.text('m Line 13',0,12*8,15)
display.text('n Line 14',0,13*8,15)
display.text('o Line 15',0,14*8,15)
display.text('p Line 16',0,15*8,15)
display.show()
Let me know if that works and I'll update the driver with a ZIO_QWIIC_OLED_128X128 class with the correct init registers.

Re: SSD1327 4-bit greyscale OLED displays

Posted: Wed Apr 22, 2020 4:30 am
by alexchu
It works perfectly!
I only got a little trouble because of the "display off" code in the testing code, :) after I comment it, it works as expected. :lol:
In the testing code

Code: Select all

display.text('f Line 6',0,5*8,15)
display.text('g Line 7',0,5*8,15) //should be 6*8
display.text('h Line 8',0,7*8,15)
Thanks a lot for the help!
Image

Re: SSD1327 4-bit greyscale OLED displays

Posted: Wed Apr 22, 2020 5:36 am
by mcauser
Nice! I'll update the driver with support for this display.

Re: SSD1327 4-bit greyscale OLED displays

Posted: Thu Apr 23, 2020 4:15 am
by alexchu
That would be great! Cheers!

Re: SSD1327 4-bit greyscale OLED displays

Posted: Fri Jul 30, 2021 3:28 pm
by Longui
Any chance know how to change the font size? Thanks

Re: SSD1327 4-bit greyscale OLED displays

Posted: Sat Jul 31, 2021 2:34 am
by mcauser
The current implementation uses the framebuf built in petme monospace font, which is has fixed 8x8 characters.
https://github.com/micropython/micropyt ... ebuf.c#L34

There were a few font scaling PRs open on Github for multiplying the font size, but with scaling up, they will show as blocky.

Re: SSD1327 4-bit greyscale OLED displays

Posted: Sun Nov 14, 2021 6:26 am
by cavalrydrone
Is there any way to update the library to include Adafruits SSD1327 module? I'm trying it but it keeps erroring out, not a pro yet at MicroPython.

Any assistance you can provide would be very helpful, this is the screen I have.

Thanks,

CDS