element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Digilent, a National Instruments Company
  • Products
  • Manufacturers
  • Digilent, a National Instruments Company
  • More
  • Cancel
Digilent, a National Instruments Company
Blog Display text in different sizes and colors using ArduinoUno & Pmod OLEDrgb
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Digilent, a National Instruments Company to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: alexwonglik1
  • Date Created: 30 Oct 2020 6:53 AM Date Created
  • Views 9115 views
  • Likes 5 likes
  • Comments 1 comment
  • oled
  • arduinouno
  • arduino uno
  • arduino project
  • project
  • solomon goldentek display
  • oled display
  • spi
  • digilent
  • rgb
  • screen
  • arduino
  • pmod
Related
Recommended

Display text in different sizes and colors using ArduinoUno & Pmod OLEDrgb

alexwonglik1
alexwonglik1
30 Oct 2020

In this project, users will see how to set up the Pmod OLEDrgbPmod OLEDrgb 96 x 64 RGB OLED Display with 16-bit color resolution with the Arduino Uno in order to display different sizes and color messages.

 

image

The Pmod OLEDrgbPmod OLEDrgb features a 96x64-pixel RGB OLED display that is capable of 16-bit color resolution. As a graphical display, users may show off graphs, full-color pictures, text, and anything else they want to see by communicating with it through a standard SPI interface. The Pmod OLEDrgb utilizes a Solomon Systech SSD1331 display controller to receive information from the host board and display the desired information on the OLED screen. The SSD1331 is a single-chip CMOS OLED/PLED driver with 288 segments and 64 commons output, supporting up to 96RGB x 64 dot matrix display. It has embedded Graphic Display Data RAM (GDDRAM). It supports with 8, 9, 16 bits 8080 / 6800 parallel interface as well as serial peripheral interface.

 

image

 

The Pmod OLEDrgb communicates with the host board via the SPI protocol. By driving and keeping the Chip Select (CS) line at a logic level low, users may send both commands and data streams to the display controller based on the state of the Data/Command (D/C) pin. The display controller operates in SPI Mode 3 (clock idles on logic high, data is captured on the clock rising edge, and data is transferred on the clock falling edge) and with a minimum clock cycle time of 150 ns. The embedded display only supports SPI write, so users will not be able to receive any information back from the display over SPI. As a graphical display interface, users may light up any individual pixel on the OLED, display predefined characters, or even load bitmaps onto the screen. Each pixel can be set to one of the 65,535 colors that are available in a 5-6-5 bit RGB format. The OLED display has a specific power-up and power-down sequence to ensure the longevity of the device.

 

Quick Configuration Commands

 

You can run a sequence of commands to configure the display when the Pmod is powered on and off. For example, 

 

Enable the driver IC to accept commands by sending the unlock command over SPI (0xFD, 0x12).

SpiWriteMultiple(2, 0xFD, 0x12); //Write two bytes-- the (un)lock commands register and the byte value to set the register to unlock command mode

Send the display off command.

SpiWrite(0xAE); //Turn off the display with a one byte command

Set the Display start Line to the top line (0xA1, 0x00).

SpiWriteMultiple(2, 0xA1, 0x00); //Write two bytes-- the set display start line command and the single byte value for the top line

Make it a normal display with no color inversion or forcing the pixels on/off (0xA4).

SpiWrite(0xA4); //A single byte value for a normal display

 

Find all the data acquisition commands on the Pmod OLEDrgb Reference Page.

 

Connecting the Pmod OLEDrgb to Arduino Uno

 

Follow the below instructions to connect Pmod OLEDrgb to Arduino Uno.

 

Pmod PinArduino Uno Pins
Vcc3V3
GND

GND

SCK13 (SCK)
MOSI11 (MOSI)
CS10
D/C9
RES8
VCCEN3V3
PmodEN3V3

 

image

 

Software applications

 

PmodOLEDrgb communication with Arduino Uno through SPI (SPI mode 3). The Adafruit_SSD1331.h library is used to control the display. This library includes the Adafruit-GFX library (https://github.com/adafruit/Adafruit-GFX-Library) which provides functions for displaying text and geometrics in different sizes and colors.

 

First of all, all pins and color hex codes are defined. Then, an object is created. Then the display is initialized.

 

The display background is set  and cleared after each run.  A range of member functions are used to

  1. Set the color, cursor position and text size
  2. Display one character at a time in the string literal "PMODLED"

 

Project code

/************************************************************************


  Test of the Pmod OLEDrgb


*************************************************************************


  Description: Pmod_OLEDrgb
  A test message will be displayed on the OLEDrgb module
  with different size and colors


  Material
  1. Arduino Uno
  2. Pmod OLEDrgb
  3. breadboard
  https://github.com/adafruit/Adafruit-SSD1331-OLED-Driver-Library-for-Arduino
  https://github.com/adafruit/Adafruit-GFX-Library


************************************************************************/


//pin definitions
#define SCK  13 //serial clock
#define MOSI 11 //master-out slave-in
#define CS   10 //chip select
#define DC   9  //data/command control
#define RES  8  //power reset


#include <Adafruit_SSD1331.h> //include display library


//define colors
#define black   0x0000
#define blue    0x001F
#define red     0xF800
#define green   0x07E0
#define cyan    0x07FF
#define magenta 0xF81F
#define yellow  0xFFE0
#define white   0xFFFF


Adafruit_SSD1331 display = Adafruit_SSD1331(CS, DC, MOSI, SCK, RES);  //create the object


void setup() {
  display.begin();  //initialize the display
}


void loop() {
  display.fillScreen(black);  //set background and clear everything


  //display text
  display.setTextColor(white); //set text color
  display.setCursor(25, 0); //set cursor position (x, y)
  display.setTextSize(1); //set the size of text
  display.print("Testing:"); // display text


  //display one letter at a time
  char test[] = {"PMODOLED"}; //store characters
  display.setTextColor(cyan); //set text color
  display.setCursor(25, 15); //set cursor position (x, y)
  display.setTextSize(2); //set the size of text
  for (int i = 0; i < 4; i++) {
    display.print(test[i]);
    delay(200);
  }


  //continue in a new line
  display.setTextColor(yellow); //set text color
  display.setCursor(5, 40); //set cursor position (x, y)
  for (int i = 4; i < 8; i++) {
    display.print(test[i]);
    delay(200);
  }


  //letters with different colors
  display.setTextColor(red); //set text color
  display.print("r");
  delay(200);
  display.setTextColor(green); //set text color
  display.print("g");
  delay(200);
  display.setTextColor(blue); //set text color
  display.print("b");
  delay(200);


  delay(5000);
}

  • Sign in to reply

Top Comments

  • embeddedguy
    embeddedguy over 4 years ago +2
    Nice short tutorial, I recently used SSD1307 I2C LCD display with the same library. Works Great Definetely!
  • embeddedguy
    embeddedguy over 4 years ago

    Nice short tutorial, I recently used SSD1307 I2C LCD display with the same library. Works Great Definetely!

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube