ssd1306 and WaveShare OLED

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
Post Reply
elfnor
Posts: 3
Joined: Sat Jun 20, 2015 4:20 am

ssd1306 and WaveShare OLED

Post by elfnor » Sat Jun 20, 2015 4:38 am

I have a WaveShare OLED (http://www.wvshare.com/product/0.96inch-OLED-B.htm) and I'm trying to use it with the ssd1306.py library found here https://github.com/khenderick/micropython-drivers or the fork with text support found here https://github.com/nvbn/micropython-drivers.

I get odd results which look a bit like a line length syncing problem.

This code (with the nvbn fork of ssd1306.py)

Code: Select all

import pyb
from ssd1306 import SSD1306

display = SSD1306(pinout={'dc': 'Y3',
                          'res': 'Y4'},
                  height=64,
                  external_vcc=False)

led_red = pyb.LED(1)
led_red.off()

try:
    display.poweron()
    display.init_display()
    # Make sure the corners are active
    display.set_pixel(0,   0,  True)
    display.set_pixel(127, 0,  True)
    display.set_pixel(0,   63, True)
    display.set_pixel(127, 63, True)
    
    # Write display buffer
    display.draw_text(0, 0 , 'Hello World')    
    display.display()

except Exception as ex:
  led_red.on()
  print('Unexpected error: {0}'.format(ex))
  display.poweroff()
gives
oled_screen.jpg
oled_screen.jpg (27.51 KiB) Viewed 12297 times
The corner pixels are not in the corners and the text is scrambled. The position of the corner pixels varies each time the code is run. The lines demo is jumpy and also breaks up

I've tried the same OLED with an arduino nano and the demo adafruit code https://github.com/adafruit/Adafruit_SSD1306 and it works well with clear text and smooth fast screen updating.

Any clues? If not what brand of OLED works well with this library?

User avatar
kfricke
Posts: 342
Joined: Mon May 05, 2014 9:13 am
Location: Germany

Re: ssd1306 and WaveShare OLED

Post by kfricke » Sat Jun 20, 2015 8:52 am

I did play around with my OLED display as well and had the same issues. Give me a day to sort my code and publish my enhanced/patched version. Hope that will help.

User avatar
kfricke
Posts: 342
Joined: Mon May 05, 2014 9:13 am
Location: Germany

Re: ssd1306 and WaveShare OLED

Post by kfricke » Sat Jun 20, 2015 9:55 am

Oh, wait... You seem to use a color display!? The SSD1306 class you mentioned does only support monochrome displays. You should check a datasheet for your display and adapt the framebuffer and all drawing methods of your class accordingly.

Also my class has only been tested on my 128x32 monochrome pixel I2C display.

elfnor
Posts: 3
Joined: Sat Jun 20, 2015 4:20 am

Re: ssd1306 and WaveShare OLED

Post by elfnor » Sun Jun 21, 2015 4:00 am

It's a 128 by 64 bit display. Its really monochrome but with different fixed colors in different parts. Yellow on the top 1/4 and blue on the bottom.

elfnor
Posts: 3
Joined: Sat Jun 20, 2015 4:20 am

Re: ssd1306 and WaveShare OLED

Post by elfnor » Sun Jul 05, 2015 9:55 am

OK my fault (or the board's).

Swapped everything over to the other SPI port and it works beautifully. Time to get out the soldering iron...
I've now learnt more than I hope I ever need to know about SPI after fault finding everything but the pins.

elfnor

tim.churches
Posts: 2
Joined: Wed Nov 04, 2015 5:39 am

Re: ssd1306 and WaveShare OLED

Post by tim.churches » Wed Nov 04, 2015 7:08 am

Is anyone aware of any Micropython drivers for OLED displays which use an SH1106 chip via SPI? These are common on eBay, and work well - there are Arduino drivers for them, but they are sufficiently different to not quite work with the existing ssd1306 micro python driver(s). Using the ssd1306 driver, it is possible to write text to the display, but it is restricted to the first line of the display, and there are random bits showing elsewhere - thus the command set etc is close to the ssd1306 (or v-v), but definitely not the same. There is a Python driver for them, here: https://github.com/adamyoung600/WRX_HUD ... are/SH1106 but that looks like it might need a bit of slimming down (or maybe not) to work well under Micropython. I'm new to Micropython and the Pyboard, so advice on how to proceed is appreciated.

User avatar
JonHylands
Posts: 69
Joined: Sun Dec 29, 2013 1:33 am

Re: ssd1306 and WaveShare OLED

Post by JonHylands » Wed Dec 02, 2015 12:39 pm

I've got a simple MicroPython library that works with the I2C ssd1106:

https://github.com/JonHylands/ssd1106

Might be worthwhile trying the SPI on your LCD - it doesn't work on mine, but I have no idea if the SPI panel I have is good.

tim.churches
Posts: 2
Joined: Wed Nov 04, 2015 5:39 am

Re: ssd1306 and WaveShare OLED

Post by tim.churches » Mon Dec 21, 2015 12:30 am

JonHylands wrote:I've got a simple MicroPython library that works with the I2C ssd1106:

https://github.com/JonHylands/ssd1106

Might be worthwhile trying the SPI on your LCD - it doesn't work on mine, but I have no idea if the SPI panel I have is good.
OK, fab! I'll test with the SPI ssd1106 displays I have and report back here.

Post Reply