Pages: [1] 2 3   Go Down
Author Topic: 16x2 LCD prints foreign letters?  (Read 2604 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have my LCD code, and wiring all right + the contrast pot, but when I print "hello" it has foreign symbols and filled in blocks of light.
Can anyone help me? If you need it, I will provide a picture.

I also used this tutorial to wire it up.
http://www.ladyada.net/learn/lcd/charlcd.html

Thanks.

Picture:
http://troll.ws/i/SCF2Cj.jpg
http://troll.ws/i/Y6tW5R.jpg
New Pictures:
http://troll.ws/i/a9ueT1.jpg
http://troll.ws/i/g6llkF.jpg
http://troll.ws/i/ONxMrR.jpg
http://troll.ws/i/Gb6r7S.jpg

Code:
Code:
//This is just the example hello world, but I changed the pins to what mine are set up to.
#include <LiquidCrystal.h>

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup() {
  lcd.begin(16, 2);
  lcd.print("hello, world!");
}

void loop() {
  lcd.setCursor(0, 1);
  lcd.print(millis()/1000);
}

« Last Edit: December 10, 2011, 05:54:18 pm by Ciehanski » Logged

Upstate NY
Offline Offline
Full Member
***
Karma: 2
Posts: 184
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No one can help you until you post decent pictures of your complete wiring/hardware, post the code you are using and include information regarding how you are powering the Arduino and LCD display.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Added the code, and will be putting more pictures up soon.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6637
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

1. You're constantly writing new data to the lcd in loop(). Try adding a 1 second delay in the loop.

2. That tutorial misses out one important thing. For most LCDs, you mustn't connect the backlight directly to +5v and ground, you need a series resistor. The LCD datasheet will give you the current rating and voltage drop, from which you can work out the resistor. If you don't have the datasheet, 100 or 150 ohms should be OK.

However, I'm not at all sure that either of these is the cause of your problem.
« Last Edit: December 10, 2011, 03:25:37 pm 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.

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

1. You're constantly writing new data to the lcd in loop(). Try adding a 1 second delay in the loop.

2. That tutorial misses out one important thing. For most LCDs, you mustn't connect the backlight directly to +5v and ground, you need a series resistor. The LCD datasheet will give you the current rating and voltage drop, from which you can work out the resistor. If you don't have the datasheet, 100 or 150 ohms should be OK.

However, I'm not at all sure that either of these is the cause of your problem.

I hooked up the power and ground to 150 OHM resistor, then to ground and power and all that good stuff. The backlight then didn't work and it still printed these weird symbols.
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 4409
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
1. You're constantly writing new data to the lcd in loop(). Try adding a 1 second delay in the loop.

Unfortunately that's the standard sketch supplied with the Arduino IDE and it's not likely that we can get them to change it.  The sketch does work as advertised but it seems like a piss poor idea to try to display changing data in a sketch that is almost always the very first one used by LCD neophytes.  I recommend the following:

Code:
...
void setup()
  {
  lcd.begin(16, 2);
  lcd.print("hello, world!");
  lcd.setCursor(0,1)
  lcd.print("it works!");
  }

void loop()
  {
  }

Quote
2. That tutorial misses out one important thing.
Yes and no...Actually the text part of the tutorial is quite specific about the need for a series resistor and tells exactly how to calculate the value.

"Next we'll connect up the backlight for the LCD. Connect pin 16 to ground and pin 15 to +5V through a series resistor. To calculate the value of the series resistor, look up the maximum backlight current and the typical backlight voltage drop from the data sheet. Subtract the voltage drop from 5 volts, then divide by the maximum current, then round up to the next standard resistor value. For example, if the backlight voltage drop is 3.5v typical and the rated current is 16mA, then the resistor should be (5 - 3.5)/0.016 = 93.75 ohms, or 100 ohms when rounded up to a standard value. If you can't find the data sheet, then it should be safe to use a 220 ohm resistor, although a value this high may make the backlight rather dim."

Unfortunately the accompanying photographs do not show the resistor because the LCDs sold on that site (at least at the time the tutorial was generated) already have the series resistor on the pc board and consequently do not need an external one.  This is one of the few flaws in that tutorial.


Quote
However, I'm not at all sure that either of these is the cause of your problem.
Actually it could very well be the cause of the problem.  The excessive current being drawn by the backlight has been known to draw down the power supply to the point where the LCD controller no longer works properly. 

Don
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 4409
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I hooked up the power and ground to 150 OHM resistor, then to ground and power and all that good stuff.
That isn't correct.  The resistor goes in place of the red wire that is shown connected to pin 15 in the Adafruit photos.  In other words, remove the red wire and replace it with the resistor.

Don
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I hooked up the power and ground to 150 OHM resistor, then to ground and power and all that good stuff.
That isn't correct.  The resistor goes in place of the red wire that is shown connected to pin 15 in the Adafruit photos.  In other words, remove the red wire and replace it with the resistor.

Don

Thanks, I will try that out.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay, I tried that, and once again the backlight receives no power at all when using a 100K or 150K OHM resistor.

Should I get a new LCD? If so from where?
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6637
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

Yes and no...Actually the text part of the tutorial is quite specific about the need for a series resistor and tells exactly how to calculate the value.

"Next we'll connect up the backlight for the LCD. Connect pin 16 to ground and pin 15 to +5V through a series resistor. To calculate the value of the series resistor, look up the maximum backlight current and the typical backlight voltage drop from the data sheet. Subtract the voltage drop from 5 volts, then divide by the maximum current, then round up to the next standard resistor value. For example, if the backlight voltage drop is 3.5v typical and the rated current is 16mA, then the resistor should be (5 - 3.5)/0.016 = 93.75 ohms, or 100 ohms when rounded up to a standard value. If you can't find the data sheet, then it should be safe to use a 220 ohm resistor, although a value this high may make the backlight rather dim."

Unfortunately the accompanying photographs do not show the resistor because the LCDs sold on that site (at least at the time the tutorial was generated) already have the series resistor on the pc board and consequently do not need an external one.  This is one of the few flaws in that tutorial.


That looks pretty close to the text I submitted as a correction a few weeks ago! Last time I looked, it hadn't been published.

...
Thanks, I will try that out.

That should fix the backlight, but not the original problem. My best guess is that your wiring is incorrect or you have some bad connections. I see you are using a socket strip to connect to the LCD. Are all the pins of it that you are using properly soldered to the LCD pads? Are you passing the Arduino pin numbers to the LiquidCrystal constructor in the correct order, corresponding to the way you have wired them to the LCD?


Okay, I tried that, and once again the backlight receives no power at all when using a 100K or 150K OHM resistor.

You need 100 or 150 ohms, not Kohms.
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.

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes and no...Actually the text part of the tutorial is quite specific about the need for a series resistor and tells exactly how to calculate the value.

"Next we'll connect up the backlight for the LCD. Connect pin 16 to ground and pin 15 to +5V through a series resistor. To calculate the value of the series resistor, look up the maximum backlight current and the typical backlight voltage drop from the data sheet. Subtract the voltage drop from 5 volts, then divide by the maximum current, then round up to the next standard resistor value. For example, if the backlight voltage drop is 3.5v typical and the rated current is 16mA, then the resistor should be (5 - 3.5)/0.016 = 93.75 ohms, or 100 ohms when rounded up to a standard value. If you can't find the data sheet, then it should be safe to use a 220 ohm resistor, although a value this high may make the backlight rather dim."

Unfortunately the accompanying photographs do not show the resistor because the LCDs sold on that site (at least at the time the tutorial was generated) already have the series resistor on the pc board and consequently do not need an external one.  This is one of the few flaws in that tutorial.


That looks pretty close to the text I submitted as a correction a few weeks ago! Last time I looked, it hadn't been published.

...
Thanks, I will try that out.

That should fix the backlight, but not the original problem. My best guess is that your wiring is incorrect or you have some bad connections. I see you are using a socket strip to connect to the LCD. Are all the pins of it that you are using properly soldered to the LCD pads? Are you passing the Arduino pin numbers to the LiquidCrystal constructor in the correct order, corresponding to the way you have wired them to the LCD?


Okay, I tried that, and once again the backlight receives no power at all when using a 100K or 150K OHM resistor.

You need 100 or 150 ohms, not Kohms.

Opps, I was using KOHMS. I'll try that too. And I soldered it pretty well, but I'm not too sure on the wiring correctly part. I'm new to all this.

The LCD Pins:
1 - To ground.
2 - To 5v
3 - To pot.
4 - To Arduino pin 7.
5 - To ground.
6 - To Arduino pin 8.
11 - To Arduino pin 9.
12 - To Arduino pin 10.
13 - To Arduino pin 11.
14 - To Arduino pin 12.
15 - To 5v.
16 - To ground.

The ones I skipped are not connected to anything. From that, is my wiring and LCD variable in the code all correct?
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 4409
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
15 - To 5v.
No.  To 5v through a 150 ohm resistor.

Don
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 4409
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
That looks pretty close to the text I submitted as a correction a few weeks ago! Last time I looked, it hadn't been published.
You have had better luck getting them to fix things than I have.  I recall that they made some major changes, mostly additions, to the tutorial recently and that's probably when your information got added.  I believe that they used to just mention that some other LCD modules needed an external resistor but theirs didn't.  I looked at their current 20x4 offering which specifies 4.2v / 180mA for the LED.  Their current 16x2 specifies 4.1v / 100mA.  This means that both need an external resistor.

Hopefully they will fix up the photos soon.  The one showing the single row of 'boxes' is still upside down.


Don
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
15 - To 5v.
No.  To 5v through a 150 ohm resistor.

Don


I changed that to a 150 OHM not KOHM resistor. Backlight now has power. But it still prints those weird symbols.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
That looks pretty close to the text I submitted as a correction a few weeks ago! Last time I looked, it hadn't been published.
You have had better luck getting them to fix things than I have.  I recall that they made some major changes, mostly additions, to the tutorial recently and that's probably when your information got added.  I believe that they used to just mention that some other LCD modules needed an external resistor but theirs didn't.  I looked at their current 20x4 offering which specifies 4.2v / 180mA for the LED.  Their current 16x2 specifies 4.1v / 100mA.  This means that both need an external resistor.

Hopefully they will fix up the photos soon.  The one showing the single row of 'boxes' is still upside down.


Don

Uploading the new photos now. It has the new resistor in there too. smiley
Logged

Pages: [1] 2 3   Go Up
Jump to: