Go Down

### Topic: Liquid crystal problem (Read 6235 times)previous topic - next topic

#### liuzengqiang

#15
##### Feb 07, 2011, 08:30 pm
Ok, sorry I thought you didn't. So here is what you found, with lcd.begin(16,2), there is no text however you turn the potentiometer? Right?
Do you have a multimeter? Measure the voltage on the middle pin of the potentiometer AS YOU TURN. Any change in voltage?

#### shebu_18

#16
##### Feb 07, 2011, 08:39 pm
All is normal. At one end 0,012V at the other 5V and in between i get 1.2 or 2.3 or 3.4. So it's ok.

#### floresta

#17
##### Feb 08, 2011, 12:35 am
Quote
All is normal. At one end 0,012V at the other 5V and in between i get 1.2 or 2.3 or 3.4. So it's ok.

Is this measured at the potentiometer or at the display (you could have a bad connection).  You typically want less than 1 volt, frequently only 0.3v.  Perhaps some nice clear, in focus, photographs would help us spot something we haven't thought about.  They must be shot straight down so we can see the display and both ends of all the interconnecting wires.

Don

#### shebu_18

#18
##### Feb 08, 2011, 09:42 amLast Edit: Feb 08, 2011, 12:11 pm by Shebu Reason: 1

Quote
All is normal. At one end 0,012V at the other 5V and in between i get 1.2 or 2.3 or 3.4. So it's ok.

Is this measured at the potentiometer or at the display (you could have a bad connection).  You typically want less than 1 volt, frequently only 0.3v.  Perhaps some nice clear, in focus, photographs would help us spot something we haven't thought about.  They must be shot straight down so we can see the display and both ends of all the interconnecting wires.

Don

Measured at the display.

LE: Added the pictures. The problem is with the library. I still don't understand how the 4 data pins can influence the contrast. I could eliminate the trimmer by putting the contrast directly to gnd.

#### floresta

#19
##### Feb 08, 2011, 12:25 pm
Quote
The problem is with the library.

It's more likely that the problem is with the LCD module.

Don

#### jrraines

#20
##### Feb 09, 2011, 12:09 am
I note the late edit to your first post that the same issue arises with a 20x4 LCD. That makes it unlikely that the problem is with the LCDs.
I notice that you have a Mega. What I do with my Mega is plug the LCD in directly; Pin 1 (GND) goes into the GND next to socket 53, pin 2 into socket 53.( I use this with a bit of a kludge for the contrast pin either a 1000 ohm resistor bridged to ground or solder stackable header onto the first 3 pins and plug a contrast pot in directly.) In your case, you are only seeing anything when you pull contrast all the way to ground, so I added a couple of lines to ground the contrast pin. It is hard to have wiring issues this way. You could still have a solder bridge I suppose.

I stripped some stuff out of working code to make it simpler, so I haven't run exactly this, but it should be trivial to plug your LCDs in as described above and try it.
Code: [Select]
` #include <LiquidCrystal.h> LiquidCrystal lcd(49,47,45, 35,33,31,29); void setup() {   int BACKLIGHT = 27;    // pin 27 will control the backlight I check current on the backlight in the datasheet before I solder pins there!  int BACKLTGND = 25;    // PIN 25 will be set LOW to provide a Gnd for the backlight  int POWER5V = 53;      // we will set this HIGH to provide power on pin 2 of the LCD  int GNDMain = 255;      // next to pin 53 (in the pin "55" position) is a GND--pin 1 of the LCD goes there   pinMode(POWER5V, OUTPUT);          //We're using a digital out as a 5V power source for the LCD    digitalWrite(POWER5V, HIGH);   pinMode (GNDMain, OUTPUT);   digitalWrite(GNDMain, LOW); //be sure the current draw on the backlight is less than 40 mAmps before you uncomment these 4 lines //  pinMode(BACKLIGHT, OUTPUT);        //set 255 if you need to wire backlight to gnd bo high current draw//   digitalWrite(BACKLIGHT, HIGH);     // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off.//   pinMode(BACKLTGND, OUTPUT);        //We're using a digital out as a GND for the backlight//   digitalWrite(BACKLTGND,LOW); //what the heck your contrast only showed something when you pulled it to ground anyway:pinMode(51,OUTPUT);digitalWrite(51,LOW); //ground the contrast pin  lcd.begin(16,2);lcd.setCursor(0,0);lcd.print("Hello World!");lcd.setCursor(0,1);lcd.print("hello Mega!"); } void loop() {}`

There is a version of LiquidCrystal with better timing on some of the delays at http://code.google.com/p/liquidcrystal440/
I do not think your problem sounds like any of the things I saw with bad timing however.

#### floresta

#21
##### Feb 09, 2011, 01:46 am
A late edit (or any edit after an subsequent post) is a bad idea because only new readers are likely to notice it.  When you respond to an Email notice of a forum reply it takes you directly to the end of the thread, not the beginning.

We still haven't seen a usable photograph of the wiring or of the actual characters being displayed so it's pretty much a shot in the dark.  Everything the OP has said still leads me to believe that it is likely to be a contrast issue.  Since the message (or at least the first line) is visible the basic wiring and the timing must be OK.  We still don't really know if he is using the begin function and we don't know what the display really looks like.  It could also be a backlight issue since some displays aren't too visible without proper backlighting.  That 220 ohm resistor would be suitable for a single LED connected to a 5v supply but most backlights use several LEDs in a series/parallel combination and use a lot smaller resistor.  Some even have the proper resistor on-board and do not require an external resistance.

Don

#### lawleo

#22
##### Feb 26, 2012, 05:11 pmLast Edit: Feb 26, 2012, 05:15 pm by lawleo Reason: 1
I have the same problem... the display contrast is very low until I remove the lcd.begin(16,2) line.

The LCD I am using is WM-C1602N and datasheet here.
http://www.datasheet4u.net/datasheet/W/M/C/WMC1602N_ETC.pdf.html

any solution for this issue?

#### floresta

#23
##### Feb 26, 2012, 09:35 pm
Quote
I have the same problem... the display contrast is very low until I remove the lcd.begin(16,2) line.

The answer is in reply #4.  Have you followed the suggestion I posted there?

Don

Go Up