SSD1327 4-bit greyscale OLED displays

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
User avatar
mcauser
Posts: 507
Joined: Mon Jun 15, 2015 8:03 am

SSD1327 4-bit greyscale OLED displays

Post by mcauser » Fri Jun 09, 2017 5:53 pm

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

alexchu
Posts: 4
Joined: Tue Apr 21, 2020 8:52 am

Re: SSD1327 4-bit greyscale OLED displays

Post by alexchu » Tue Apr 21, 2020 9:18 am

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!

User avatar
mcauser
Posts: 507
Joined: Mon Jun 15, 2015 8:03 am

Re: SSD1327 4-bit greyscale OLED displays

Post by mcauser » Tue Apr 21, 2020 10:41 am

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

User avatar
mcauser
Posts: 507
Joined: Mon Jun 15, 2015 8:03 am

Re: SSD1327 4-bit greyscale OLED displays

Post by mcauser » Tue Apr 21, 2020 11:38 am

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.

alexchu
Posts: 4
Joined: Tue Apr 21, 2020 8:52 am

Re: SSD1327 4-bit greyscale OLED displays

Post by alexchu » Wed Apr 22, 2020 4:30 am

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

User avatar
mcauser
Posts: 507
Joined: Mon Jun 15, 2015 8:03 am

Re: SSD1327 4-bit greyscale OLED displays

Post by mcauser » Wed Apr 22, 2020 5:36 am

Nice! I'll update the driver with support for this display.

alexchu
Posts: 4
Joined: Tue Apr 21, 2020 8:52 am

Re: SSD1327 4-bit greyscale OLED displays

Post by alexchu » Thu Apr 23, 2020 4:15 am

That would be great! Cheers!

Longui
Posts: 1
Joined: Fri Jul 30, 2021 3:26 pm

Re: SSD1327 4-bit greyscale OLED displays

Post by Longui » Fri Jul 30, 2021 3:28 pm

Any chance know how to change the font size? Thanks

User avatar
mcauser
Posts: 507
Joined: Mon Jun 15, 2015 8:03 am

Re: SSD1327 4-bit greyscale OLED displays

Post by mcauser » Sat Jul 31, 2021 2:34 am

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.

cavalrydrone
Posts: 1
Joined: Sun Nov 14, 2021 6:23 am

Re: SSD1327 4-bit greyscale OLED displays

Post by cavalrydrone » Sun Nov 14, 2021 6:26 am

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

Post Reply