SSD1306 - I2C usage and fonts

Great to hear the SSD1306 now support I2C!!

but how do you specify the SSD1306I2C option and disable the SSD1306SPI option when compiling?

Also I need a bigger font to display some text. How can I convert/scale the fonts?

Thanks in advance
Alex

1 Like

Hi @Alex1
The SSD1306 drivers are getting a new update this week to fix some issues with it.
But if you are must work with it before the update, You can edit the ssd1306.yml file in .zerynth2/dist/r2.4.1/libs/official/solomon/ssd1306/ switching I2c, SPI on and off.

Hi @karimhamdy1,
any update on the release date of the drivers update?

UPDATE: I actually managed to get it to work temporarily. But my question above still stands! :smile:

When trying to use the ssd1306 module I get the following compilation error (I have modified the .yml configuration file, leaving only the SSD1306I2C enabled.

[info] Compiling module: solomon.ssd1306.ssd1306 @ c:\zerynth2\dist\r2.5.0\libs\official\solomon\ssd1306\ssd1306.py
[info] PREP: SSD1306SPI = None ( False ) [ if 1 ] @ 13
[info] PREP: SSD1306I2C = None ( False ) [ if 2 ] @ 14
[info] PREP: SSD1306SPI = None ( False ) [ if 1 ] @ 20
[info] PREP: ( True ) [ else 1 ] @ 22
[info] PREP: SSD1306I2C = None ( False ) [ if 2 ] @ 23
[info] PREP: SSD1306SPI = None ( False ) [ if 1 ] @ 88
[info] PREP: ( True ) [ else 1 ] @ 152
[info] PREP: SSD1306I2C = None ( False ) [ if 2 ] @ 153
[error] Syntax error [unexpected indent (, line 74)] in [[c:\zerynth2\dist\r2.5.0\libs\official\solomon\ssd1306\ssd1306.py] at line 73](javascript:app.open_marker(‘c:\iot_projects\zerynth_projects\test_ssd1306_oled_display’,‘c:\zerynth2\dist\r2.5.0\libs\official\solomon\ssd1306\ssd1306.py’,73))

Hi @nickagian
The ssd1306 drivers got an update on the r2.4.2 update, fixing some bugs, added I2C support and supported two additional boards.
are you still having these compilation errors?

Hi @karimhamdy1,

Well I’m using r2.5.0 so I guess I shouldn’t have problems :blush:.

Perhaps my mistake is how to select between SPI and I2C. How’s that achieved? What I tried is to comment out the SPI related entry from the drivers yml file, but I now realize that is perhaps wrong. Shall I define somewhere SSD1306I2C = True? Where should that be?

What I ended up doing is to completely remove everything related to the SPI from the module!

In the example tab, search for ssd1306, clone the fading image example, Then in the project.yml define

config:
    SSD1306SPI: null
    SSD1306I2C: true


image

EDIT:
make sure to add the reset pin in the I2C initialization according to the board used/your connections:
ssd = ssd1306.SSD1306(I2C0,rst=D16)
Let me know the updates :slight_smile:

Bingo! That works… So the problem was that I hadn’t selected one of the two interfaces.
Thank you for your time and your help on this. It is now very clear how to use this library. :slight_smile: