SSD1306 I2C

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
User avatar
philwilkinson40
Posts: 63
Joined: Tue Nov 14, 2017 3:11 am
Location: Perth, Australia

Re: SSD1306 I2C

Post by philwilkinson40 » Sat Dec 30, 2017 9:02 am

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
Attachments
IMG_20171230_20246.jpg
IMG_20171230_20246.jpg (49.31 KiB) Viewed 7426 times

ajm
Posts: 1
Joined: Mon Jan 01, 2018 8:36 pm

Re: SSD1306 I2C

Post by ajm » Tue Jan 02, 2018 11:31 am

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.

SpotlightKid
Posts: 463
Joined: Wed Apr 08, 2015 5:19 am

Re: SSD1306 I2C

Post by SpotlightKid » Tue Jan 02, 2018 12:04 pm

Yes, the current version of the SSD1306 driver in the micropython repo is broken.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: SSD1306 I2C

Post by pythoncoder » Tue Jan 02, 2018 12:05 pm

If you read my earlier messages in this thread you will find the reason and the workround.
Peter Hinch
Index to my micropython libraries.

Swessels
Posts: 6
Joined: Fri Dec 22, 2017 4:20 pm
Location: Germany

Re: SSD1306 I2C

Post by Swessels » Tue Jan 02, 2018 7:49 pm

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
Attachments
20180102_203208[2].jpg
20180102_203208[2].jpg (66.78 KiB) Viewed 7396 times

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: SSD1306 I2C

Post by deshipu » Wed Jan 03, 2018 9:22 am

I think you forgot to connect the pullup resistors.

Swessels
Posts: 6
Joined: Fri Dec 22, 2017 4:20 pm
Location: Germany

Re: SSD1306 I2C

Post by Swessels » Wed Jan 03, 2018 5:46 pm

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

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: SSD1306 I2C

Post by deshipu » Wed Jan 03, 2018 7:22 pm

SPI doesn't require pullups.

paolochiarlone
Posts: 1
Joined: Tue Jun 04, 2019 2:12 am

Re: SSD1306 I2C

Post by paolochiarlone » Tue Jun 04, 2019 2:34 am

@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

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: SSD1306 I2C

Post by pythoncoder » Tue Jun 04, 2019 12:31 pm

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.
Peter Hinch
Index to my micropython libraries.

Post Reply