Using OLED module (SH1106 / SSD1306... etc.)

Dowload Driver

Other than the Grove OLED, you might use other OLEDs which are with different controllers. Based on the work of olikraus, we ported the original U8g_Arduino library to LinkIt 7697 BSP. You can download and use it to drive different types of OLEDs with LinkIt 7967. For details, you can check the compete list of supported OLEDs in the official WiKi. For how to install the driver, you can also refer to another tutorial for installing it. Here we give a brief example to show how to use it and a commonly-seen issue.

Hardware Setup

We use a 4-pin 128x64 I2C OLED module as the example. Connect the 3V3 / GND / P8 / P9 pins on LinkIt 7697 to VCC / GND / SCL / SDA pins on the OLED module, respectively. After installing the driver, open the example under File / Examples / U8g2 / page_buffer / GraphicsTest sub-menu in the Arduino IDE. Follow the initialization process in the Software Setup section below, compile and upload this sketch to LinkIt 7697, you should be able to see different patterns displaying on the OLED module.

Software Setup

After opening the GraphicsTest example sketch, you'll see lots of constructors commented out in the beginning of the file. Uncomment one of them according to the part number (and the interface, e.g. HW I2C or SPI) of the driving IC on your OLED module. For example, the driving IC on our testing set is SH1106 with HW I2C, so we uncommented Line 71 to instantiate the module correctly:

//U8G2_SSD1306_128X64_VCOMH0_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);	// same as the NONAME variant, but maximizes setContrast() range
//U8G2_SH1106_128X64_NONAME_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
U8G2_SH1106_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
//U8G2_SH1106_128X64_VCOMH0_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);		// same as the NONAME variant, but maximizes setContrast() range
//U8G2_SSD1306_128X32_UNIVISION_1_SW_I2C u8g2(U8G2_R0, /* clock=*/ 21, /* data=*/ 20, /* reset=*/ U8X8_PIN_NONE);   // Adafruit Feather M0 Basic Proto + FeatherWing OLED

Then compile and upload the sketch file to LinkIt 7697. You'll see different patterns showing on the OLED module.

Note

There are some 128x64 OLED modules marked with the SSD1306 driving IC but in fact they are NOT. If you used the SSD1306 constructor to drive an OLED module and saw patterns offsetting by some pixels (the left side are cut and the right side shows uninitialized columns) like below, this indicates it's not a SSD1306 OLED module. In our case, it's a SH1106 instead (Reference).

Last updated