Pages: [1] 2   Go Down
Author Topic: LCD 128x64 ST7920 using u8glib  (Read 8803 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 111
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Hi to all!

I'm testing my new LCD, a 128x64 with controller ST7920, (model 12864ZW). I've wired it as follow on my arduino:

PIN 1 on LCD [VSS] to Ground
PIN 2 on LCD [VDD] to 5V (via ardiuno)
PIN 4 on LCD [RS] to D10 (arduino)
PIN 5 on LCD [R/W] to D11 (arduino)
PIN 6 on LCD [E] to D13 (arduino)
PIN 15 on LCD [PSB] to Ground

I've opened the "Hello World" example code on the u8glib library and enabled the following line for the communication:

Code:
U8GLIB_ST7920_128X64 u8g(13, 11, 10, U8G_PIN_NONE); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10

Now, I can see the "Hello World" example but it's really really dark and difficult to see. It's up to insufficient power? O do I need to set-up/wire something other? (contrast?)
The power is supplied by the 5V PIN on Arduino connected on USB PC. I've tried to use an USB adapter (220V->5V (1A) ) but with the same result.

What's wrong?

Thank's a lot!

Simon

hello world example:

Code:
#include "U8glib.h"

// setup u8g object, please remove comment from one of the following constructor calls

U8GLIB_ST7920_128X64 u8g(13, 11, 10, U8G_PIN_NONE);                  // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 0

void draw(void) {
  // graphic commands to redraw the complete screen should be placed here 
  u8g.setFont(u8g_font_unifont);
  //u8g.setFont(u8g_font_osb21);
  u8g.drawStr( 0, 22, "Hello World!");
}

void setup(void) {
 
  // flip screen, if required
  // u8g.setRot180();
 
  // set SPI backup if required
  //u8g.setHardwareBackup(u8g_backup_avr_spi);

  // assign default color value
  if ( u8g.getMode() == U8G_MODE_R3G3B2 )
    u8g.setColorIndex(255);     // white
  else if ( u8g.getMode() == U8G_MODE_GRAY2BIT )
    u8g.setColorIndex(3);         // max intensity
  else if ( u8g.getMode() == U8G_MODE_BW )
    u8g.setColorIndex(1);         // pixel on
}

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

Logged

Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1443
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

Usually a ST7920 display requires an adjustable power supply at a pin which is often labled as V0 to setup the contrast. See the datasheet of your display. A variable 10K resistor usually is fine for this.

See schematic of the datasheet here: http://www.newhavendisplay.com/nhd19232wgbtmivtnonstocked-sample-quantities-available-p-546.html

Oliver
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 111
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


This is exactly the model I've purchased:

http://www.ebay.com/itm/1PCS-12864-128X64-Dots-Graphic-Matrix-LCD-Module-Display-LCM-Blue-Backlight-/261034188078?ssPageName=ADME:L:OC:IT:3160

Do you mean I should connect V0, also PIN3, to the Arduino 5V but passing trought a 10K resistor (or potentiometer)? It's clear I'm a beginner smiley-wink

Thank's for the help, Simon
Logged

Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1443
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Simon

Put the wiper of a variable 10K pot to V0, one end to VSS (ground) and the other end to VOUT of the display.
Adjust the variable potentiometer to get optimal result.

Oliver
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 111
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Thank you, I'll try it out and let you know!

Simon
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 111
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi again!

It doesn't work smiley-sad Let me say again how I've connected it:
First I've tested the POT if it's working: I've taken a POT, connected one side on V5, the other pin on ground. Then, checking the central pin I can read / control Volts between 0 and 5.2, simply turning the shaft pot.
So this should confirm the pot is OK.
Then I've connected all as follow:

PIN 1 on LCD [VSS] to Ground
PIN 2 on LCD [VDD] to 5V (powered by ardiuno)
PIN 3 on LCD [V0] to middle pin of the POT
PIN 4 on LCD [RS] to D10 (arduino)
PIN 5 on LCD [R/W] to D11 (arduino)
PIN 6 on LCD [E] to D13 (arduino)
PIN 15 on LCD [PSB] to Ground
PIN 18 on LCD [VOUT] to PIN3 Pot

Pot:

PIN 1 to 5V (powered by arduino)
PIN 2 to PIN 3 on LCD [V0]
PIN 3 to PIN 18 on LCD [VOUT]

I've tried to read Volts on PIN 2 of the Pot, but it's always to zero, even if I turn shaft pot.
Is there a way to check if the LCD is at least working? I.e. connecting it in a way to power it totally on ; or read some Volts on some pins of the LCD... I dunno...

Suggestions?

And what are PIN 19 [BLA] (Backlight power supply positive) and PIN 20 [BLK] (Backlight power supply negative)?

Thank's for the help!

Simon
Logged

Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1443
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
PIN 1 to 5V (powered by arduino)
PIN 2 to PIN 3 on LCD [V0]
PIN 3 to PIN 18 on LCD [VOUT]

should be:
PIN 1 to GND
PIN 2 to PIN 3 on LCD [V0]
PIN 3 to PIN 18 on LCD [VOUT]


Quote
And what are PIN 19 [BLA] (Backlight power supply positive) and PIN 20 [BLK] (Backlight power supply negative)?
I assume, that this will turn on backlight.

Oliver
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It sounds like you need to power the backlight. Unless you can establish that your display already includes a backlight series resistor, I suggest you connect a resistor of at least 47 ohms in series with it when connecting it to a 5V supply.

To see whether you need to connect a contrast adjustment potentiometer, look on the back of the display and see if there is already a tiny potentiometer there.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 111
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


I think it's better to show you directly a picture of the LCD, maybe you can help me better.

Thank's, Simon


* front.jpg (238.69 KB, 1382x921 - viewed 212 times.)

* back.jpg (451.13 KB, 1632x1224 - viewed 317 times.)
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

From the photo of the back I can see that your display does not have a contrast pot fitted (it would be at the position marked VR1 if it did). So you do need to provide one yourself.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 111
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, well, then how should I connect the pot in my case? Not the way I've descrived before? I'm a little confused :-)

