GROVE - OLED display 128x64

From openPicus Wiki
Jump to: navigation, search


Device description

Oled128x64 1.jpg The device is an OLED monochrome 128×64dot matrix display module.

It provide high brightness, self-emission, high contrast ratio, slim outline, wide viewing angle, wide temperature range, and low power consumption. OLED display communicate with Flyport Module using the I2C bus interface. Specific library is available to use this device among with GROVE-Nest system.

  • Power Supply: 3-5V (5V recommended);
  • Dot Matrix: 128 x 64 pixel (monocromatic);
  • Dot Size: 0.15(W)mm x 0.15(H)mm;
  • Dot Pitch: 0.17(W)mm x 0.175(H)mm;
  • Temperature Range: -20°C~70°C
  • FONT and IMAGE: both strings and images can be displayed to the device.

How to use

This device uses its specific library plus the Grove basic libraries that are embedded into the GROVE TEMPLATE available from IDE 2.3. Just create a new Project on the IDE using the right GROVE TEMPLATE.
The device must be connected on the I2C port of the Grove board. OLED Display can share I2C bus with other Grove devices using a different address (all the incompatible devices are specifically adviced in this wiki). You can use only one OLED Display device per I2C port.

  • Connect to port: I2C;
  • Library to use: OLED Display library + Grove basic library included into each Grove Template on the IDE

Once the library is added to the project, using the External lib button, the line #include "oled.h" must be inserted in taskFlyport.c to include the header file. The line must also be inserted in HTTPApp.c if you want to access the device from webserver.

More infos and examples can be found in the Grove Library page.

Software commands

As usual the steps the use the device are:

  • Initialization: the device is initialized as Oled, OLED_ADDR0 type (special I2C sensor type developed inside the oled.c/.h library), where OLED_ADDR0 is a constant for the I2C device address.
    The function to use is void* device_name = new(Oled, OLED_ADDR0);;
  • definition of the port: the sensor must be connected to the I2C port: attachToBoard(board_name, device_name, I2C);;
  • configuration: to initialize the device internal registers it is sufficient to execute the configure command: configure(device_name);;
  • set the new STRING or IMAGE data: two modes are available for OLED Display device:
device object to write type of write background color start point end point (optional)
device_name the string (or char*) to write STRING BLACK / WHITE column start pixel column end pixel none
device_name image_array_name IMAGE BLACK / WHITE column start pixel column end pixel sizeof(image_array_name)


  • to write strings: set(device_name, string_to_write, STRING, BACKGROUND_COLOR, start_point, end_point);
  • to write images: set(device_name, image_array_name, IMAGE, BACKGROUND_COLOR, start_point, end_point, sizeof(image_array_name));

Warning! To use the IMAGE parameter (like the logo on the example), we used the free tool LCD Assistant that creates .h files with the const char array that contains the image bitmap vector. In the following example the image is contained inside the file “logo.h” (that can be found inside the OLED Display library)

Usage example

#include "taskFlyport.h"
#include "grovelib.h"
#include "oled.h"
#include "logo.h"
void FlyportTask()
	UARTWrite(1,"Welcome to GROVE NEST example!\r\n");
	// GROVE board
	void *board = new(Board);
	// GROVE devices	
	// OLED display
	void *oled = new(Oled, OLED_ADDR0);
	attachToBoard(board, oled, I2C);
		// Write the first string, with BLACK background
		set(oled, "Hello Dude!", STRING, BLACK, 0, 0);
		// Now write two different strings, with WHITE background
		set(oled, "Grove Nest", STRING, WHITE, 0, 0);
		set(oled, " the best!", STRING, WHITE, 3, 3);
		// Now paint a image from array
		set(oled, logo_BW, IMAGE, BLACK, 0, 127, sizeof(logo_BW));
		// A fast way to clean all the display content is to write blank rows
		set(oled, "                   ", STRING, BLACK, 0,0);
		set(oled, "                   ", STRING, BLACK, 1,0);
		set(oled, "                   ", STRING, BLACK, 2,0);
		set(oled, "                   ", STRING, BLACK, 3,0);
		set(oled, "                   ", STRING, BLACK, 4,0);
		set(oled, "                   ", STRING, BLACK, 5,0);
		set(oled, "                   ", STRING, BLACK, 6,0);
		set(oled, "                   ", STRING, BLACK, 7,0);
		set(oled, "                   ", STRING, BLACK, 8,0);
		set(oled, "                   ", STRING, BLACK, 9,0);

External references

  • Seeed studio wiki: complete datasheet of the OLED Display device;
Personal tools