Driving Cheap EBay OLED Displays With Arduino

Kozig OLED DisplayOver the last couple of years I’ve picked up a few little 128×64 OLED displays, mostly through EBay auction sniping.  These displays are similar to those offered by Adafruit, likely using the same chip-on-glass (COG) OLED display with a SSD1306 controller.  The Adafruit version gives you direct access to the controller, so the SSD1306 datasheet is all you need to write a driver.  In fact, Adafruit has released a perfectly adequate driver for their offering; it’s available from the link shown above.  For some reason, however, the designer of the displays that I purchased decided to put their own microcontroller between the exposed I2C bus and the SSD1306.  The only feature that I’m aware of which utilizes this intermediate microcontroller is an 8×16 font; devices using these displays would require a bit less memory, as the font is stored on the display itself.  Other than this rather dubious advantage, the controller is more hindrance than help.  Adding insult to injury, the command set for the display is completely undocumented; the only information I was able to find was a rather spartan Arduino sample application.  Contacting the EBay sellers failed to bear fruit.  They are completely clueless regarding how to drive the display.

I’ve got three different variants of this display, all labeled as “Kozig”; a couple of them refer to kozig.com, a site which resolves to a single login page. Not much help there. The three variants of this display that I have on hand are:

Kozig 128×64 I2C OLED Displays (EBay Special) 
Model I2C Pins Status
ZT.SCOI2CM2 (monochrome, white) 0x51 2×4 Working
ZT.SCOI2CM1 (bi-color: yellow, blue) 0x51 1×10 Working
ZT.SC-I2CMx (monochrome, white) 0x27 2×4 Pending

The displays with part numbers ZT.SCOI2CM2 and ZT.SCOI2CMx are mounted on a PCB with black solder mask and have a nice metal frame surrounding the display; this is what attracted my attention in the first place, as they should be slightly more rugged than the exposed glass displays (at least in theory.)  I’ve contacted several EBay sellers about their offerings, and they seem to all be selling the Kozig ZT.SC-I2CMx displays now; I was unable to find anyone offering the ZT.SCOI2CM1.  Note that the sample code that I was able to track down DOES NOT WORK with this newer display; in fact, as of today I’ve been unable to find a working block of code for this device. Edit: 03/26/2013: Received an email message from Alexander Steingass, who was kind enough to send along technical details for the ZT.SC-I2CMx displays along with a driver from Kozig.  Here’s the driver file for the sake of posterity:  ZT.SC-I2CMx

If you’re in the market for a nice, bright little 128×64 OLED display, I’d recommend purchasing directly from Adafruit; they actually support what they sell, and the price is only a couple of dollars more than the EBay offerings.  If, however, you’ve purchased one of these displays and are looking to use it with an Arduino project, read on.

I’ve written a little Arduino driver for these displays which should ease the pain of incorporating them into your designs.  This driver utilizes my AnyDisplay core and provides some nice features – optimized buffered drawing, different pen and fill modes (none, normal, clear, XOR), filled shapes, user-defined fonts and bitmaps as well as polar lines and points which don’t require floating point support.  Since the driver uses an in-memory buffer it does require a chunk of your Arduino’s precious RAM (128×64 bits, or 1024 bytes).  Optimized drawing requires another 128 bytes if you choose to enable it; it’s a case of display speed vs memory, and you’ll need to make that determination yourself.  The ATMega328 only has 2K of RAM, so display buffering takes about half of it.  I’m also working on a version which uses an external SRAM or FRAM as the display buffer that I can make available if there’s any interest.

The driver will be available on my GitHub page soon.  Comments are encouraged!  Do you have one of these displays?  Let me know by posting a comment!

4 thoughts on “Driving Cheap EBay OLED Displays With Arduino”

  1. Ohh finally, i have looking around for a driver for hours, only thing i managed to get running is the damn builtin animation. will try your code out.

    1. I’ve been neglecting my poor blog as of late, too much going on to keep up! My driver is in a bit of a rough state at present, but I’d be happy to send you my code if you’re interested.

  2. Steve, it’s cool idea!
    For now i know only one solution – it’s MultyLCD library (https://github.com/stanleyhuangyc/MultiLCD) by great man Stanley Huang) but it’s not good for ZT displays (you can’t draw pictures and clearline works in strange way… or may be my hands grow up from strange place:)… anyway , it’ great to have specialized library for ZTs ) and if you need testers) i’ll do my best

  3. There are a number of libraries available that try to make graphical displays behave like character displays. From my perspective, if I wanted a character display I would have purchased one; I want a graphical display to support graphical operations. u8glib is one option, as is the old standby GLCD. I started my anyDisplay library to provide support for my projects which target multiple microcontrollers – MSP430, Cypress PSOC, ARM as well as AVR. I want to be able to swap out displays with a minimum of code changes, and I want the same API to be available regardless of platform. I’m using my library on all of these platforms for personal projects today, but I’m not prepared to release the whole thing to the public quite yet as it does not yet meet my personal standards for publication.

    I do have a subset of this driver available for the ZT displays that I will release soon (as time permits).

Leave a Reply

Your email address will not be published. Required fields are marked *