by sumotoy

sumotoy / SSD_13XX

A very fast and full featured driver for SSD1331/22/32/51 Oled's compatible with Teensy's and many o...

127 Stars 27 Forks Last release: about 4 years ago (1.0) GNU General Public License v3.0 100 Commits 1 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


A very fast and full featured driver for Solomon Systech SSD1331, SSD1332, SSD1322 and SSD1351 drivers designed mainly for Oled's compatible with Teensy's and many other MCU's. I have other 2 libraries here in github but have some issues and are quite old, this will replace both.

Current Version:
- 1.0r2: SSD1331/SSD1332/SSD1351 tested only with various Teensy's and ESP8266 (Have to set SPI at 79.999.999!). If not work with other CPU please report only, I NEVER tested the code with other CPU's so I expect this, but remember that is a preview and things gonna change soon.

Driver description (what I should choose?):
* SSD1331 is a full featured driver for 96x64 oled with a lot of useful registers and an hardware accellerated standalone scroll that I never seen in other drivers. This controller is currently supported.
* SSD1332 is the 'low cost' version of SSD1331, much less features, less fast (but use some Hardware Accellerated primitives), no scrolling. This controller is currently supported.
* SSD1322 used in some wide oled's.(in development)
* SSD1351 Can drive 128x128 Oled's, doesn't have any Hardware Accellerated primitive (apart scrolling as SD1331), pretty featured. This controller is currently supported.

SSD1331 Currently my preferred one...

Uncomment in settings file: #include "../display/SSD1331_96x64.h" SSD1331
NOTE:works out of the box, no hardware configurations, very bright

SSD1331 RED PCB 0.96" Color Oled

Uncomment in settings file: #include "../display/SSD1331_REDPCB.h" SSD1331b
NOTE:This Oled needs to be configured for SPI (jumpers on the back) and you should connect D2,D3,D4,D5,D6,D7 to GND!


Uncomment in settings file: #include "../display/SSD1332_96x64.h" SSD1332
NOTE:This Oled needs to be configured for SPI (jumpers on the back) and you should connect D2,D3,D4,D5,D6,D7 to GND! I will not raccomand this, red color is still orange to me.

SSD1351 128x128

Uncomment in settings file: #include "../display/SSD1351_128x128.h" SSD1332

How to set driver:

You need to open settings/SSD13XXsettings.h with a text editor and uncomment the driver you want to use:
Es. #include "../

Driver that will never supported:
- SSD_1306: This device need a completely different library since it have no internal framebuffer.

CPU Supported:
- Teensy 3.0, 3.1, 3.2, 3.4, 3.5, LC - Teensy 2.0 and variant - Any AVR 8 bit (UNO, etc.) - Arduino DUE - ESP8266 - SPARK (next versions) - Several ST (next versions)

Note: I currently will not support Arduino Zero, it's currently poor documented and it cost a fortune, I suggest a Teensy that is much cheaper, more featured and smaller!
However, this is open source an released with GNU V3 so you can fork library and add Zero support yourself as you respect the GNU licence and leave intact any comment.

I got my first SSD1331 on Ebay, find a library compatible at Adafruit but I was extremely disappointed about performances/features and bugs, so I decided to write a new one from scratch based on my popular TFTILI9163C. Since this devices are very similar I have decided to build up an unique library.
I have 2 old libraries here on github, but digging inside datasheet I discover that I can get much more by rewrote almost everithing. As result I got all chip features enabled and it's probably the faster driver around, much more than adafruit and works with all features at any screen rotation by using all the time his hardware accellerated primitives
Commands and features are pretty similar to TFT9163C,TFT7735,TFT_ILI93XX last libraries here on github, of course there's differences related to hardware (OLED don't have backlight pin, etc.)

- A display file for each oled, easy to customize. - Blazing fast, near chip hardware limits, expecially with Teensy's. - Any feature enabled for any rotation, using native hardware accellerated primitives. - Standard SPI & SPI transaction compatible, play nice with other SPI devices. - Many CPU supported. - Ultrafast Teensy's 3.0,3.1,3.2,3.4,3.5 SPI FIFO. - Fully SPI Transaction (where applicable), play nice with other SPI devices. - Almost all chip features supported. - LGPO Font accellerated rendering. - Icon support. - Image support. - Gradients. - Icon support (as seen in my last other libraries, use same icon file format). - Image support (as seen in my last other libraries, use same image file format). - User Font support (as seen in my last other libraries, use same font file format). - Uses TFT_ILI9163C command format that have many features and covers commands used in many libraries so it will be easy convert code to work with this one.

