Go Down

Topic: glcd from dx.com (Read 878 times) previous topic - next topic

pazgal

Hi,

I've bought this glcd : http://dx.com/p/5v-3-2-lcd12864-screen-module-with-backlit-yellow-green-screen-english-word-stock-121820
It's very hard to find what kind of hardware it is...
On this site you can see the pins. (http://skyduino.wordpress.com/2012/05/25/arduino-ecran-lcd12864-dealextreme-pas-chere-et-puissant/)

I'm using a arduino Mega 2530.

My hardware connexion is :
1 -> gnd
2 -> 5V
3 -> ~3V
4 -> pin 53 (CS)
5 -> pin 51 (MOSI)
6 -> pin 52 (SCLK)
15 -> Gnd (for SPI mode)
19 -> 3.3V (Backlight anode)
20 -> gnd (Backlight cathode)

I've tried the helloworld example from the u8glib :

Code: [Select]

#include "U8glib.h"
U8GLIB_ST7920_128X64_4X u8g(52, 51, 53);

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);
}


The backlght led shines correctly but there is no "helloworld"...
Does someone know what's wrong ?

Thanks for help

pyrotuc

have you tried looking up the driver chip to see if it is compatible? have you tried to adjust the display contrast with a pot rather than connecting it to a 3v3 pin? youll probably want a series resistor in there, and definitely one for the backlight, again, id recommend a pot. 10k works well for me. connect the two outside pins to v+ and v- and the wiper to the contrast pin.

using analogWrite(pin, 50); worked well for me on a 16x2 lcd, connecting the contrast pin to a pwm/analog pin instead of a pot. values above 100 were not useful IIRC. as for the backlight, its pretty linear with the brightness.

olikraus

I did a small review on the wiring. It seems to be ok. However, as mentioned in the previos comment, there could be a contrast issue: I suggest to use a variable potentiometer.

One end to VOUT
Other end to VSS (GND)
Wiper to V0

Oliver

pazgal

Thanks for help,

I've tried this :
Code: [Select]
for (int brightness = 0; brightness < 255; brightness++) {
      analogWrite(3, brightness);
      delay(3);
}

So I can see all values for the contrast. It works well.

BUT I don't see the "Helloworld" :-(

Is the call of the u8glib ok ? I have tried those :
Code: [Select]
U8GLIB_ST7920_128X64_1X u8g(52, 51, 53);
//OR
U8GLIB_ST7920_128X64_4X u8g(52, 51, 53);

I don't understand the difference but with both of them my glcd don't want to say hello...

Am I right with the 52, 51, 53 pins ?

Thanks

olikraus

Quote
Am I right with the 52, 51, 53 pins ?

I did not see a mistake here.

Quote
analogWrite(3, brightness);

I do not think that this will work at all. The contrast pin of the LCD often requires a voltage outside the range of 0..5V. This can not be generated by analogWrite(). Use a var. pot. instead!

Oliver

pazgal

I live on a Island called Mayotte where a pot. is hard to find ! ;-)
The post service are very slow (approx. 3 month to get my glcd from dx after shipping)

I've tried to connect the contrast to 0, 3.3V, 5V and differents values that I made with some resistances.
I can assure you the at 3.3V and 5V the contrast is very high.

I realy think that my problem is not here... :-(
Thanks.

olikraus

Ok, i see your problem. Nevertheless: Please measure the voltage at Vout. If it is negative you will probably need two suitable resistors to get the correct negative voltage which must be applied to v0.

In general: By applying some different voltage, you must be able to see and not see all the pixel.

If all this is ok, then another idea is to send a picture of your setup, so we can have a look at it.

Oliver

Go Up