How to use a Colored OLED Display SSD1331

Learn Robotics

How to use a Colored OLED Display SSD1331

How to drive the Arduino color OLED

The display is very small. It has almost the same size as the monochrome OLED display. But the resolution of it is not the same. It has a resolution of 96×64 pixels. So, it has a lower resolution at the same size. It can display 65 thousand colors! The display I bought, uses the SPI interface so we have to connect 7 pins in order to make it work. The monochrome ones that I have bought, use the I2C interface which requires only 4 pins. So, we need more wires in order to connect it with Arduino. Let’s how to achieve that.

I am going to connect the color OLED display to an Arduino Uno. GND pin goes to Arduino GND. Vcc pin goes to either 3.3V or 5V output of the Arduino Uno. I connect it to the 3.3V output of the Arduino Uno. The next pin of the display is named SCL which is a mistake. It is actually CLK pin of the SPI interface. So CLK pin goes to digital pin 13 on the Arduino Uno. The next pin is also labeled wrong. It is named SDA but it is actually MOSI pin of the SPI interface. So the 4th pin of the display goes to digital pin 11. The next pin is RES which goes to digital pin 9. The 6th pin is DC which goes to digital pin 8. The last pin is CS which goes to digital pin 10. That’s it, we have connected the display to the hardware SPI pins of the Arduino Uno board. This way we can achieve the best performance possible. Let’s now power up the board to see if everything works ok. As you can see the display works fine and the demo sketch is running.

Features:

  • Driver Chip: SSD1331
  • Interface: SPI
  • Resolution: 96×64
  • Display Size :0.95inch
  • Colors: 65K colorful
  • Visible Angle : >160°
  • Operating Temp. (℃): -20~70
  • Storage Temp. (℃): -30~80
  • Operating Voltage : 3.3V / 5V

Package List:

1 x 0.95-inch SPI Full Color OLED SSD1331

Documents:

SSD1331 Library: https://github.com/adafruit/Adafruit-SSD1331-OLED-Driver-Library-for-Arduino

Schematics with Arduino

Arduino Code

#define sclk 13
#define mosi 11
#define cs 10
#define rst 9
#define dc 8

// Color definitions
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF

#include <Adafruit_GFX.h>
#include <Adafruit_SSD1331.h>
#include <SPI.h>

Adafruit_SSD1331 display = Adafruit_SSD1331(cs, dc, rst);

void setup() {

display.begin();
display.fillScreen(RED);
delay(300);
display.fillScreen(GREEN);
delay(300);
display.fillScreen(BLUE);
delay(300);
display.fillScreen(BLACK);
delay(1000);
display.setCursor(20,5);
display.setTextColor(WHITE);
display.setTextSize(2);
display.print(“Hello”);

display.setCursor(8,25);
display.setTextColor(RED);
display.setTextSize(2);
display.print(“YouTUBE”);

display.fillRect(10,40, 75, 20, RED);

display.setCursor(20,47);
display.setTextColor(WHITE);
display.setTextSize(1);
display.print(“Subscribe”);

display.drawRect(0,0,96,64,WHITE);
delay(1000);
}

void loop()
{
display.fillRect(10,40, 75, 20, BLACK);
delay(1000);
display.fillRect(10,40, 75, 20, RED);
display.setCursor(20,47);
display.setTextColor(WHITE);
display.setTextSize(1);
display.print(“RoboCircuits”);
delay(1000);
}

Thank You

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Skip to toolbar