SSD1331/32 Unique commands: (differs from other libraries due different chip features)
- copyArea: copy a portion of screen into another location (hardware acc.) - dimArea: dim a selected area (only SSD1331) - scroll: this chip has an standalone hardware scroll (only SSD1331 and SSD1351) - defineScrollArea: since scroll is hardware, all is defined inside this function) - moveArea: It move a defined area into another place (hardware acc.) - setColorDepth:8 or 16bit - setColorOrder:RGB or BGR (only SSD1331) - drawRect: the standard drawRect is provided, but this advanced version have borders. (hardware acc.) (only SSD1331/32) - mode:PWRSAVE It's almost equal to sleep, display goes off - mode:DISP_DIM The display goes in Dim mode (only SSD1331) - mode:PROTECT The chip logic don't accept any commands, just mode:NORMAL to goes off of protect mode.(only SSD1331)

Of course some oled has just SPI exposed but some can be configured for parallel, I2C and so on. I'm using ONLY SPI here (so don't ask for any other protocol please).
- RST Connect to +3v3 using a 4k7->10k resistor. - scl, sclk -> SCLK - sda, sdin -> MOSI - DC,RS ->DC pin on MCU - some oled has WR, RD. Leave floating... - some oled has D0...D7. Most of the times D0 and D1 are used for SPI, connect D2...D7 to GND or will be unstable! - VIN. Most oled support 5v, internally they have regulators, but follow specifications of your particular oled! - 3v3. This is 99% of the times an OUT! So do not use it.

Some notes, please read this, will save your time:
- Even if your OLED can work at 5V, it cannot accept logic levels at 5V!!! All OLED accept logic levels at 3v3 so if you plan to use an AVR (like UNO) you need a level converted (like CD4050 or HCF4050 powered at 3v3, very cheap). - Do not use logic converters based on mosfet or similar or bidirectional ones (Adafruit and Sparkfun sell a lot of these), they are crap, waveforms are distorted and DO NOT USE PARTITION RESISTOR's for that, it's a bad idea, you can damage oled and cpu in the same time. - Most of you know already this but remember that Arduino UNO or similar can provide 3v3 but the logic levels are always at 5V!!! - The RST pin is not strictly necessary but if not used must pullup to 3v3, never leave float! When is necessary? When you develop a library for example but if you change libraries you may need a complete power cycle if you are not using this pin. - ESP8266 has very weak SPI, should be 3v3 but most of the times is much less so better avoid use any logic chip between it and oled, I spend days around a circuit before discovering this. - On ESP8266, from April 2016 the pin GPIO16 misteriously doesn't works as CS, don't ask me why. I'm currently using GPIO2 or GPIO4. - Since I'm using the fast SPI possible, keep wires short and remember to provide a decoupling capacitor for your oled.
- If you plan to use SPI for other devices as well it's a good idea pullup the CS with a 10K resistor to +3v3, this will keep oled disabled until your CPU access it for initialization and avoid interferences. - It's always a good idea provide a pullup for each CS if multiple SPI devices are used, when CPU start all devices are forced disabled and CPU is able to access one by one and initialize all of them correctly, keep in mind and you will happy in the future!

Performances (SSD1331):
Early alpha was not working, only garbage on screen, it's here for just for reference
Alpha 1..2 was using absolute screen addressing (now abandoned)
Alpha 3..4 and beta's use hardware rotation addressing. (In Alpha 4 triangles rendering failed)
Beta 1..2 works and are usable, all function tested at any rotation.
CPU used for benchmarks: SSD1331, Teensy 3.2 at 96Mhz. Sketch:benchmarks_official.ino
Times are in Microseconds!

|test |Early|alpha 1|alpha 2|alpha 3|alpha 4|beta 1|beta 2| |-------------------|------|------|------|------|------|------|------| |Screen fill |409|809|807|809|808|507|406| |Text |3983|3907|3963|3891|2357|2378|2270| |Text2 |9564|9368|9517|9332|5047|5057|4910| |Lines |5576|10976|10978|10974|5561|299|277| |Horiz/Vert Lines|6827|1800|1978|1964|1956|1954|1956| |Rectangles (outline)|4508|8916|8919|8915|1126|1376|1123| |Rectangles (filled)|4509|8924|8922|8920|1223|1499|1214| |Circles (filled)|3635|18787|4488|4482|4481|4479|4481| |Circles (outline)|4697|2851|2852|2849|2848|2847|2847| |Triangles (outline)|517|505|508|504|503|204|183| |Triangles (filled)|1916|11087|4284|4274|276|4274|4275| |Rounded rects (outline)|1206|2942|1619|1586|1585|1587|1588| |Rounded rects (filled) |10271|8184|5814|5807|5036|5241|5032| |Icon Render| | | | ||1404|1312|

More or less, Beta 2 it's the release candidate, you can note how amazing fast in some operation, for example 406 microsec for a complete screen erase, 277 microsecs for the complete line test or the 183 microsec for the triangle test (remember that triangulation is used for 3d rendering as well, it should be fast), even text it's really fast. In comparison, for the Adafruit one I have to use milliseconds, it's amazing slow (even using the fast SPI mode). I will up a table comparison (for fun) whe I release out this one.

Licensed under GNU V3.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.