Thank's a lot for your help!

Simon

Ps @olikraus: I've seen your answer only now, sorry. I'll try the way you suggested too! Still confused about backlight.
« Last Edit: November 25, 2012, 05:00:08 pm by X3fil » Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 111
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Step forward smiley

Now I was able to turn backlight on simply as follow:

PIN 19 [BLA] to 5V
PIN 20 [BLK] to Ground

So the backlight turns on and I can see much, much better!

PINS CONNECTIONS:

PIN 1 on LCD [VSS] to Ground
PIN 2 on LCD [VDD] to 5V (powered by ardiuno)
PIN 3 on LCD [V0] to middle pin of the POT
PIN 4 on LCD [RS] to D10 (arduino)
PIN 5 on LCD [R/W] to D11 (arduino)
PIN 6 on LCD [E] to D13 (arduino)
PIN 15 on LCD [PSB] to Ground
PIN 18 on LCD [VOUT] to PIN3 Pot (*)
PIN 19 on LCD [BLA] to 5V
PIN 20 on LCD [BLK] to Ground

Pot:
PIN 1 to 5V (powered by arduino)
PIN 2 to PIN 3 on LCD [V0]
PIN 3 to PIN 18 on LCD [VOUT]

(*)
tested also: In this way I can register 0-5.2V on PIN 2 of POT
Pot:
PIN 1 to 5V (powered by arduino)
PIN 2 to PIN 3 on LCD [V0]
PIN 3 to Ground


Now I miss how to adjust the contrast. The solutions proveded doesn't work, even if it's not so important. The backlight has helped very much!

If someone has another idea smiley

TY

Simon
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Try connecting the pot like this:

 Pins 1, 2 to Vo
 Pin 3 to Vout

assuming pin 2 is the wiper. Use a 10K pot. That's how it is shown on the data ST7920 sheet.

Don't connect 5V directly across the BLA and BLK backlight pins unless you have established that there is a series resistor on the display. To do this, use a multimeter to measure the resistance between the BLA edge connector pin and the K connection on the side of the board, and between BLA and A.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 111
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try connecting the pot like this:

 Pins 1, 2 to Vo
 Pin 3 to Vout

assuming pin 2 is the wiper. Use a 10K pot. That's how it is shown on the data ST7920 sheet.

I'm using a 10k pot, but nothing. As suggested it's:

PIN 1 to PIN 3 on LCD [V0]
PIN 2 to PIN 3 on LCD [V0]
PIN 3 to PIN 18 on LCD [VOUT]

Doesn't work.

Don't connect 5V directly across the BLA and BLK backlight pins unless you have established that there is a series resistor on the display. To do this, use a multimeter to measure the resistance between the BLA edge connector pin and the K connection on the side of the board, and between BLA and A.

Well. I'm a beginner, using the multimeter too.. I've set the multimeter to OHM (Ω) 2K and I can read these values:
Between BLK and K = 0.010
Between BLA and A = 0.020

So does it means it has series resistor and I don't need anything to connect it directly to 5V?

Thank's

Simon
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If it's a 3.5-digit multimeter on the 2K range, then the 0.010 and 0.020 readings mean 10 and 20 ohms. The backlight has 30 ohms series resistance already, which is fairly typical for running fro 5V, and you don't need an external series resistor.

I just checked my own display, and it also has 10 and 20 ohm series resistors.

EDIT: looking at your photo of the back of the board, you have exactly the same board that I do, except that my board has a pot at position VR1 and doesn't have the 0 ohm resistor at position R6. You can see the 10 and 20 ohm series resistors, they are R13 and R14.
« Last Edit: December 01, 2012, 10:15:40 am by dc42 » Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Pages: [1] 2   Go Up
Jump to: