Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Wipy + ssd1306 only noise

    Scheduled Pinned Locked Moved WiPy 2&3
    wipy 2.0i2s
    8 Posts 2 Posters 2.8k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B Offline
      BitNide
      last edited by

      For my project I'v been trying to use the ssd13006 oled driver but am only getting noise
      https://www.adafruit.com/product/938

      I followed this guide:
      https://learn.adafruit.com/micropython-hardware-ssd1306-oled-display/overview

      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'))
      print(i2c.scan())
      oled = ssd1306.SSD1306_I2C(128, 64, i2c)

      oled.fill(1)
      print('first show')
      oled.show()
      time.sleep(1)
      oled.fill(0)
      oled.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-hhR 1 Reply Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @BitNide
        last edited by

        @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?

        1 Reply Last reply Reply Quote 0
        • B Offline
          BitNide
          last edited by BitNide

          @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.

          robert-hhR 1 Reply Last reply Reply Quote 0
          • robert-hhR Offline
            robert-hh @BitNide
            last edited by

            @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)
            sleep_ms(1)
            res(0) # pull low for 10 ms
            sleep_ms(1)
            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.

            B 1 Reply Last reply Reply Quote 0
            • B Offline
              BitNide @robert-hh
              last edited by BitNide

              @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:
              https://fvandepoel.nl/pydio/public/runscript
              https://fvandepoel.nl/pydio/public/ssd1306
              (they expire july 5)

              robert-hhR 1 Reply Last reply Reply Quote 0
              • robert-hhR Offline
                robert-hh @BitNide
                last edited by

                @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
                            self.write_cmd(cmd)
                
                B 1 Reply Last reply Reply Quote 0
                • B Offline
                  BitNide
                  last edited by

                  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)

                      self.i2c.start()
                      self.i2c.write(self.temp)
                      self.i2c.write(buf)
                      self.i2c.stop() 
                  

                  (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.

                  1 Reply Last reply Reply Quote 0
                  • B Offline
                    BitNide @robert-hh
                    last edited by

                    @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,
                            ENTIRE_ON,
                            NORM_INV,
                        ):
                    

                    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.

                    1 Reply Last reply Reply Quote 0

                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                    With your input, this post could be even better 💗

                    Register Login
                    • 1 / 1
                    • First post
                      Last post

                    Pycom on Twitter

                    Pycom