Wipy + ssd1306 only noise

  • For my project I'v been trying to use the ssd13006 oled driver but am only getting noise

    I followed this guide:

    I changed the adress in the library to the correct i2c address. I'm running the following code in my main.py:

    i2c = machine.I2C(0, machine.I2C.MASTER, baudrate=400000, pins=('P9','P10'))
    oled = ssd1306.SSD1306_I2C(128, 64, i2c)

    print('first show')

    also I printed the buffer output written over the I2C bus: which is basically a filled x00 or xff which should be correct imo. can someone explain to me what I am doing wrong?
    Is it possible I got a busted OLED?

  • @robert-hh

    from what I found in the documents of the ssd1306 the following commands are also required (or are at least different from default)

        for cmd in (
            MEMORY_ADDR, 0x00,
            DISP_START_LINE | 0x00,
            SEGMENT_MAP, 0X00,
            MULTIPLEX_RATIO, 63,
            Vcom_DESELECT, 0x30,
            CONTRAST, 0xFF,

    anywho in the end it is a syntax problem with the I2C bus. I don't know if the correct syntax for sending long byte-array operations can be included here If it were it would have been crazy helpful for me.

  • oke it appears to be fixed now. After all it was quite a stupid thing that had to be done and I got the idea from here:

    change the syntax from

        self.i2c.writeto(self.addr, self.buffer)

    (on github)


    (on the micropython master)

    to this syntax

        self.i2c.writeto(self.addr, bytearray([0x40]) + buf)  #buf = self.buffer

    For me this did the trick. Be sure to indeed use the reset pin! and also check if the buffer is correctly passed on to the write_data() function! if not pass it with the function call.

  • @BitNide AFAIK, if you do a hard reset before the init, you can skip most commands in init, besides:

            for cmd in (
                SET_CONTRAST, 0xff, # maximum
                SET_DISP | 0x01): # on

  • @robert-hh

    Bit late with the reply but was out for the weekend :)
    I can't seem to get it to work and I don't understand why :/
    I connected the reset pin to P8, however running the reset command gives me a black screen and writing data also doesn't make a difference.
    Nor does running it before or after the initialization sequence.... I also tried to first reset within the initialization sequence and remove all the unecessary commands in it, due to default values, however this also gave no result.
    A buffer written with full (xff) bytes still does nothing :/

    The initialization sequence does now however give me a half white half black screen instead of noise......

    here the links to my files which might have a little more insight:
    (they expire july 5)

  • @BitNide if scan return a value, then CS does not have to be connected. I confirmed that with the data sheet. Connect Res with any free GPIO pin, like P8, and run before executing the fill() (or before the oled = ...) command:

    from machine import Pin
    from utime import sleep_ms
    res = Pin("P8", Pin.OUT, value=1)
    res(0) # pull low for 10 ms
    res(1) # release reset 

    Since reset initializes the display the same way the INIT sequence in the driver does, the result should be the same. But in fact, it was not in my tests.

  • @robert-hh the i2c scan returns number 61 aka 0x3d
    from the toturial it only mentioned connecting Sclk Sdata, Vin and Gnd
    could you please draw a quick schematic or further explain your pin connections and reset pulse?

    By the way, on the back I had to connect two jumpers to enable I2C.

  • @BitNide From my work with OLED, I'm missing the reset. The one I had required a reset pulse. And normally CS must be tied to GND.What is the response form the i2c.scan() call?

Log in to reply

Pycom on Twitter