What driver runs my LCD12864 128x64

I'm trying to connect 128x64 LCD display with Arduino. I purchased the display few years ago on e-bay and I have no access to any details about it.

I spend many hours with this tutorial http://playground.arduino.cc/Code/LCD12864 however I'm unable to display anything. The only thing which works for me is backlight and contrast POT ;-) I read on this forum there are many different drivers for a LCD12864. Perhaps the library in the tutorial is incompatible with my display.

When I look on the back of the LCD I found:

TRUMETER 4GLM-12864 TR-803 5U94V-0

On the very bottom just above pins there is: 4GLM-12864ILDN CMS-CG084DYSY-N D9932

I would appreciate any information about it. Taking the opportunity could you also tell me where can I find a low level spec how to talk to the display and use all it's features?

Where did you get the glcd? Did the seller specify what chipset the glcd used? Are there any labels on the actual pins on the glcd?

Before you proceed any further, you need to identify which glcd module you have. And more importantly find it's datasheet. glcds are not like the character hd44780 displays in that the hd44780 displays for the most part all use a compatible pinout and all use the same electrical and s/w command structure to talk to them. There is no "standard" for glcds. They use different chips sets and have many different pinouts. Even modules that have the same chipset on them can have different pinouts including for power. The big problem is that if it is hooked up incorrectly the glcd module can quickly be burned up, particulary if the power connections are incorrect. So when playing with glcds guessing on the wiring is not good since it is possible to damage the glcd with incorrect wiring. The fact that you got the backlight and contrast to work is a good sign that the power connections were all correct. (I'm assuming that rotating the contrast pot can turn all pixels on or all pixels off depending on direction of the pot)

The tutorial you linked to is for a glcd module that uses a st7920. st7920 and ks0108 modules have similar looking pinouts but are very different. The way to identify a st7920 module is you will see pins labeled: PSB NC

Where as a ks0108 will have these pins instead CS1 CS2

It is very important to get the proper datasheet. Use the wrong one and it can damage the glcd. The labeling on the back seems to indicate a ks0108. I was able to find this datasheet: http://www.scribd.com/doc/6564393/4GLM128641 which may be one you have. If you have labeled pins on your glcd that would fully identify it.

Once the glcd and pinout has been identified, there are two very nice libraries:

glcd is very fast but currently only works for ks0108 and sed1520 displays glcd supports text regions and scrolling. u8glib has support for many different displays including displays that use i2c or spi, which can save alot of pins. u8glib doesn't support text scrolling but supports text rotation and has many more fonts included than glcd.

The two libraries work very differently and have different capabilities. Both support text and graphic primitives that are way beyond the capabilities provided by the st7920 library you linked to earlier.

--- bill

Bill, thank you very much for you time. It was extremely useful. You can't imagine amount of pain I went through to trouble shoot this issue ;) I agree, I need to know what am I dealing with. As I mentioned I got this on ebay few years ago. I was experimenting with AVRs but at that point 16x2 was as much as I could do. The LCD was forgotten and untouched for at least 4 years! Now I can't find any details of that auction so the only thing I have is labels on the display.

I'm attaching some photos (I should do it in the first place) so perhaps that could help with identification.


SFE has similar design, with 3 no-case IC: https://www.sparkfun.com/products/710

Magician: SFE has similar design, with 3 no-case IC: https://www.sparkfun.com/products/710

With a glcd it is not good to make guesses because a hooking up wires according to an incorrect pinout can smoke the glcd. Nearly all the 128x64 glcds will have 3 plastic bonded chips on them. This glcd is labled 4GLM-12864 vs the sparkfun glcd datasheet is for a GDM12864H. If you look at the datasheets, and assuming they are both top views of the module. The sparkfun module has pin 1 on the left and the other one has pin one on the right. (The photos show pin 1 on the right) The spark fun glcd has 2 half holes on the top whereas this glcd has 2 full holes on the top. The spark fun datasheet shows the 2 half holes on the top and the 4GLM12864-1 datasheet shows 2 full holes along the top of the module. The spark fun pinout is also not a very common pinout for a ks0108 glcd. The pinout shown on the 4GLM12864-1 datasheet is much more common.

Given all this information, this glcd is not likely to be the spark fun glcd.

The GDM1264H and the 4GLM12864-1 datasheet have power/ground reversed from each other. So one of those datasheets, if used, will more than likely damage the glcd.

Luke, If I had to guess based on everything so far, I'd say the 4GLM12864-1 datasheet for a ks0108 glcd module I linked to earlier looks very promising. But lets dig a bit deeper just to be safe.

In the photo, you see a large etch plane going to pin 1. A large metal plane is often used for a ground. +1 for the 4GLM12864-1

A big question is how did you have it wired up when you said that contrast was working? I didn't see a pinout on the st7920 page you linked to.

And when you say contrast was working, do you mean that you could adjust the pot and see all the pixels on or all the pixels off depending on which direction the pot is turned? If so that means that ground, power (normally pins 1 an 2), Vee (normally glcd pin 18), and Vo (normally glcd pin 3) are all hooked up correctly.

If the datasheet I linked to is correct, then you will need a current limiting resistor for the backlight as it is a power hog. (as much as 840 ma!) I have some glcds that are like that. I use a 4 to 10 ohm resistor on them to cut the power down. Brightness is still ok even at around 200-300ma.

--- bill


Google for "4GLM 12864" gives a link to http://de.scribd.com/doc/6564393/4GLM128641: It is a KS0108 based display.

