1

I have just bought my first Arduino (a Mega 2560 R3 clone by ELEGOO), and I got a cheap LCD display to go with it. I cannot for the life of me get it to display anything other than a row of white blocks (although I uploaded a different sketch that I change the numbers of one of the ports and now it shows the top 3 blocks of the second row as white as well).

When I read the notes on the example LCD sketch "Display" it says the following:

The circuit:

  • LCD RS pin to digital pin 12
  • LCD Enable pin to digital pin 11
  • LCD D4 pin to digital pin 5
  • LCD D5 pin to digital pin 4
  • LCD D6 pin to digital pin 3
  • LCD D7 pin to digital pin 2
  • LCD R/W pin to ground
  • LCD VSS pin to ground
  • LCD VCC pin to 5V
  • 10K resistor:
  • ends to +5V and ground
  • wiper to LCD VO pin (pin 3)

However, when I plug my display into the Arduino the pins don't seem to go into the same ports and there is no other way of fitting it in. For reference my pins go:

LCD - Mega2560


 VSS - AREF,
 VDD - GND,
 V0 - 13,
 RS - 12,
 RW - 11,
 E - 10,
 D0 - 9,
 D1 - 8,
 D2 - 7,
 D3 - 6,
 D4 - 5,
 D6 - 4,
 D7 - 3,
 D8 - 2,
 A - 1-TX,
 K - 0-RX,

 RST - RESET,
 5V - 5V,
 VIN - VIN,
 A0 - A0,
 A1 - A1,
 A2 - A2,
 A3 - A3,
 A4 - A4,
 A5 - A5,

I am not sure what to do any assistance you can provide would be greatly appreciated.

Liam

  • the pins don't seem to go into the same ports - can you elaborate on that? What do you mean by "same"? – Nick Gammon Jan 6 '18 at 5:03
  • Sorry im new to all this, what i mean is that the pins on the LCD dont seem to match up where the instructions in the code say they should go, (or at least where i think they should go) – Liam Jan 6 '18 at 5:05
  • OK, what sketch? Link please. – Nick Gammon Jan 6 '18 at 8:06
  • Are you just jamming a vanilla LCD module directly into the side of an Arduino rather than wiring it in properly? An LCD screen is not a shield. – Majenko Jan 6 '18 at 9:00
  • 1
    I think you are assuming the pins of the LCD screen match up 1:1 with the pins of the shield. That is wrong. Very wrong. You should start with a tutorial for similar shields (they're all the same, for certain values of "same"), such as this one. – Majenko Jan 6 '18 at 11:10
1

The words you use to describe the parts of the display and which sketch you are using need to be more precise.

Regarding the part you linked to in your question, the dark blue part is the LCD (Liquid Crystal Display). Not many buy just this part. It is too hard to use.

Under it is a green board with the commonly found Hitachi LCD Controller. This is what most people buy and call the LCD. Many Arduino sketches are written for the Hitachi LCD Controller. While you could connect this type of board directly to an Arduno, you would have to make a special cable which must follow the pin assignments in the particular sketch you are using!

Finally, the darker board beneath the green board appears to be an Arduino shield. Normally Arduino shields adapt what ever circuit happens to be upon the shield to the Arduino Uno pins and form-factor. However, again, you mush use a sketch which which follow the pin assignments for the particular shield!

Armed with this knowledge, you should be using/looking-for a sketch specific to your Arduino shield. I suspect you are using the wrong sketch and this is resulting in "white blocks" on your LCD display.

Other considerations:

  1. It is possible your contrast in incorrectly set. Identify if this control is available on the shield you are using and consider adjusting it.

  2. Is the shield plugged in correctly? Check to make sure all the pins are connected to the Arduino. Most shields are designed specifically for the Arduino Uno form factor.

  3. If you are still having problems, consider buying everything (the Arduino Uno and the LCD shield) from one specific well known vendor which can supply support through direct contact or forums. Usually a good vendor will provide support especially if they provide all parts of a project.

Other approaches:

You should find a sketch which works with your LCD & Buttons Arduino shield. However, as you have figured out the paths between the Arduino and the Hitachi like LCD Module you might try using the LiquidCrystal Library. When this library is instantiated, the pins of the Arduino which are to control the Hitachi like LCD module are passed as arguments. Using the information in the question, it is likely the instantiation should look similar to this:

LiquidCrystal(12, 10, 5, d5, 4, 3) 

...Note, you are missing "d5" in your question. So the above is likely not correct. Also, from your description, the Arduino appears to control contrast ("V0" pin) for this shield. As the LiquidCrystal library does not appear to support this, you may need to create additional code to control contrast.

  • Thank you very much for such a detailed answer, I have used my multimeter and it turns out the pins on the green controller board under the display don't line in the same order as the pins on the LCD keypad shield. – Liam Jan 6 '18 at 19:36
  • I thought you bought those two (the green LED board (which likely has an Hitachi like interface) and the darker Arduino shield board) together from the same vendor! Why would they not line up? – st2000 Jan 6 '18 at 22:00
  • it came assembled as one unit. When I used my multimeter to check which pins on the green board were connected to which pins on the black board they seemed to come out different to what everyone else has – Liam Jan 6 '18 at 22:16
  • Ah! I see. Well, there are differences between the Uno and Mega 2560. See this discussion for more. However I doubt this is the problem. Note that many Hitachi LCD type board can work in 8 bit mode, 4 bit mode and even serial (uses only 1 bit) mode. It looks like the sketch you are using is setting up the pins for 4 bit mode. As what is written in the sketch does not match the wiring of the black board I still say you are using the wrong sketch. Humm, are you using "LiquidCrystal lcd"? Let me add something to my answer. – st2000 Jan 7 '18 at 0:16
  • Hum, this contrast issue is troublesome. I see a big multi turn pot right next to the LCD's V0 pin. I'm betting that controls the contrast and not the Arduino's pin 13 as you have in your question. – st2000 Jan 7 '18 at 0:37
0

I finally solved the issue, it turns out there was nothing wrong with the LCD shield or the sketch, the problem was the MEGA 2560 (by ELEGOO). The solder joint at port 'Digital 5' was missing, the pin was through the board but there was no joint. All I did to fix it was to properly solder the joint like the others are and it started to work.

Just in case anyone has a similar sort of problem as I did or wants to check the ports are working this is the sketch that I was using when I discovered the missing joint, its a simply scrolling LED sketch:

 /*
  For Loop Iteration

 Demonstrates the use of a for() loop.
 Lights multiple LEDs in sequence, then in reverse.

 The circuit:
 * LEDs from pins 2 through 7 to ground

 created 2006
 by David A. Mellis
 modified 30 Aug 2011
 by Tom Igoe

This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/ForLoop
 */

int timer = 100;           // The higher the number, the slower the timing.

void setup() {
  // use a for loop to initialize each pin as an output:
  for (int thisPin = ***2***; thisPin < ***13***; thisPin++) {
    pinMode(thisPin, OUTPUT);
  }
}

void loop() {
  // loop from the lowest pin to the highest:
  for (int thisPin = ***2***; thisPin < ***13***; thisPin++) {
    // turn the pin on:
    digitalWrite(thisPin, HIGH);
    delay(timer);
    // turn the pin off:
    digitalWrite(thisPin, LOW);
  }

  // loop from the highest pin to the lowest:
  for (int thisPin = ***7***; thisPin >= ***13***; thisPin--) {
    // turn the pin on:
    digitalWrite(thisPin, HIGH);
    delay(timer);
    // turn the pin off:
    digitalWrite(thisPin, LOW);
  }
}

you can modify the numbers that are in asterisks in order to check whichever pins you need.

To use it you build the following circuit:

enter image description here

Then simply change which port you connect the wire from the anode of the LED to and wait for the LED to flash on.

Thank you to everyone who posted a message to try and help me fix it, youve helped me learn a lot.

Liam

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.