Home Elements Boards Recipes

Display SH1106 Element

The DisplaySH1106 Element allows connecting a pixel based OLED display based on a SH1106 chip.

This OLED displays offer a mono color (e.g. white on black) output with various resolutions and can be addressed using the Wire / I2C or the SPI protocol.

The chip supports a resolution up to 132 * 64 pixels. Some available displays only use a portion of the maximum display size. Some displays emit white, blue or yellow color on a pixel cannot be changed.

SH1106 display

The implementation is done with the help of the GFX library for Arduino.

Display Configuration

The display is configured using the following parameters:

width - The width of the display either characters or pixels.

height - The height of the display either characters or pixels.

rotation - Some displays can be rotated. The rotation of the display is given by values of 0, 90, 180 or 270.

page – The logical page that is displayed.

brightness – The displays an be adjusted in brightness / contrast by specifying a value using the brightness event in a range of 0 to 100. This has a limited range (limited by the chip).

busmode – This parameter specifies the bus type. Default is i2c.

I2C Configuration Example

The SH1106 based displays can be connected to the SDA and SCL pins of the i2c bus that is configured in the device:

busmode – This parameter specifies the bus type and must be specified as i2c.

address - The i2c address of the display must be specified. Typical values are 0x3C and 0x3D.

busspeed – The bus speed used for the display can be specified up to 400KHz.

{
  "device": {
    "0": {
      ...
      "I2C-SDA": "D2",
      "I2C-SCL": "D1"
    }
  },
  "displaysh1106": {
    "0": {
      "title": "display",
      "description": "local display",
      "width": "128",
      "height": "64",
      "busmode": "i2c",
      "address": "0x3C",
      "busspeed": "400000",
      "brightness": "50",
      "page": "1"
    }
  }
}

Web UI for the Display Element

sh1106 Web UI

This card shows the current output page that can also be seen on the local attached display. It is updated every time the status of the device is polled by the page.

Actions

onpage -

Element State

The following properties are available with the current values at runtime:

active - Is set to true when the element is active.

Example State

{
  "displaysh1106/0": {
    "active": "true",
    "brightness": "43",
    "page": "1"
  }
}

See also

Tags

Element