# KS0108 Family

The KS0108 is a popular controller chip used in GLCD displays but the wiring for these panels is not standardized and it is important to check the datasheet for your panel to confirm how it should be wired. Incorrect connections of the signal lines are the most common cause of problems.

Warning:
  Particular care should be taken with the power leads as wiring these incorrectly can destroy a panel.

Most GLCD panels require an external preset pot to set the LCD working voltage (contrast) and a fixed resistor to limit the current in the backlight. The datasheet for your panel should provide specific information on the wiring and choice of components for this. It is important to note that ks0108 modules do not wire up their contrast pot the same way as a typical hd44780 character lcd. A hd44780 typically hooks its contrast pot legs to +5v and GND. In most cases, on a ks0108, the pot, which is typically between 10-20k, is used to create a varying negative voltage from Vee up to GND that is used to feed to the Vo input signal. In order to do this, one leg of the pot needs to hook to ground, one leg needs to hook to the Vee negative voltage output pin and then the wiper, which is the middle pin of the pot, will have the variable voltage output that can be fed to the Vo contrast control input pin.

The table below shows common pinouts for KS0108 panels.

Note:
  Additional panel pinout information can be found on the Arduino playground page: GLCDks0108

The numbers under the Arduino column are the Arduino pins used in the configuration file provided in the download, if you alter the wiring to Arduino pins then you must change the pin assignments in the configuration file.

The numbers in the Panel A/B columns are the pin numbers of the GLCD display panel

KS0108 Pin Connections Table
Ardiuno pins | Mega | Sanguino | Teensy | Teensy ++ | GLCD Function | Panel A | Panel B | Comments
--- | --- | --- | --- | --- | --- | --- | --- | ---
5V | 5V | 5V | 5V | 5V | +5 volts | 1 | 2 |
Gnd | Gnd | Gnd | Gnd | Gnd | GND | 2 | 1 |
n/a | n/a | n/a | n/a | n/a | (VO) Contrast in | 3 | 3 | Wiper (middle pin) of contrast pot
8 | 22 | 0 | 0 | 10 | D0 | 4 | 7 |
9 | 23 | 1 | 1 | 11 | D1 | 5 | 8 |
10 | 24 | 2 | 2 | 12 | D2 | 6 | 9 |
11 | 25 | 3 | 3 | 13 | D3 | 7 | 10 |
4 | 26 | 4 | 13 | 14 | D4 | 8 | 11 |
5 | 27 | 5 | 14 | 15 | D5 | 9 | 12 |
6 | 28 | 6 | 15 | 16 | D6 | 10 | 13 |
7 | 29 | 7 | 4 | 17 | D7 | 11 | 14 |
14 (alog 0) | 33 | 24 | 7 | 18 | CSEL1 | 12 | 15 | Chip 1 select
15 (alog 1) | 34 | 25 | 8 | 19 | CSEL2 | 13 | 16 | Chip 2 select
Reset |  |  |  |  | Reset | 14 | 17 | Connect to reset
16 (alog 2) | 35 | 26 | 6 | 8 | R_W | 15 | 5 | Read/write
17 (alog 3) | 36 | 27 | 5 | 9 | D_I | 16 | 4 | Data/Instruction (RS)
18 (alog 4) | 37 | 28 | 9 | 7 | EN | 17 | 6 | Enable
n/a | n/a | n/a | n/a | n/a | (VEE) Contrast out | 18 | 18 | 1 leg of Contrast pot
n/a | n/a | n/a | n/a | n/a | Backlight +5 | 19 | 19 | See datasheet
Gnd | Gnd | Gnd | Gnd | Gnd | Backlight Gnd | 20 | 20 | See datasheet
Gnd | n/a | n/a | n/a | n/a | n/a | n/a | n/a | other leg of contrast pot

The following illustrations show the wiring for these panel types with a standard Arduino (168/328). Although the pin number on the GLCD panels are different, the corresponding functions are connected to the same Arduino pins in all three examples so the supplied ks0108_Config.h configuration file should work without change if you wire your panel following the appropriate diagram. The ks0108 needs to have its reset pin taken low for a brief period after power is applied. The diagrams show the display’s reset pin connected to the Arduino reset pin and this will automatically reset the display when the Arduino resets. You can also wire the display reset pin to a spare Arduino pin and control reset in software by adding a define to the panel configuration file (see configuration below), but this is only necessary if the display reset is not wired to Arduino reset.

Note:
  The diagrams that follow are for standard Arduino boards (ATmega 168/328). If you have a different board then you should follow the pin assignments in the Pin Connections Table above.

A tip for making the physical connections is use a small piece of stripboard with header pins for 5V, ground and Reset providing connection to the Arduino. The picture has an example layout for a type A panel

Mega, Sanguino and Teensy boards provide faster performance by allowing all the data pins to be connected to the same port. Configuration files for these boards are provided in the library and note that each board type uses a different selection of pins.

All Classes Functions Variables