¿Display Oled 128×64 SSD1306 como utilizar con Arduino UNO?
Para utilizar el Display Lcd Oled 128×64 de 0.96 pulgadas con la tarjeta de desarrollo Arduino Uno puedes realizar dos tipos de conexiones se muestran en las siguientes imágenes:- 3.3V del Arduino Uno conectar al pin Vcc del Oled
- GND del Arduino UNO conectar al pin GND del Oled
- Pin A4 del Arduino Uno conectar al pin SCL del Oled
- Pin A5 del Arduino Uno conectar al pin SDA del Oled
1- Primera conexión:
2- Segunda conexión:
Por ultimo te comparto este código para que lo puedas probar en tu Oled y verificar su funcionamiento:
#include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> const unsigned char PROGMEM logo [] = { 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,0xf8,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x06,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xc0,0x70,0x80,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x0f,0x00,0x30,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0xe0,0x00,0x0c,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x1e,0x00,0x00,0x03,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x0c,0x00,0x00,0x00,0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x7f,0xff,0xff,0xff,0xc0,0x03,0x00,0x00,0x00,0x30,0x00, 0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x01,0x04,0x00,0xc0,0x00,0x00,0xec,0x00, 0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x04,0x13,0x00,0x30,0x00,0x07,0x07,0x00, 0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x10,0x60,0xc0,0x0c,0x00,0x30,0x39,0x00, 0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x41,0x98,0x30,0x03,0x03,0x81,0xc1,0x00, 0x00,0x00,0x00,0x01,0x80,0x0f,0xff,0xff,0x07,0x06,0x08,0x00,0xd8,0x0e,0x01,0x00, 0x00,0x00,0x00,0x06,0x00,0x10,0x00,0x00,0x1c,0x41,0x86,0x00,0x00,0x70,0x01,0x00, 0x00,0x00,0x00,0x18,0x00,0x40,0x00,0x00,0x66,0x10,0x61,0x80,0x03,0x80,0x01,0x00, 0x00,0x00,0x00,0x3f,0x01,0x00,0x00,0x01,0xe1,0x84,0x19,0x80,0x0c,0x00,0x02,0x00, 0x00,0x00,0x00,0x20,0x1f,0xf8,0x00,0x06,0x18,0x61,0x86,0x00,0x10,0x00,0x06,0x00, 0x00,0x00,0x00,0x20,0x00,0x00,0xf0,0x0b,0x06,0x18,0x78,0x00,0x40,0x00,0x04,0x00, 0x00,0x00,0x00,0x3f,0xc0,0x00,0x06,0x18,0xc1,0x86,0x60,0x01,0x80,0x00,0x08,0x00, 0x00,0x00,0x00,0x00,0x07,0xfc,0x01,0x86,0x30,0x61,0x80,0x06,0x40,0x00,0x10,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x61,0x84,0x1a,0x00,0x18,0x40,0x00,0x20,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x8e,0x18,0x61,0x8c,0x00,0x60,0x20,0x00,0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x89,0x86,0x18,0x70,0x01,0x80,0x20,0x03,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x88,0x61,0x83,0xc0,0x02,0x00,0x10,0x0c,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x88,0x18,0x20,0x00,0x02,0x00,0x10,0x30,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x88,0x06,0x0c,0x00,0x01,0x00,0x08,0xc0,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x88,0x01,0x83,0x00,0x00,0x80,0x0b,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x00,0x60,0xc0,0x00,0x80,0x04,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x0c,0x00,0x30,0xc0,0x18,0x30,0x00,0x40,0x04,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x33,0x00,0x0c,0x30,0x06,0x18,0x00,0x20,0x06,0x00,0x00,0x00, 0x00,0x00,0x00,0x10,0x40,0x80,0x03,0x0c,0x01,0x04,0x00,0x20,0x02,0x00,0x00,0x00, 0x00,0x00,0x00,0xef,0x80,0x61,0x00,0xc3,0x01,0x02,0x00,0x10,0x03,0x00,0x00,0x00, 0x00,0x00,0x00,0x83,0x00,0x1e,0x00,0x30,0xc1,0x01,0x00,0x18,0x01,0x00,0x00,0x00, 0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x0c,0x31,0x20,0x80,0x08,0x01,0x00,0x00,0x00, 0x00,0x00,0x01,0x01,0x00,0x00,0x01,0x03,0x0f,0x10,0x40,0x04,0x00,0x80,0x00,0x00, 0x00,0x00,0x01,0x83,0x00,0x00,0x06,0x00,0xc3,0x0c,0x20,0x04,0x00,0x80,0x00,0x00, 0x00,0x00,0x00,0xc6,0x00,0x00,0x18,0x00,0x30,0x02,0x10,0x02,0x00,0x40,0x00,0x00, 0x00,0x00,0x00,0x38,0x00,0x00,0x60,0x00,0x0c,0x03,0x08,0x01,0x00,0x40,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x03,0x03,0x0c,0x84,0x03,0x00,0x20,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0xf0,0x42,0x0c,0x00,0x20,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x04,0x00,0x00,0x21,0x30,0x00,0x10,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x04,0x00,0x00,0x18,0xc0,0x00,0x10,0x00,0x00, 0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x04,0x00,0x00,0x0c,0x40,0x00,0x70,0x00,0x00, 0x00,0x00,0x0f,0x00,0x06,0x00,0x00,0x04,0x00,0x00,0x02,0x20,0x03,0x10,0x00,0x00, 0x00,0x00,0x30,0xc0,0x18,0x00,0x00,0x04,0x00,0x00,0x01,0x10,0x0c,0x30,0x00,0x00, 0x00,0x00,0xc0,0x30,0x20,0x00,0x00,0x04,0x00,0x00,0x00,0x88,0x30,0xc0,0x00,0x00, 0x00,0x03,0x00,0x0c,0x80,0x00,0x00,0x0c,0x00,0x00,0x00,0x65,0xc6,0x00,0x00,0x00, 0x03,0xec,0x00,0x02,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x32,0x18,0x00,0x00,0x00, 0x06,0x18,0x00,0x00,0x00,0x00,0x70,0x40,0x00,0x00,0x00,0x08,0x60,0x00,0x00,0x00, 0x0c,0x08,0x00,0x00,0x00,0x01,0x9d,0x80,0x00,0x00,0x00,0x05,0x80,0x00,0x00,0x00, 0x08,0x08,0x00,0x00,0x00,0x03,0x06,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00, 0x0c,0x18,0x00,0x00,0x00,0x02,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x06,0x10,0x00,0x00,0x00,0x02,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x03,0xe0,0x00,0x00,0x00,0x03,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x01,0xd8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x60,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,0x00,0x00,0x00, }; #define OLED_RESET LED_BUILTIN Adafruit_SSD1306 display(OLED_RESET); #if (SSD1306_LCDHEIGHT != 64) #error("Altura incorrecta, cambie en la libreria de Adafruit_SSD1306.h!"); #endif void read_temp() { display.clearDisplay(); display.setTextSize(2); display.setTextColor(WHITE); display.setCursor(0,10); display.println("SALUDOS DE"); display.setCursor(0,32); display.println("UNITELECTRONICS"); display.display(); } void setup() { display.begin(SSD1306_SWITCHCAPVCC, 0x3C); display.clearDisplay(); display.drawBitmap(0,0,logo,128,64,1); display.display(); delay(5000); } void loop() { read_temp(); }
Compila el código y cargalo a tu Arduino Uno, el resultado que obtendrás sera el siguiente: