Menu

Driver for SSD131x i2c OLED display

Help
Piotr
2013-09-21
2018-12-15
  • Markus Dolze

    Markus Dolze - 2013-09-24

    is it shipped with some more detailed datasheet? From their web page it seems that you do not have to deal with the details of the OLED controller.

    But even if you do not need to take care of the OLED controller, there is currently no driver that just writes text to I2C like their example does.

     
  • Nicko

    Nicko - 2013-10-08

    Hello, We also buy some here, and would use it with LCDProc

    We would use it in a commercial project.
    Is there someone that could make a driver for this screen ?

    Technical infos here :
    http://www.wide.hk/download/I2C1602OLED.rar

    Thanks !

     
  • Piotr

    Piotr - 2013-10-12

    OLED controller need a specific initialization code.
    After initialization we just need to write text to i2c.

    Here, my small example in Python: https://github.com/0xFACE/RPi-OLED-Display-SSD1311

    Which one of existing drivers will be the best start point for hacking new driver?

    Best regards.

     
  • Markus Dolze

    Markus Dolze - 2013-10-14

    As the controller supports the HD44780 command set, it makes sense to create just a connection type for the hd44780 driver.

    Although this will result in some code duplication, I suggest to start with a copy of the hd44780-i2c.c file and hack in the protocol to senddata() and initialization code to init().

    It seems the controller also supports sending consecutive data bytes. In that case you may opt for some optimization cache. Hd44780-lcd2usb uses this for example.

     
  • Piotr

    Piotr - 2013-10-15

    Thanks for the tip.
    I removed HD44780's specific code from hd44780-i2c.c file. Sending a ascii stream to i2c bus almost did the trick. Display shows some readable messages mixed with a garbage.
    It seems to be problem with the controller command set.
    I can start to capture incoming codes and translate from hd44780 command set to SSD131x command set. But I think there must be smarter way.
    Where can I find information how LCDd "talks" to the displays ? What control codes it uses (home, cls, gotoXY, etc...)?

     
  • Markus Dolze

    Markus Dolze - 2013-10-15

    When working in hd44780-i2c you will see hd44780 control codes. There should not really be a need to translate those, as the SSD131x command set is compatible. The only thing you need to ensure is that RE and IS modes are not accidentally switched on (Function Set Command).

    At first you may try to:
    - Turn off the heartbeat in LCDd.conf. This also makes debugging a lot easier.
    - Do no call common_init, but initialize the display properly on your own.

    The only control codes used other than during initialization are 'Set DDRAM Address' and 'Set CGRAM Address'.

     

    Last edit: Markus Dolze 2013-10-15
  • Piotr

    Piotr - 2013-10-20

    Finally got it working.
    My own init code works, SetDDRAM address and other commands seems to works too.
    Even a big clock screen looks ok - I think characters ROM is similar to HD44780.
    I didn't implement back-light functions as there is no back-light. I think it should be mapped to brightness command (this OLED display has 256 brightness level).
    I didn't check writing to CGRAM functions (for custom fonts).

     
  • Fux

    Fux - 2014-10-05

    @Piotr
    I am also interested in using this OLED display, is your code already in the LCDproc GIT merged or could you please share it.
    Many Thanks.

     
    • Piotr

      Piotr - 2014-10-15

      No, is not included in the LCDproc.
      I wrote "working hack" for hd44780-i2c driver.

      Here is my code:
      https://github.com/0xFACE/RPi-OLED-Display-SSD1311

       
  • ktran

    ktran - 2015-02-06

    Perfect timing. I'm looking at using the same display for my pfSense firewall.

    The only thing I'm not quite sure about is what I would need to hook it up. Would a straight USB to I2C adapter work (is there even such a thing)?

     
  • Chris Hogevonder

    I've just received a similar display, but in the size 20x4. With the driver from Piotr it works half... Online the top 2 lines show tekst, the bottom 2 stay blank.

    Since I have 0 experience with programming, some help is very, very welcome...

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.