LCD not displaying characters properly

I wanted to display 'Hello World' on the JHD 126A LCD but it is not displaying characters properly when connected to the Arduino Nano. I have tried everything from checking the connection several times to changing the whole circuit but the same thing keeps appearing on the LCD screen again and again. I can't figure out the fault in the circuit. Please help me in resolving this problem.
Here's the code:

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
    lcd.begin(16, 2);
}

void loop() {
lcd.setCursor(0, 1);
    lcd.print("HELLO WORLD!")
}

TheRoboticM:
the same thing keeps appearing on the LCD screen

And what is that thing?

First mistake:

You have put two instructions in loop() which will be repeated extremely rapidly causing a flickering display. Move those instructions from loop() (leave it empty) and put them as the last in setup().

Then tell us what is displayed. If it is anything other than "HELLO WORLD!" then we want a photograph of your setup.

We give Karma for posting code properly in your first post.

I wanted to display 'HELLO WORLD' on both the lines on the JHD 162A LCD but it is not displaying the characters properly. It is displaying boxes in the first line. I have removed and reconnected the wires several times to ensure that there is no loose connections but the problem still continues. I cannot figure out the fault in the circuit. Please help me in rectifying this mistake.
Here's the code:

#include<LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup()
{
    lcd.begin(16, 2);
}

void loop()
{
    lcd.setCursor(0,0);
    lcd.print("HELLO WORLD");
    lcd.setCursor(2,1);
    lcd.print("HELLO WORLD");
}

The pictures of the connections and the LCD display are attached. The potentiometer is 10K ohm and the resistor is 220 ohm. The LCD dimension is 16X2. Please help me in this project.

LCD Output.gif

The gif file tells me what there is a problem with the LCD display and/or the connections.

You should check the wires AND the soldering - it does not look good at all. It may be connections between two or more pins on the LCD.

There are several pins on the LCD where you may have connected two pins due to the soldering. From left to right: 1 and 2, 6 and 7, 8 and 9, 13 and 14 and maybe between 14 and 15.

The row of boxes shown in your gif suggests that the LCD is not being initialized properly.

Your jpg suggests that your soldering may be the cause of the problem.

Your wiring diagram is a hopeless mess.

After you get the LCD functioning you will still have problems due to your program structure.

Put a long delay at the end of your loop() and see what happens.

A better choice would be to move the four lines of code from loop() to setup() since your message consists of unchanging information.

Don

AARRGGHH

We give a lot of bad karma for cross posting.

floresta:
AARRGGHH

We give a lot of bad karma for cross posting.

:o :confused: I am extremely sorry for reposting this. I did not realise I had posted this again. But how can I delete this one? Only the moderator can.

I modified the code. here's the new code:

#include<LiquidCrystal.h>

LiquidCrystal lcd(11 12, 2, 3, 4, 5); //I changed the connections a bit

void setup()
{
    lcd.begin(16, 2);
    lcd.setCursor(0,0);
    lcd.print("HELLO WORLD");
    lcd.setCursor(2,1);
    lcd.print("16X2 Display");
}

void loop()
{
    
}

I also cleared the mess in the diagram. The new diagram is attached.
But after these rectifications, the LCD is still not working.

TheRoboticM:
I modified the code. here's the new code:

#include<LiquidCrystal.h>

LiquidCrystal lcd(11 12, 2, 3, 4, 5); //I changed the connections a bit

void setup()
{
   lcd.begin(16, 2);
   lcd.setCursor(0,0);
   lcd.print("HELLO WORLD");
   lcd.setCursor(2,1);
   lcd.print("16X2 Display");
}

void loop()
{
   
}



I also cleared the mess in the diagram. The new diagram is attached.
But after these rectifications, the LCD is still not working.

That's all well and good but you seem to have overlooked the first part of this statement:

After you get the LCD functioning you will still have problems due to your program structure.

Have you tried reworking your solder joints?

Don

LCD Output.gif

LCD.jpg

Circuit.PNG

Circuit.PNG

Standard correction; it won't fix your problem but makes contrast setting easier: Remove the connection between the potentiometer and the 5 V "Vcc" line. It's a bad mistake. Never put it back!

Duplicate threads merged

Cross-posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes (or more) writing a detailed answer on this topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting will result in a suspension from the forum.

In the future, please take some time to pick the forum board that best suits the topic of your question and then only post once to that forum board. This is basic forum etiquette, as explained in the sticky "How to use this forum - please read." post you will find at the top of every forum board. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Paul__B:
Standard correction; it won't fix your problem but makes contrast setting easier: Remove the connection between the potentiometer and the 5 V "Vcc" line. It's a bad mistake. Never put it back!

Just to clarify, you mean that I should keep one of the terminals of the potentiometer disconnected. I should connect the middle terminal to the VEE and one of the remaining terminals to GND. No connections should be made to the 5V Line from the potentiometer, right?

floresta:
That's all well and good but you seem to have overlooked the first part of this statement:
Have you tried reworking your solder joints?

Don

It will take some time to re-solder the connections as my solder wire has run out and most of the shops are closed due to the COVID-19 Outbreak. I will do that as soon as I get enough solder wire.
Thanks for reminding :slight_smile:

TheRoboticM:
Just to clarify, you mean that I should keep one of the terminals of the potentiometer disconnected. I should connect the middle terminal to the VEE and one of the remaining terminals to GND. No connections should be made to the 5V Line from the potentiometer, right?

Circuit.PNG
That's right. Way back in the mists of digital time, someone copied the wrong circuit from the HD44780 datasheet, one which was only intended to show a parameter test circuit, and just about everyone including a number of "professional" designers has just mindlessly copied from them verbatim.

The incorrect connection needlessly wastes current, but also makes it more difficult to adjust the contrast. Connecting the potentiometer as just a variable resistor is an improvement, and using a 1k potentiometer instead as a variable resistor would spread the contrast setting over the whole range. Not that it is of course, that critical. :grinning:

If you are using a 10k, connecting both ends to ground actually makes contrast setting easier. :sunglasses:

Also, if resistor "R8" on the LCD module is "101" or 100 Ohms (very occasionally it is R7 or R9), that is the current defining resistor for the backlight and you do not need a series 220 Ohm resistor - the inclusion of which will just dim it slightly (and save current).

I have done connected the both the terminals of the potentiometer to GND and it actually makes the contrast setting much much easier. I have also removed the resistor. I have a 1K ohm potentiometer but it is not soldered properly. I'll do that when the solder wire arrives.
Thanks a lot for the suggestions :slight_smile:

LCD.gif

Thank you to everyone, the problem is now fixed. The LCD is displaying the proper characters. The problem was with the soldering itself, maybe some part of the metal overlapped with the other pins. Great thanks to floresta.

Previous LCD behaviour:
LCD Output.gif

New LCD behaviour:
LCD.gif

So after tinkering with the LCD for a bit, I made a cool short animation with it and I just wanted to share it with you guys.

Thanks for all your time and suggestions. :slight_smile:

pacman.gif

pacman.gif

I think you need to mount that display on something steady. And get a tripod for the camera!