NHD-12864AZ with AiP31108

Hello together,

im a little bit frustrated. I bought the NHD-12864AZ Display. Its a 128x64 Display.
But the documentation about it is so scarce. I wanted to use the u8g2 library and went with
common tutorials about 128x64 Displays because the pinout is essentialy the same on all of them. But it doesnt work. not even remotely. I know you have to uncomment the display you are using but none of the NHD Displays in the sample code do anything. Does someone have experience with this exact Display? Thank you for reading and helping

I Googled NHD-12864AZ and found https://www.newhavendisplay.com/nhd12864azfswfbw-p-477.html

It is always wise to post a link tho the actual item that you have bought. It removes all doubt and guesswork. Meaning that you get accurate replies.

The display uses a NT7108C controller which is similar to KS0108.
So I would search the U8g2 Wiki for "108" e.g.

KS0108 128X64

Controller "ks0108", Display "128x64" [Description]

    U8G2_KS0108_128X64_1(rotation, d0, d1, d2, d3, d4, d5, d6, d7, enable, dc, cs0, cs1, cs2 [, reset]) [page buffer, size = 128 bytes]
    U8G2_KS0108_128X64_2(rotation, d0, d1, d2, d3, d4, d5, d6, d7, enable, dc, cs0, cs1, cs2 [, reset]) [page buffer, size = 256 bytes]
    U8G2_KS0108_128X64_F(rotation, d0, d1, d2, d3, d4, d5, d6, d7, enable, dc, cs0, cs1, cs2 [, reset]) [full framebuffer, size = 1024 bytes]

You mention AiP31108 which Google finds datasheet https://www.newhavendisplay.com/appnotes/datasheets/LCDs/AiP31108.pdf

Which is also a KS0108 style controller.

I would run all of the U8g2 examples with the U8G2_KS0108_128X64_1() constructor.

Quite honestly, most applications can afford 1024 bytes for a full 128x64 buffer. In which case you can try the U8G2_KS0108_128X64_F() constructor.

When looking for a library or constructor, it is the controller part number that is important. e.g. KS0108
The NHD is probably only relevant for weird and wonderful versions e,g. if Newhaven has non-standard hardware or is abusing the controller.


1 Like

First of all thank you for your fast and good answer.

You are absolutley right. I should have posted the actual Display. It is the:


The Constructor you said i should take has way more pins declared as every other display

U8G2_KS0108_128X64_1 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 18, /*dc=*/ 17, /*cs0=*/ 14, /*cs1=*/ 15, /*cs2=*/ U8X8_PIN_NONE, /* reset=*/ U8X8_PIN_NONE);

I am using a Arduino Uno do i have to change the Pins for cs0 and so on or can i ignore them because it doesnt work out just like that :slight_smile:

Any KS0108 requires 8 data pins + control pins. e.g. RS, RW, E, CS1, CS2, RST.

If you want a 128x64 GLCD with less pins, choose a controller with SPI or I2C interface e.g. ST7920

You can run a KS0108 on a Uno. You just use up a lot of pins.
No, you can't omit CS0, CS1, ...
Note that the constructor has slightly different names to what is printed on your pcb. i.e. enable=E, dc=RS, cs0=CS1, cs1=CS2, reset=RST


1 Like

thank you for your answer. Im trying but my display still doesnt show any sign of Life except the backlight. But thanks to you i now know which constructor to use and that it should be possible somehow


My advice is:

  1. plug KS0108 into a breadboard
  2. use coloured wires for control signals.
  3. show a clear photo of your connecting wires to the Uno.
  4. copy-paste the actual constructor statement.

I can assure you that you can drive a KS0108 with a Uno but there are a LOT of wires. Which is why I always make Adapter Shields.
e.g. with proper female sockets for the display and solder the connections on a Protoshield.
Trailing wires are not very reliable. You have to get every wire correct. A single loose joint means failure.

In practice I use a KS0108 12864 I2C Adapter like https://www.ebay.co.uk/itm/273337500677


1 Like

Thanks for your advice.

i followed your advice. Sadly i cant show a picture because i am not allowed to make pictures here at work (I am a german "Azubi" so basically an apprentice). But i checked every wire and it is exactly wired after following constructor:

U8G2_KS0108_128X64_1 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /enable=/ 3, /dc=/ 2, /cs0=/ 12, /cs1=/ 13, /cs2=/ U8X8_PIN_NONE, /* reset=*/ U8X8_PIN_NONE); // Set R/W to low!

And yes i connected RW to GND and Reset Pin is still free. I let the Data pins as they were and just changed the control Pins. Also i followed your naming: dc = RS / cs0 = cs1 / cs1 = cs2

My display shows nothing except the backlight. Im using the GraphicTest Sketch from the newest u8g2 library.

i will try if i can get my Hands on a controller

I don't know when new members can post photos. I would expect 24 hours membership or perhaps after 2 messages.
You have been a member for over 2 months and have posted several messages.

I would be happier with RST pin being connected to the Uno and the reset argument being used in the constructor. Most KS0108 have a weak pullup on RST but it is always safer to use a GPIO pin.

Otherwise it looks as if you are doing everything correctly.

I presume you have connected a potentiometer between VSS and VEE with the slider to VO.
As you alter the pot you will see the GLCD pixel contrast come in and out of view.


1 Like

Perfect. You are such a amazing human beeing to stay and still answer me. So i set the RST Pin. And i had a potentiometer between 5V and GND and the slider to V0 but it probably wasn`t working properly because after i exchanged it i could finally get the display to work.

Thank you for your patience with me. I will probably post the exact pinout and constructor somewhere so others can find it more easily maybe i will even make a Video who knows.

So was it RST or contrast ?
Or both ?

It is very frustrating when things don't work.
You just need to be meticulous with your wiring.
Document the wire colours.
Tick off each wire from a paper checklist with a genuine pencil.

Paper checklists horrify our younger readers. But they take ten minutes to draw up. And about 5 minutes to use.
Just compare that 15 minutes to the hours and days of frustration when you don't have a "plan".

And is probably why aircraft pilots use checklists. They can't afford 24 hours to "think" when the aircraft has a problem.


1 Like

sorry that i am responding that late.
it was probably RST. because contrast was connected already.
i tested it later and if RST is not connected it just doesnt work.

Yeah paper checklist are awesome. But i made it even simpler. I just connected the pins of the display in order. Meaning to firt pin after the supply pins of the display went to pin 13 on the arduino the next one to pin 12 etc. Then i changed the constructor to my pinout and everything worked perfectly. The Pins were barely enough but the Analog pins would have worked too (i tested it).

But thanks again for your help. My little weatherstation project is now finished because of you :slight_smile: