Pages: [1] 2   Go Down
Author Topic: 16x2 LCD question  (Read 1831 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everyone. This is my first project with Arduino. I'm trying to interface a standard 16-pin 16x2 LCD to my Duemilanove. It turns on, but that's it. I see only 1 row of blocks when I it powers up (shouldn't there be 2?) and I got the backlight and contrast to work.

I am powering the LCD with the 5V connection on the Arduino board, and the Arduino is powered by the USB. I tried both the LiquidCrystal and SerialDisplay examples w/ version 0020. I can't get anything to show up besides this one row of blocks. I've triple-checked the wiring - its exactly as it needs to be according to the example programs.

Has anyone else here solved this problem? Could it be a bad LCD or am I missing something obvious? Is there a 'start' button on the Arduino, or...?

Any help appreciated.
Mossen
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 74
Posts: 7256
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Show us your code and a few hi-res pics. We'll talk about your quadruple-checked circuits. If you checked it 3 times, it's time to get it checked by others.
Logged


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

Working in the dark here.... How did you deal with pin 5 of the LCD?

[Edit] It's barely four minutes since you posted and you've logged off already.  We could have had this solved by now.

Don
« Last Edit: February 28, 2011, 01:16:42 pm by floresta » Logged

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

No I'm still here. I don't have any way of making a hi-res photo, but I can describe what I have as its pretty simple.

LCD pin 1 -> Arduino GND
LCD pin 2 -> Arduino 5V
LCD pin 3 -> 10k wiper middle pin (the wiper also connected to 5V and GND)
LCD pin 4 -> Arduino digital 12
LCD pin 5 -> Arduino GND
LCD pin 6 -> Arduino digital 11
LCD 7-10 -> no connection
LCD pin 11 -> Arduino digital 5
LCD pin 12 -> Arduino digital 4
LCD pin 13 -> Arduino digital 3
LCD pin 14 -> Arduino digital 2
LCD pin 15 -> 10 ohm resistor then +5V (to bias the LCD contrast)
LCD pin 16 -> GND

That's it. The code I'm using is one of the examples from the LiquidCrystal library included with the Ardiuno software:


// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
}
« Last Edit: February 28, 2011, 01:41:22 pm by Mossen » Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 74
Posts: 7256
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Code looks right. We still need some sort of picture to make sure you're getting the right connections as you claimed. If you did and the display is a working unit, you'll see something on the display.

I insist a picture. There's no other way.
Logged


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

OK I made a schematic and took some pictures but my camera doesn't do so well on closeups - sorry this is the best I can do. At the top of the breadboard those are all grounded. The pins on my LCD are 1 on the left of the photo 16 on the right.






Thanks for any help!
Logged

Lancashire, UK
Offline Offline
Edison Member
*
Karma: 9
Posts: 1991
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Are the header pins that are plugged into the breadboard soldered to the LCD ?  They need to be.
Logged


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

Yeah, they are soldered to it.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 502
Posts: 19080
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Has anyone else here solved this problem? Could it be a bad LCD or am I missing something obvious? Is there a 'start' button on the Arduino, or...?

Excuse me for asking, but did you upload the sketch? And yes, one row of blocks is, from memory, what you get if there is no logic applied to the board. From your description, I would expect to see that if it was wired reasonably well, but for some reason instructions are not arriving to tell it to draw stuff.
Logged


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

Yes I have uploaded the sketch. The thing I'm not sure about is:

* when you upload the sketch, does it automatically start running?
* if a new sketch is uploaded, how does the LCD know to reset? I'm wondering if its stuck in a weird state, because the LCD still has power even while a new sketch is uploaded. So how would it know to receive new initialization commands and reset itself? And if you unplug the LCD, then upload the sketch, then plug it back in, the init commands won't even get there because its off during Arduino's init.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 502
Posts: 19080
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
when you upload the sketch, does it automatically start running?

Yes it does, but you can always hit the reset button on the board.

I always upload with the board plugged in. It might freeze but then the sketch should start, initialize the board, and then it should display stuff.
Logged


Central MN, USA
Offline Offline
Tesla Member
***
Karma: 74
Posts: 7256
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Connections look good to me. Have you tested your arduino before this, with blink?
Logged


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

A single row of blocks indicates that your LCD controller has not been correctly initialized.  This is almost always due to improper connections or improper programming.  I don't believe that I have ever run into a case where this problem was due to a bad LCD.

The current LiquidCrystal library has worked for everyone else so there is no reason to believe it won't work with your LCD.  You could have a bad copy so a fresh installation of the Arduino IDE might be in order.

You could also be doing something wrong in your upload/run procedure so you might try uploading the blinky sketch and see if that works.

Most likely the problem is due to improper wiring.  Your first photo is the kind of shot we need for this wiring evaluation.  Unfortunately it is not clear enough for us to easily check this out.  You should try some combination of neater wiring and different (more) colors for your wires.  If you can find a camera rather than a phone that will help too.

At this point your best bet would be to rip all the wires out and follow the tutorial at http://www.ladyada.net/learn/lcd/charlcd.html.  Make sure you do it step by step and make sure you get the contrast adjusted properly (about halfway through) before you go any further.



Don
Logged

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

Quote
So how would it know to receive new initialization commands and reset itself?
The current LiquidCrystal library includes a software reset for the LCD controller (many other LCD libraries don't) so the LCD controller will be reset each time the sketch runs, such as each time the Arduino is reset.

Quote
And if you unplug the LCD, then upload the sketch, then plug it back in, the init commands won't even get there because its off during Arduino's init.
Well you should unplug the Arduino after you load the sketch and before you plug the LCD back in.  When you reapply power to the Arduino / LCD combination everything should work properly.

Don
Logged

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

Thanks Don, I will start over with the Adafruit tutorial and report back...

Mossen
Logged

Pages: [1] 2   Go Up
Jump to: