Page 2 of 2

Re: SSD1306 I2C

Posted: Sat Dec 30, 2017 9:02 am
by philwilkinson40
sorry @pythoncoder, I forgot I wrote some notes at the top of the SSD1306.py module to remind me why I used an older version! So that is what threw the line numbering (poor coding mistake!) :oops:
I really don't know how you put up with such poor mistakes! Thanks.

Now with the OLED object correctly instantiated the OLED runs perfectly!
Image

Re: SSD1306 I2C

Posted: Tue Jan 02, 2018 11:31 am
by ajm
Using ssd1306.py (2017.12.13) I get the error

"AttributeError: type object 'super' has no attribute '__init__'
MicroPython v1.9.3-238-g42c4dd09 on 2017-12-31; ESP32 module with ESP32"

Using ssd1306.py (2017.10.06) works fine.

It's the same using SPI.

Re: SSD1306 I2C

Posted: Tue Jan 02, 2018 12:04 pm
by SpotlightKid
Yes, the current version of the SSD1306 driver in the micropython repo is broken.

Re: SSD1306 I2C

Posted: Tue Jan 02, 2018 12:05 pm
by pythoncoder
If you read my earlier messages in this thread you will find the reason and the workround.

Re: SSD1306 I2C

Posted: Tue Jan 02, 2018 7:49 pm
by Swessels
pythoncoder wrote:
Sun Dec 24, 2017 8:09 am
If that fails I'd suspect the hardware - you should have better luck with Adafruit's excellent products.
Sorry for my late reply, there was no time for the last couple of days.
It seems that my I2C display is damaged. A check using an Arduino Leonardo shows no reaction.

Using an adafruit 128x32 SPI display works fine:

Code: Select all

>>> from machine import Pin, SPI
>>> import ssd1306
>>> res =Pin(2)
>>> dc = pin(4)
>>> dc = Pin(4)
>>> ss =Pin(15)
>>> spi = SPI(2, baudrate=14500000, sck=Pin(18), mosi=Pin(23))
>>> oled = ssd1306.SSD1306_SPI(128,32,spi,dc,res,ss)
>>> oled.text("Hello",0,0)
>>> oled.text("You",48,10)
>>> oled.text("Guys!",72,20)
>>> oled.show()
I think i'll buy an adafruit I2C display....

Thanks again for your help!
Best regards,
Stefan

Re: SSD1306 I2C

Posted: Wed Jan 03, 2018 9:22 am
by deshipu
I think you forgot to connect the pullup resistors.

Re: SSD1306 I2C

Posted: Wed Jan 03, 2018 5:46 pm
by Swessels
deshipu wrote:
Wed Jan 03, 2018 9:22 am
I think you forgot to connect the pullup resistors.
That's correct. For the SPI display it works without them. I know that isn't correct.

Regarding to the I2C - display: as stated in my posts before, with or without pullups, no difference in the behaviour.

Best regards,
Stefan

Re: SSD1306 I2C

Posted: Wed Jan 03, 2018 7:22 pm
by deshipu
SPI doesn't require pullups.

Re: SSD1306 I2C

Posted: Tue Jun 04, 2019 2:34 am
by paolochiarlone
@pythoncoder Hello Peter, sorry to re-open this old thread...
I tried to download your modified version of the SSD1306 but the page doesn't exist in your repo.
Have you moved it somewhere else?
Could you please share it?
Thank you so much!
-Paolo

Re: SSD1306 I2C

Posted: Tue Jun 04, 2019 12:31 pm
by pythoncoder
If you're aiming to use the Writer module it now works with the official driver. See the Writer docs.

The MicroPython firmware was updated to allow the subclassing of the FrameBuffer class. This prompted a substantial revision of the Writer and CWriter classes to be compatible with any display driver which subclasses FrameBuffer. These also now support multiple displays, colour rendering, upside-down rendering, tab expansion etc.