1 Vss 2 Vdd 3 V0 4 RS 5 R/W 6 E 7-14 D0-D7 15 CS1 16 CS2 17 RSTB 18 Vout 19 BLA 20 BLK


olikraus: Hi

Google for "4GLM 12864" gives a link to http://de.scribd.com/doc/6564393/4GLM128641:

Same datasheet I posted earlier.

Thank your for all the comments.

I tried the GLCD library. I had to remap PINs in the config/ks0108_Arduino.h because my setup is different:
#define glcdData0Pin 4
#define glcdData1Pin 5
#define glcdData2Pin 6
#define glcdData3Pin 7
#define glcdData4Pin 8
#define glcdData5Pin 9
#define glcdData6Pin 10
#define glcdData7Pin 11
#define glcdCSEL1 12
#define glcdCSEL2 13
#define glcdRW 2
#define glcdDI 1
#define glcdEN 3

I’m not sure about “glcdDI” does it refer to LCD’s PIN4 “RS”? I have no pin labeled as DI and this is the only one which is missing.
I’ve tried few examples but non of them is working for me. I wouldn’t be surprised if I already burned by display. There was a moment yesterday when by accident I connected 5+ to Vout and GROUND to RSTB. It was only a second but I smelled it :slight_smile: If that is the case I will make sure the next one I get is ks0108 as I already have experience with it.

I didn’t use any resistor for backlight because the smallest one I have is 160omh and that is far too much. The backlight takes 200mA from Arduino 5V port. Perhaps I would take more from a non USB source.

Contrast is connected to 10k POT. Left pin goes to LCD PIN 18 Vout, Mid goes to PIN 3 (Vo) and the right one is ground. I can see pixels fading in when I turned it to the right.

This is what I’ve done:



Google for “4GLM 12864” gives a link to http://de.scribd.com/doc/6564393/4GLM128641:

Same datasheet I posted earlier.

Oh, yes, excause me for this… I should read more carefully your posts…


DI and RS are the same things. This is noted in the included PDF and HTML documents as well as the connection table on the ks0108 playground web page.

Wow! thats a lot of wires, soldering and connectors ..... My concern is that with so many wires and connections the possibility of errors or bad connections goes up substantially.

I solder male headers to the glcd and then plug it into a breadboard and use that for all the connections connections. It makes hooking things up much easier since no additional soldering is needed. (maybe for the pot) and jumper wires can be plugged into the Arduino and the breadboard.

For connections to PCBs I'll still use male headers on the glcd but use a female header on the PCB board to allow easy connection of the display to the PCB without having to use any wires.

An alternative is to use an IDE cable for the wires. Simply plug the glcd with its soldered male headers into one side of the cable and only use one half of the cable. If you go this route, then make sure that all the wires go straight through as some IDE cables have interconnections on the cable select connections. Also make sure to limit the able length to less than 12-18 inches. I've done limited tested with these cables at that length and it seems to work but if you get too long it will create noise that will make things not work properly. Using this strategy you can make you own shield that plugs into the UNO using stacking headers (you have to bend the header pins for D8-D13 row) and then you can solder on a small PCB mount pot and use a male header to connect to an IDE cable.

What is on the top row pins on the Arduino board? The connector/header looks odd in the photo.

Hooking up +5 to Vout (also known as Vee on some glcds) is not good. That can very quickly burn out the glcd on board negative power supply used to drive the contrast circuit. Without that powersupply working, you will never see any pixels. However, given that you are seeing pixels now that the contrast pot and power connections are properly hooked up, it may be ok.

I would avoid using Arduino pins 0 and 1 as those are used for the serial port and are hooked up to the FTDI/U8/U16 USB to serial conversion chip. Trying to use them for something else will have issues/problems. Using pin 1 may be ok since it normally isn't driven by the USB chip but it might be useful to avoid it at least for initial testing of the glcd.

What were the results of running the diag sketch? That would be the next step. Run the diag sketch and post the results back here. That will be the best way to try to diagnose any potential issues.

In nearly all cases a non functioning glcd is due to wiring issues (incorrect connections, broken wires, faulty soldering, or poor electrical connections)

In a few case it is due to a bad glcd and those cases, it was almost always due to previous incorrect wiring that damaged the glcd. But even in those cases, some of the glcds still kind of sort of worked. Often the damaged glcd still worked but the contrast circuit was damaged so the pixels either didn't show up or had issues.

--- bill

Oh one other note. The reset signal on the ks0108 is active low. (RSTB pin 17 on your datasheet) So it needs to be high for normal operation. You can connect it straight to vcc but using a resistor would be safer.

While the majority of ks0108 modules will work with their reset signal tied high, some require an actual reset pulse on the reset signal to work properly. For those, an additional Arduino pin can be used to reset the glcd by modifying the pin configuration file. There is no way to really know in advance.

--- bill

Thank you Bill. With regards to the wiring I love your idea! I've just began my adventure with electronics. Soldering LCD with male connectors didn't occur to me. I've already ordered a new LCD (which is ks0108) just in case the one I got is broken. I will follow your advice.

I will also run the the "diag sketch" Today to find out what is going on with my device. Thank you for pointing out the issue with reset pin. I didn't know it has to be HIGH.

Thank you once again.

Here is a couple of photos of a glcd using a breadboard and an IDE cable.
The boards I’m using aren’t an arduinos.
They have pins on them, to directly plug into a breadboard
but electrically they work the same.
— bill



Connecting the display with IDE tape looks neat. My background is purely software development so I have no instinct for this sort of things, yet. Thank you for showing me this setup I will do the same in my future projects.