Go Down

Topic: LCD display not displaying data (Read 380 times) previous topic - next topic



My name is Sam Ruben Abraham and I'm a 9th grader from India. Last week I bought an LCD Keypad
Shield for a project called 'Color Sensor' using my Arduino Uno R3.I plugged the thing to the Arduino and ran the "HelloWorld" sketch from the "LiquidCrystal" library. But the text didn't display! I tried
to use different functions and even changed the connections to the pins, but nothing came of it. Could you solve my dilemma, please??
P.S.: Please explain the problem in a way that a 9th grader can understand...

Yours faithfully,


Well, the first and most important question is:  Have you read at least thirty questions here with titles similar to yours?

That would be the critical step.


Most lcd keypad shields do not use the same Arduino pins to control the LCD as the LiquidCrystal examples.
The LiquidCrystal examples uses these Arduino pins:
Code: [Select]
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

Most LCD keypad shields use pins 8,9,4,5,6,7 so if your shield is one of the more common ones, you will want to use:

Code: [Select]
const int rs = 8, en = 9, d4 = 4, d5 = 5, d6 = 6, d7 = 7;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

--- bill



Thanks for your help, dear sirs.But I've got another doubt:can a single Arduino handle multiple devices via the digital interfaces? I'm asking this because my LCD isn't displaying data in the way it should even after I connected the LCD background anode and cathode.Here are the details:
> The LCD display worked properly on being directly plugged to the Arduino with no other device connected(especially switches, LED's,etc.).
>The project I'm working upon is the Neural Network-based Color Identifier(source code named 'ColorSensor') created by Caio B. Moretti.I rewired the project to make it suitable for the LCD device I have(about which I told in my previous question).The thing lights up for some time when the project is run on external power as well as that from my laptop, and gradually fades(except in the aforementioned case).

As I've said before(Have I said so?), I'm not a tech expert and I would like you to guide me well so I can succeed.Also, I'm really sorry that I couldn't read through all related topics.

Thanking you,
Sam :)


Right, well two things of importance here.

Firstly:  Did you get the display to work at one stage?  If so, you need to recall what the connections and code were to do that.  If you reconfigure it, then the first thing you must do is to get the simple "Hello World" example to operate in that new configuration, not any more complex code.  You have to understand what changes need to be made in the code to match any changes in the wiring.

The second thing: In order to get any assistance here, you have to specify every detail of your project; the schematic diagram of how everything is connected, the identity (with Web links) of each part, and each example of code (posted according to the instructions) that you wish to make work.

Also you need to explain what you mean by "when the project is run on external power".  You always need to provide a 5 V power supply for the Arduino.  This can - up to 500 mA - be provided by the USB port.  You may have been misled by certain tutorials into believing that you can power it via the "barrel jack" or "Vin" with a power source other than 5 V.  This is only usable if you have no other shield or part connected to the Arduino (UNO).  In general, you need a regulated 5 V supply (such as a "phone charger" with a USB socket if not connected to a computer) to power it by the USB connector or the "5V" pin and ground.


May 21, 2019, 04:49 pm Last Edit: May 21, 2019, 04:50 pm by SamRuben123

Yes, the display worked on being directly plugged to the Arduino , like in the pic in the first attachment.
And yes, I ran the "Hello World" sketch when I got the LCD device.At first it didn't work, as I was not aware
of the required pin configuration.After I heard about the pin configuration, I tried with the one that was suggested ('LiquidCrystal(8,9,4,5,6,7)') in one of the replies; it worked. And the second thing  you wanted me to specify- the project details- is  in the following link:https://create.arduino.cc/projecthub/moretticb/color-sensor-prototype-detect-color-name-from-objects-c4f7d6?ref=user&ref_id=184857&offset=0
I wasn't able to get the LCD device mentioned in the link and had to adjust with the one that I got from Amazon. The picture of the device is in the second attachment . Thirdly, the 'external power' I told you about in my previous post is the same 5 V power supply through the jack . And I remember that I've tried making the project work while connected to the USB serial cable.Also, if my memory is right, it had the same effect(lighting up at first and fading gradually) that I saw while it was plugged to external power.
I'll verify the thing in a later post.

Thanking you,


The linked schematic and code show the button on pin 6. You will have to move it to another pin of your display is using pin 6.


Right, well, you need to get a stable platform before you can embark on that colour sensor business, so you need to get the "Hello World" code working and understand what constructor you are going to use.  Generally we recommend installing the HD44780 library using the library manager in the IDE found under the "Sketch" category:

You then look at the examples provided in that library and use those rather than any other, to determine how to configure the display.

Now I keep getting back to your references to "run on external power", now you say "the same 5 V power supply through the jack".  Your first image above - which I understand is not yours as it is a Mega 2560 - shows something connected to the "barrel jack" at the bottom left of the board and you seem to suggest you are connecting a 5 V power supply here.

The take-home message is -  do not use the barrel jack - or indeed the "Vin" terminal.  You need a 5 V supply, and it needs to connect either to the USB port from either your PC or a "phone charger" with a USB socket and an "A-B" USB cable or you connect your 5 V supply with due care for polarity, to the "5V" and ground pins on the Arduino.

Having things mysteriously fade out clearly indicates you are attempting to use the barrel jack and the on-board regulator.  As I explained in #4, this is simply not usable if you are attaching any other equipment to the UNO board.  You need to get the power supply correct before anything else.

The two examples of the "LCD keypad shield" will be pretty much the same except perhaps for the backlight control wiring foul-up and have the same connections but it is interesting to note the use of two different contrast potentiometers, something I have discussed elsewhere.


Generally we recommend installing the HD44780 library using the library manager in the IDE found under the "Sketch" category:
To use that library with your lcd keypad shield you will need to use the ioClass hd44780_pinIO

Code: [Select]
#include <hd44780.h>
#include <hd44780ioClass/hd44780_pinIO.h> // Arduino pin i/o class header

There is a library example LCDKeypadCheck which will test the backlight circuit.

Another thing I noticed about the referenced color sensor sketch is that the backlight pin in that sketch is D7. That as well as D6 mentioned in an earlier post will need to be changed if you are trying to run that code.

However, as Paul__B suggests, make sure you are solid with the keypad shield lcd before tryin to use the ColorSensor circuit and code.


May 22, 2019, 03:08 am Last Edit: May 22, 2019, 09:07 am by bperrybap
Note, there is currently a small bug in the hd44780_pinIO HelloWorld sketch of the constructor that uses backlight control.
I mispelled blLevel
I fixed it a while back, but have't done another release yet.
I guess I'll go do another point release as there are a few other minor tweaks to the i2c diagnostic code as well to better detect shorted SDA and SCL signals.

I'll push out a 1.0.2 release later this evening.
No new features just a few very minor bug fixes that do not affect operation in user sketches.

--- bill


Note: hd44780 library Version 1.0.2 is now available in the Library manager.
--- bill

Go Up