LCD 128x64 and I2C expander

Hi to all.
i bought an LCD 128x64 and an I2C expander.
I am trying to test it but the only thing that i have manage till now is to see only the backlight.
No characters in LCD screen appears.
I have found only nick gammon library and i used the example in it.
The expander use MCP23017 chip.
I have made the connections in an arduino UNO R3

VCC-----5V
GND-----GND
SDA-----A4
SCL-----A5

I attach photos of expander and LCD with expander on it.

This is the example i tried:

// Demo of KS0108B graphics LCD screen connected to MCP23017 16-port I/O expander

// Author: Nick Gammon
// Date: 14 February 2011


#include <Wire.h>
#include <SPI.h>
#include <I2C_graphical_LCD_display.h>

I2C_graphical_LCD_display lcd;

// example bitmap
const byte picture [] PROGMEM = {
 0x1C, 0x22, 0x49, 0xA1, 0xA1, 0x49, 0x22, 0x1C,  // face  
 0x10, 0x08, 0x04, 0x62, 0x62, 0x04, 0x08, 0x10,  // star destroyer
 0x4C, 0x52, 0x4C, 0x40, 0x5F, 0x44, 0x4A, 0x51,  // OK logo
};


void setup () 
{
  lcd.begin ();  

  // draw all available letters
  for (int i = ' '; i <= 0x7f; i++)
    lcd.letter (i);

  // black box  
  lcd.clear (6, 40, 30, 63, 0xFF);

  // draw text in inverse
  lcd.gotoxy (40, 40);
  lcd.string ("Nick Gammon.", true);

  // bit blit in a picture
  lcd.gotoxy (40, 56);
  lcd.blit (picture, sizeof picture);
  
  // draw a framed rectangle
  lcd.frameRect (40, 49, 60, 53, 1, 1);

  // draw a white diagonal line
  lcd.line (6, 40, 30, 63, 0);
    
}  // end of setup

void loop () 
{}  // nothing to see here, move along

Any help would be apreciated.
Thank you

Do you have a datasheet for your display?

i need lcd ym12864c library

Rintin:
Do you have a datasheet for your display?

No i don't have but i will ask the seller to provide me if they have.

The backlight turning on just means power and ground are hooked up correctly.

Use a script that scans for I2C devices to see if it can find the address of it.

https://retrolcd.com/Help/I2CFinder

The datasheet for your controller is found at

bkucenski:
The backlight turning on just means power and ground are hooked up correctly.

Use a script that scans for I2C devices to see if it can find the address of it.

RetroLCD

The datasheet for your controller is found at

http://ww1.microchip.com/downloads/en/devicedoc/20001952c.pdf

Thanks.
I will give a try.

bkucenski:
RetroLCD

The above scetch found I2C Device at 0X20

The first solution - try to turn by screwdriver the VR1 resistor on your LCD display

AnatoliiL:
The first solution - try to turn by screwdriver the VR1 resistor on your LCD display

Already tried this.
The first thing i did.
Nothing changed except the contract of the display.

Still no datasheet for the display?

Rintin:
Still no datasheet for the display?

seller provide me these sites to take a look

https://www.sunfounder.com/learn/Sensor-Kit-v2-0-for-Arduino/lesson-1-display-by-i2c-lcd1602-sensor-kit-v2-0-for-arduino.html

Lets see... the first link is for a character display with 16 pins, your display has 20 pins -> might be the wrong datasheet.

The second link... well my chinese is too bad. Failed to manage to download it.

The third link describes how to connect a character lcd with I2C.

I googled a bit. Your display might use the ST7920. Your example code is for a KS0108.

I expect the code to be incompatible and the same goes for the wireing.

Please check if your display really uses the ST7920. Check if PSB is configured for serial mode (see here)

Wire it up as SPI and try u8glib with this setup.

I would guess that it will be KS0108, T6963, ST7920. Other chips are available.

Modules tend to use a 20x1 pinout. #3 and #15-18 might have different functionality.

Compare the blob count, component layout etc with documented displays.

Yes, it might be an intellectual exercise. But you could buy a brand new ST7920 module that works with SPI straight out of the box. (and for about the same cost as your backpack)

David.

I bought the display first and then i get the expander to make my tests more easy.
As i see in u8glib i have to connect the display in my arduino UNO as:

8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16

or

SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17

What is the difference between these two connections?
I am familiar with this display.

Rintin:
Please check if your display really uses the ST7920. Check if PSB is configured for serial mode (see here)

Wire it up as SPI and try u8glib with this setup.

It is the same as type B in the above link.
I tried the same connections as in the picture but it is not working yet.
Only backlight.

I Googled "12864B V2.0" and found this ST7920 display from HobbyComponents.

So you have a ST7920 display. It works with SPI. U8g2lib supports it.

Always start with the SPI Software constructor. Run the examples.
Then try the Hardware constructor. (which means you have to use the correct hardware pins for SCK, MOSI)

I suggest you snip through the backpack pins if you have soldered them. Clean it up. Replace with a new male header. Put backpack away in a drawer.

If you have a problem, ask. The ST7920 works nicely with SPI. Only three GPIO pins. Much faster than any backpack.

Save your backpack in case someone gives you a KS0108 or T6963 for free. Never buy a new KS0108. They are not worth the bother.

David.

david_prentice:
I Googled "12864B V2.0" and found this ST7920 display from HobbyComponents.

So you have a ST7920 display. It works with SPI. U8g2lib supports it.

Always start with the SPI Software constructor. Run the examples.
Then try the Hardware constructor. (which means you have to use the correct hardware pins for SCK, MOSI)

I suggest you snip through the backpack pins if you have soldered them. Clean it up. Replace with a new male header. Put backpack away in a drawer.

If you have a problem, ask. The ST7920 works nicely with SPI. Only three GPIO pins. Much faster than any backpack.

Save your backpack in case someone gives you a KS0108 or T6963 for free. Never buy a new KS0108. They are not worth the bother.

David.

Thank you David for the info.
I will give a try and if i have any questions i will ask.

You have to connect the display correct with Arduino. Look at the attached scheme.

Using U8glib:

#include "U8glib.h"

//setup LCD display
U8GLIB_ST7920_128X64 u8g(13, 11, 10, U8G_PIN_NONE);

common loop method

void loop() {
// picture loop
u8g.firstPage();
do {
draw();
} while( u8g.nextPage() );
delay(500);
}

void draw(void) {
u8g.setFont(u8g_font_unifont);
u8g.drawStr(20, 20, "Hello");
}

Yes, I am sure that it still works with U8glib
Oliver recommends using U8g2lib

David.

After removing the expander and connect the display in my arduino UNO R3 as described in the link that David told i manage to do the display working.
Now it is time for my experiments.
Thank you all for your help and especialy David.