3

I am using the following wiring diagram from a tutorial. I need to follow this configuration because later tutorials build on this example. I have looked at other solutions, but they follow a different pattern and I am still learning, so don't have the sophistication to adapt. I've looked at:

Hacktronics StackExchange

The picture shows Freeduino, but I am using an Arduino Uno (does that make a difference?) Connection Diagram

Here is the code I am using:

#include <LiquidCrystal.h>
int rs = 3;
int enable = 4;
int d4 = 5;
int d5 = 6;
int d6 = 7;
int d7 = 8;

int rows = 2;
int cols = 16;
LiquidCrystal lcd (3, 4, 5, 6, 7, 8);

void setup() {
  // put your setup code here, to run once:
  pinMode (rs, OUTPUT);
  pinMode (enable, OUTPUT);
  pinMode (d4, OUTPUT);
  pinMode (d5, OUTPUT);
  pinMode (d6, OUTPUT);
  pinMode (d7, OUTPUT);
  lcd.begin(cols, rows);
  lcd.clear();
}

void loop() {
  // put your main code here, to run repeatedly:
  lcd.setCursor(0,0);
  lcd.print("Hello World");
  delay(1000);
  lcd.setCursor(0,1);
  lcd.print("Goodbye World");
  delay(1000);
}

Unfortunately, I am getting a blank screen (it is lit up, but blank). So questions:

  1. Is the diagram correct?

  2. Is the code the problem?

  3. What else should I look for?

  • 1
    Change the contrast – Gerben Sep 10 '16 at 7:57
  • Can I change the contrast in the code? Turning the screw on the pot doesn't seem to have any effect. – Chiwda Sep 10 '16 at 15:35
  • 2
    Remove all the connections to the display except for power ground and contrast. Then power it on and turn the pot till you see a row of black blocks on the first line and nothing on the second line. – Gerben Sep 10 '16 at 15:59
  • 1
    In my experience, contrast can mess pretty bad. I spend days to look for "why my LCD goes blank", thinking there is something wrong with my code. Turns out the characters appear when I change the contrast – dhimaspw Nov 11 '16 at 7:10
1

1) Diagram seems to be fine. However we don't see pin numbering on LCD. Sometimes pins are like: 15 16 1 2 3 4 ... 14 (at least pin 1 is usualy marked).

2) Library should take care of inputs or outputs. So you can remove pinModes for them. Also change variables to constant variables and use them for lcd initialization: LiquidCrystal lcd(rs, enable, d4, d5, d6, d7);

3) Potentiometer in diagram is contrast setting. You have to preset correct value for it. Start with everything is black and find value where this black is almost invisible. If you've something displayed on LCD, it would be even easier to find right position as text just shows up.

Edit: I've just tested it and it's working fine. With the same wiring and contrast pot adjusted to the right position

  • Pins are numbered 16...1 left to right. – Chiwda Sep 10 '16 at 14:25
1

Check the voltage. your LCD should get 5v to work properly.

if you are powering it through your computer USB, Arduino could be outputting less than 5v.

PS: it happened to me yesterday.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.