hello world, white blocks

Hi everyone, tried the hello world example today from different tutorials but my lcd backlight display only shows white blocks. Double checked the wires so i don't think that's the problem. When i twist my pot to the max i see a line of white blocks, to the min just a blue screen but no text. Hope someone can help me further. Code:

#include <[color=#CC6600]LiquidCrystal[/color].h>

#include <[color=#CC6600]SPI[/color].h>

[color=#7E7E7E]/*[/color]
[color=#7E7E7E]  LiquidCrystal Library - Hello World[/color]
[color=#7E7E7E] [/color]
[color=#7E7E7E] Demonstrates the use a 16x2 LCD display.  The LiquidCrystal[/color]
[color=#7E7E7E] library works with all LCD displays that are compatible with the [/color]
[color=#7E7E7E] Hitachi HD44780 driver. There are many of them out there, and you[/color]
[color=#7E7E7E] can usually tell them by the 16-pin interface.[/color]
[color=#7E7E7E] [/color]
[color=#7E7E7E] This sketch prints "Hello World!" to the LCD[/color]
[color=#7E7E7E] and shows the time.[/color]
[color=#7E7E7E] [/color]
[color=#7E7E7E]  The circuit:[/color]
[color=#7E7E7E] * LCD RS pin to digital pin 12[/color]
[color=#7E7E7E] * LCD Enable pin to digital pin 11[/color]
[color=#7E7E7E] * LCD D4 pin to digital pin 5[/color]
[color=#7E7E7E] * LCD D5 pin to digital pin 4[/color]
[color=#7E7E7E] * LCD D6 pin to digital pin 3[/color]
[color=#7E7E7E] * LCD D7 pin to digital pin 2[/color]
[color=#7E7E7E] * LCD R/W pin to ground[/color]
[color=#7E7E7E] * 10K resistor:[/color]
[color=#7E7E7E] * ends to +5V and ground[/color]
[color=#7E7E7E] * wiper to LCD VO pin (pin 3)[/color]
[color=#7E7E7E] [/color]
[color=#7E7E7E] Library originally added 18 Apr 2008[/color]
[color=#7E7E7E] by David A. Mellis[/color]
[color=#7E7E7E] library modified 5 Jul 2009[/color]
[color=#7E7E7E] by Limor Fried (http://www.ladyada.net)[/color]
[color=#7E7E7E] example added 9 Jul 2009[/color]
[color=#7E7E7E] by Tom Igoe[/color]
[color=#7E7E7E] modified 22 Nov 2010[/color]
[color=#7E7E7E] by Tom Igoe[/color]
[color=#7E7E7E] modified 12 Feb 2012[/color]
[color=#7E7E7E] by Juan Hernandez[/color]
[color=#7E7E7E] [/color]
[color=#7E7E7E] This example code is in the public domain.[/color]

[color=#7E7E7E] http://www.arduino.cc/en/Tutorial/LiquidCrystal[/color]
[color=#7E7E7E] */[/color]

[color=#7E7E7E]// include the library code:[/color]
#include <[color=#CC6600]LiquidCrystal[/color].h>

[color=#7E7E7E]// initialize the library with the number of the sspin [/color]
[color=#7E7E7E]//(or the latch pin of the 74HC595)[/color]
[color=#CC6600]LiquidCrystal[/color] lcd(9);

[color=#CC6600]void[/color] [color=#CC6600][b]setup[/b][/color]() {
  [color=#7E7E7E]// set up the LCD's number of columns and rows: [/color]
  lcd.[color=#CC6600]begin[/color](16, 2);
  [color=#7E7E7E]// Print a message to the LCD.[/color]
  lcd.[color=#CC6600]print[/color]([color=#006699]"hello, world!"[/color]);
}

[color=#CC6600]void[/color] [color=#CC6600][b]loop[/b][/color]() {
  [color=#7E7E7E]// set the cursor to column 0, line 1[/color]
  [color=#7E7E7E]// (note: line 1 is the second row, since counting begins with 0):[/color]
  lcd.[color=#CC6600]setCursor[/color](0, 1);
  [color=#7E7E7E]// print the number of seconds since reset:[/color]
  lcd.[color=#CC6600]print[/color]([color=#CC6600]millis[/color]()/1000);
}

you might post some information about the LCD used as there are zillions...

sorry about that, this one: http://www.ebay.com/itm/321359227320?_trksid=p2060778.m2749.l2649&var=510251989251&ssPageName=STRK%3AMEBIDX%3AIT hope that helps !

looks like this one - https://www.sparkfun.com/datasheets/LCD/ADM1602K-NSA-FBS-3.3v.pdf -

It says that for the backlight you need to use pin 15 and 16...
don't know if that is also true for your LCD. ( you might give it a try.
Be aware that a LED need a resistor in series

Ok, rewired to that pdf. Using a breadboard btw. Also tried other sketch:

/* YourDuino.com Example Software Sketch
16 character 2 line I2C Display
NEW TYPE Marked "Arduino-IIC-LCD GY-LCD-V1"
terry@yourduino.com */
/*-----( Import needed libraries )-----*/ 
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>  // F Malpartida's NewLiquidCrystal library

/*-----( Declare Constants )-----*/
#define I2C_ADDR    0x20  // Define I2C Address for the PCF8574A 
//---(Following are the PCF8574 pin assignments to LCD connections )----
// This are different than earlier/different I2C LCD displays
#define BACKLIGHT_PIN  7
#define En_pin  4
#define Rw_pin  5
#define Rs_pin  6
#define D4_pin  0
#define D5_pin  1
#define D6_pin  2
#define D7_pin  3

#define  LED_OFF  0
#define  LED_ON  1

/*-----( Declare objects )-----*/  
LiquidCrystal_I2C  lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup()   /*----( SETUP: RUNS ONCE )----*/
{
 lcd.begin (16,2);  // initialize the lcd 
// Switch on the backlight
 lcd.setBacklightPin(BACKLIGHT_PIN,NEGATIVE);
 lcd.setBacklight(LED_ON);
}// END Setup

void loop()   /*----( LOOP: RUNS OVER AND OVER AGAIN )----*/
{

// Reset the display  
 lcd.clear();
 delay(1000);
 lcd.home();
 
// Print our characters on the LCD
 lcd.backlight();  //Backlight ON if under program control
 lcd.setCursor(0,0); //Start at character 0 on line 0
 lcd.print("Hello, world!");
 delay(1000);
 lcd.setCursor(0,1); //Start at character 0 on line 1
 lcd.print("16 by 2 Display");
 delay(8000);
} // END Loop

Wires:

Display Pin 1 -> breadboard -
Display Pin 2 -> breadboard +
Display Pin 3 -> pot center
Display Pin 4 -> arduino pin 6
Display Pin 5 -> arduino pin 5
Display Pin 6 -> arduino pin 4
Display Pin 7 -> not used
Display Pin 8 -> not used
Display Pin 9 -> not used
Display Pin 10->not used
Display Pin 11->arduino pin 0
Display Pin 12->arduino pin 1
Display Pin 13->arduino pin 2
Display Pin 14->arduino pin 3
Display Pin 15->breadboard +
Display Pin 16->breadboard -

Also + and min rail of the breaboard are connected to the + and - of the pot.

Hope that's clear.

moderator: added code tags

Ok, rewired to that pdf. Using a breadboard btw. Also tried other sketch:

and did it work?

Sorry, no, the same result. White blocks with pot to max and just blue screen with pot to min

Well you have me confused.

  • Your original post includes code that implies that an SPI interface is being used.
  • Your reply #2 gives a link to a device with a normal parallel interface.
  • Your reply #4 includes code that implies that an I2C interface is being used.

So which is it?

If it is a normal parallel interface then try this simple sketch:

#include <LiquidCrystal.h>

//LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);      // put your pin numbers here

void setup()
  {
  lcd.begin(16, 2);                          // put your LCD parameters here
  lcd.print("hello, world!");
  lcd.setCursor(0,1);
  lcd.print("it works!");
  }

void loop()
  {
  }

Also: go back to your original post and change the 'quote' tags to 'code' tags.

Don

P.S. I see that you are using digital pins 0 and 1. This really isn't a good idea since they are also being used to (attempt to) upload your code.

P.P.S. I keep on finding more. It looks like you are connecting pin 5 (R/W) to the Arduino. This means that your LiquidCrystal.lcd(...) statement must have seven parameters. It's easier to just connect pin 5 to GND.

Also your contrast pot should be in the middle roughly.

The R/W signal should be grounded otherwise you can't write to the LCD.

ChilliTronix:
Also your contrast pot should be in the middle roughly.

The R/W signal should be grounded otherwise you can't write to the LCD.

Neither of these is actually correct.

The optimum contrast voltage is typically around 0.5 volts which would put a linear potentiometer roughly at 10% of it's travel.

Although the R/W pin is typically grounded it can also be correctly handled by the LiquidCrystal library if you use the correct constructor (I dealt with both of these techniques in the P.P.S. of my previous post).

Don.

I have a Sparkfun LCD as well as the ones we sell, and the Sparkfun provided pot seems to be turned around half way to get the contrast I like for both sorts.

Yes the LCD library can handle it, but then if you ground it, you do remove the R/W pin as an issue.

Sorry for mixing 2 codes, this is all very, very new to me. If you told me last year i would get into electronics and i would like it i would have laught :). This being said, i've tried floresta's sketch, code:

#include <[color=#CC6600]Wire[/color].h>

#include <[color=#CC6600]LiquidCrystal[/color].h>

[color=#7E7E7E]//LiquidCrystal lcd(RS, E, D4, D5, D6, D7);[/color]
[color=#CC6600]LiquidCrystal[/color] lcd(7, 8, 9, 10, 11, 12);      [color=#7E7E7E]// put your pin numbers here[/color]

[color=#CC6600]void[/color] [color=#CC6600][b]setup[/b][/color]()
  {
  lcd.[color=#CC6600]begin[/color](16, 2);                          [color=#7E7E7E]// put your LCD parameters here[/color]
  lcd.[color=#CC6600]print[/color]([color=#006699]"hello, world!"[/color]);
  lcd.setCursor(0,1);
  lcd.[color=#CC6600]print[/color]([color=#006699]"it works!"[/color]);
  }

[color=#CC6600]void[/color] [color=#CC6600][b]loop[/b][/color]()
  {
  }

I had to include wire.h because it gave an error when uploading otherwise.

Wires are connected as following:

Display Pin 1 -> breadboard -
Display Pin 2 -> breadboard +
Display Pin 3 -> pot center
Display Pin 4 -> arduino pin 7
Display Pin 5 -> breadboard gnd
Display Pin 6 -> arduino pin 8
Display Pin 7 -> not used
Display Pin 8 -> not used
Display Pin 9 -> not used
Display Pin 10->not used
Display Pin 11->arduino pin 9
Display Pin 12->arduino pin 10
Display Pin 13->arduino pin 11
Display Pin 14->arduino pin 12
Display Pin 15->breadboard +
Display Pin 16->breadboard -

Also + and min rail of the breaboard are connected to the + and - of the pot.

Still white blocks though.

Again, thanks for all your advice, really learning alot here...

Stupid comment maybe but could this problem occur because i didn't solder the pins to the lcd display? I figured if it lights up then connections are ok or am i wrong here?

Ah... how are you connecting to the LCD if you have not soldered some headers in?

Pins in the breadboard and lcd slides over them. With the light on and the pot ok I figured it was good

Ah. You may not be getting all the wires connected. I would suggest soldering the pins to the board.

Ok, will try that but need to buy it first so I'll be back with the result.

cool.

Stupid comment maybe but could this problem occur because i didn't solder the pins to the lcd display? I figured if it lights up then connections are ok or am i wrong here?

You are wrong here!

The backlight appears to work correctly even though it's connections may be intermittent due to the lack of solder because your eyes and brain don't work fast enough to catch the outages.

The LCD controller on the other hand does work fast enough to be mixed up by any intermittent connections and hence will not function correctly.

I had to include wire.h because it gave an error when uploading otherwise.

Then you have another problem in your implementation of the IDE. Something is missing or misplaced.

Don

Don--

I'm not entirely sure, but I think the OP is still using the F. Malpartida library which he used when he was trying to use an i2c interface to his lcd. (post#4)

He is just using the parallel portion LiquidCrystal.h but it still requires Wire.h.