Testando o Display OLED

Fabio Souza
Franzininho
Published in
15 min readOct 12, 2018

O display OLED é um componente que dá um toque especial a interfaces com usuário. A tecnologia OLED permite uma melhor legibilidade e não há a necessidade de uso de backlight, já que o próprio pixel emite luz.

Recentemente adquiri algumas peças para teste e vou explorar os seus recursos. O modelo que adquiri possui 128 x 64 px e comunicação I2C. O controlador desse display é o SSD1306 (vamos usar seu datasheet em breve).

Nesse artigo vamos ver o seu funcionamento usando bibliotecas existentes para a plataforma Arduino. Vamos lá?

Materiais

  • Arduino Nano(ou similar)
  • Display OLED 128 x 64
  • Protoboard
  • Jumpers

Circuito

Ligação:

  • SDA-A4
  • SCL-A5

Bibliotecas

Pesquisando, vi que as bibliotecas Arduino mais usadas para esse display são:

- Adafruit SSD1306 Library com a Adafruit GFX Graphics Library

- U8glib

Para nosso teste vou utilizar a biblioteca U8glib, que considerei mais completa. Mas fique a vontade para testar a biblioteca da Adafruit.

Código

Após instalar a biblioteca (que vem com muitos exemplos) na IDE, eu rodei o primeiro exemplo: Hello World

#include "U8glib.h"
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send AC
void draw(void) {
// graphic commands to redraw the complete screen should be placed here
u8g.setFont(u8g_font_unifont);
//u8g.setFont(u8g_font_osb21);
u8g.drawStr( 0, 22, "Hello World!");
}
void setup(void) {
// flip screen, if required
// u8g.setRot180();

// set SPI backup if required
//u8g.setHardwareBackup(u8g_backup_avr_spi);
// assign default color value
if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
u8g.setColorIndex(255); // white
}
else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
u8g.setColorIndex(3); // max intensity
}
else if ( u8g.getMode() == U8G_MODE_BW ) {
u8g.setColorIndex(1); // pixel on
}
else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
u8g.setHiColorByRGB(255,255,255);
}

pinMode(8, OUTPUT);
}
void loop(void) {
// picture loop
u8g.firstPage();
do {
draw();
} while( u8g.nextPage() );

// rebuild the picture after some delay
delay(50);
}
Olha como fica nítida a escrita

Esse código exibe a mensagem Hello World no display. Note que é necessário tirar o comentário a linha

U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);

Assim é configurada a comunicação para o nosso display.

Dando sequencia no teste, agora vamos desenhar no display. Para carregar nossas próprias imagens vamos usar o programa LCD Assistant:

Eu carreguei a imagem de um carro:

Após o ajuste da imagem, clique em File->Save Output e salve o arquivo como .c

Copie o código gerado para o código Arduino. O meu ficou assim:

#include "U8glib.h"
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send AC
const unsigned char PROGMEM car [] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0xFF, 0xF8, 0x0F, 0xC0, 0x00, 0x3F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0xFF, 0x00, 0x0F, 0x80, 0x00, 0x0F, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0F, 0xFC, 0x00, 0x0F, 0x80, 0x00, 0x08, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1F, 0xF0, 0x00, 0x0F, 0x80, 0x00, 0x08, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3F, 0xE0, 0x00, 0x0F, 0x80, 0x00, 0x08, 0x3F, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7F, 0xC0, 0x00, 0x0F, 0x80, 0x00, 0x08, 0x1F, 0xC0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFF, 0x80, 0x00, 0x0F, 0x80, 0x00, 0x08, 0x0F, 0xC0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x08, 0x07, 0xE0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0xFE, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x08, 0x03, 0xF0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0xFE, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x08, 0x01, 0xF8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x07, 0xFC, 0x00, 0x00, 0x0F, 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xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0x1F, 0x3F, 0xC7, 0x80,
0x00, 0x00, 0xF1, 0xFC, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x1F, 0x8F, 0x00,
0x00, 0x00, 0xF8, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x8F, 0x0F, 0x00,
0x00, 0x00, 0x7C, 0x01, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xC0, 0x1F, 0x00,
0x00, 0x00, 0x7E, 0x03, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xE0, 0x7E, 0x00,
0x00, 0x00, 0x3F, 0xFF, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFC, 0x00,
0x00, 0x00, 0x1F, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xF8, 0x00,
0x00, 0x00, 0x07, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xE0, 0x00,
0x00, 0x00, 0x01, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x80, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
void draw(void) {
// graphic commands to redraw the complete screen should be placed here
u8g.drawBitmapP( 0, 0, 16, 64, car);
}
void setup(void) {
}
void loop(void) {
// picture loop
u8g.firstPage();
do {
draw();
} while( u8g.nextPage() );

// rebuild the picture after some delay
delay(1000);
}

