Espruino and I2C OLED display

Just recently I spotted various I2C OLED displays on sale at reasonable prices and fancied trying to connect these up one of my Espruino.

Being relatively small size, requiring only 2 connections SDA and SCL from the Espruino but still having good text and graphical capabilities I snapped a couple up cheaply on the net. Here is a picture of the OLED display I bought, these are common on many sites at the moment.

If you want to learn more about OLED technology I recommend you read – https://en.wikipedia.org/wiki/OLED

 

 

Connecting the OLED display proved straightforward enough as the display can take standard 3v3 and GND and as its an I2C device on my Espruino I hooked up B7 and B6 which are SDA and SCL respectively

 

Connection and Layout

Pin Label Espruino PIN I2C Function Notes
GND Ground Ground 0V
VCC 3v3 Power Regulated 3v3 supply.
SDA B7 SDA Serial data in
SCL B6 SCL  I2C clock

 

Here is a sample layout diagram

 

 

Code

[codesyntax lang=”javascript”]

require("SSD1306");

function start(){
 //10px
 g.setFontVector(10);
 // write some text
 g.drawString("Hello",0,0);
 // write to the screen
 g.setFontVector(20);
 g.drawString("World",0,10);
 g.flip(); 
}

// I2C
I2C1.setup({scl:B6,sda:B7});
var g = require("SSD1306").connect(I2C1, start);

[/codesyntax]

 

 

Links
0.96 Inch White SPI OLED Display Module 12864 LED For Arduino 2.7 x 2.8cm Resolution 128 x 64

1.3 inch oled white display with 4PIN 4-SPI(default)/I2C Drive IC SH1106

Related posts

Espruino temperature display project

Espruino and DHT22 example

Espruino and LDR example