Olha como fica massa:

Agora eu criei duas imagens e fiquei alternando para gerar uma animação do carro andando:

const unsigned char PROGMEM car [] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0xFF, 0xF8, 0x0F, 0xC0, 0x00, 0x3F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0xFF, 0x00, 0x0F, 0x80, 0x00, 0x0F, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0F, 0xFC, 0x00, 0x0F, 0x80, 0x00, 0x08, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1F, 0xF0, 0x00, 0x0F, 0x80, 0x00, 0x08, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3F, 0xE0, 0x00, 0x0F, 0x80, 0x00, 0x08, 0x3F, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7F, 0xC0, 0x00, 0x0F, 0x80, 0x00, 0x08, 0x1F, 0xC0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFF, 0x80, 0x00, 0x0F, 0x80, 0x00, 0x08, 0x0F, 0xC0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x08, 0x07, 0xE0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0xFE, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x08, 0x03, 0xF0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0xFE, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x08, 0x01, 0xF8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x07, 0xFC, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x08, 0x01, 0xFC, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0F, 0xFC, 0x00, 0x00, 0x0F, 0x80, 0x00, 0x08, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0F, 0xFE, 0x00, 0x00, 0x1F, 0x80, 0x00, 0x0F, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 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00, 0x00, 0x00, 0x00, 0x07, 0xC0, 0x1F, 0x00,
0x00, 0x00, 0x7E, 0x03, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xE0, 0x7E, 0x00,
0x00, 0x00, 0x3F, 0xFF, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFC, 0x00,
0x00, 0x00, 0x1F, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xF8, 0x00,
0x3F, 0xFC, 0x07, 0xFF, 0x3F, 0xFE, 0x00, 0x1F, 0xFF, 0xF0, 0x00, 0x03, 0xFE, 0x7F, 0xE3, 0xFF,
0x7F, 0xFE, 0x01, 0xFC, 0x7F, 0xFF, 0x00, 0x3F, 0xFF, 0xF8, 0x00, 0x07, 0xFF, 0x0F, 0x87, 0xFF,
0x7F, 0xFE, 0x00, 0x00, 0x7F, 0xFF, 0x00, 0x3F, 0xFF, 0xF8, 0x00, 0x07, 0xFF, 0x00, 0x07, 0xFF,
0x7F, 0xFE, 0x00, 0x00, 0x7F, 0xFF, 0x00, 0x3F, 0xFF, 0xF8, 0x00, 0x07, 0xFF, 0x00, 0x07, 0xFF
};
const unsigned char PROGMEM car2 [] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0xFF, 0xF8, 0x0F, 0xC0, 0x00, 0x3F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0xFF, 0x00, 0x0F, 0x80, 0x00, 0x0F, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0F, 0xFC, 0x00, 0x0F, 0x80, 0x00, 0x08, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1F, 0xF0, 0x00, 0x0F, 0x80, 0x00, 0x08, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3F, 0xE0, 0x00, 0x0F, 0x80, 0x00, 0x08, 0x3F, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7F, 0xC0, 0x00, 0x0F, 0x80, 0x00, 0x08, 0x1F, 0xC0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFF, 0x80, 0x00, 0x0F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, 0x7F, 0xFF, 0x80, 0x00, 0x03, 0xFF, 0xFF, 0x0F, 0x83, 0xFF,
0x00, 0x3F, 0xFF, 0xF8, 0x00, 0x00, 0x7F, 0xFF, 0xC0, 0x00, 0x03, 0xFF, 0xFF, 0x00, 0x03, 0xFF,
0x00, 0x3F, 0xFF, 0xF8, 0x00, 0x00, 0x7F, 0xFF, 0xC0, 0x00, 0x03, 0xFF, 0xFE, 0x00, 0x03, 0xFF
};
int frame = 0;void draw(void) {
// graphic commands to redraw the complete screen should be placed here
switch(frame){
case 0:
u8g.drawBitmapP( 0, 0, 16, 64, car);
break;
case 1:
u8g.drawBitmapP( 0, 0, 16, 64, car2);
break;
}
}
void setup(void) {
}
void loop(void) {
// picture loop
u8g.firstPage();
do {
draw();
} while( u8g.nextPage() );
frame ++;
if(frame>1)
frame = 0;

// rebuild the picture after some delay
delay(100);
}

Resultado

Esse foi o primeiro teste, em breve vamos explorar mais detalhes desse display e aplicações mais interessante.

Se ficou alguma dúvida ou sugestão, deixe seu comentário abaixo.

--

--

Fabio Souza
Franzininho

Engenheiro, professor e fazedor! Apaixonado por tecnologia, é diretor de operações do portal Embarcados e líder do projeto Franzininho. about.me/fabio.souza