Need help! Black boxes on the first row of 16x2 LCD!

Hi, :smiley:

I'm a total noob on Arduino here, and this is my first project on 16x2 LCD, 4x4 keypad and others. So, the story is, after I uploaded the codes for my group's Arduino alarm clock to the Arduino board, the LCD displays black boxes on the first row of the LCD. Plus, when I disconnected the board from my computer and connected the board to a 5V adaptor, the LCD didn't display anything.

I've already searched the possible causes from the Internet, and mainly they said that either the initialization of the LCD is wrong or there are problems on the soldering. My friend and I concluded that there are no problem with the soldering, but we don't know where the problem is in the codes.

The thing is, we didn't have any connection for the Backlight of the LCD since we have no potentiometer. I tried to control the contrast and brightness of the LCD by using Arduino codes, but I can't understand anything since I'm a total noob.

I've also attached the image of the soldering of the LCD. Below is the latest code that we uploaded on the Arduino board. Is there any fault in the codes?

#include <EEPROM.h>
#include <Keypad.h>
#include <DS1307.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <LiquidCrystal.h>
DS1307 rtc(SDA, SCL);
LiquidCrystal lcd(A3, A2, A1, A0, 5, 4);
Time t;

#define buz 3

int Hor, Min, Sec, h, m, s;
int ASCII = 48;
char* tim;
char* dat;
const char key = 0;
char buffer[2];
const byte numRows= 4;
const byte numCols= 4;
char keymap[numRows][numCols]=
{
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
byte rowPins[numRows] = { 12, 11, 10, 9};
byte colPins[numCols]= { 8, 7, 6, 5};
Keypad myKeypad= Keypad(makeKeymap(keymap), rowPins, colPins, numRows, numCols);

void setup() {
Wire.begin();
rtc.begin();
pinMode(buz, OUTPUT);
lcd.begin(16, 2);
welcome();

rtc.setDOW(SATURDAY); // Set Day-of-Week to SUNDAY
rtc.setTime(10, 54, 0); // Set the time to 12:00:00 (24hr format)
rtc.setDate(7, 1, 2017); // Day, Month, Year
}

void loop() {
t = rtc.getTime();
Hor = t.hour;
Min = t.min;
Sec = t.sec;
tim = rtc.getTimeStr();
dat = rtc.getDateStr();
char key = myKeypad.getKey();

if (key == 'C'){
digitalWrite(buz, LOW);
EEPROM.write(2, ASCII+6);
EEPROM.write(3, ASCII);
}

if(key == '#'){
lcd.setCursor(0,0);
lcd.print("Enter New Time");
lcd.setCursor(0,1);
int j =0;
int i=0;
while( j<6)
{
if(i==2 || i == 5){
lcd.print(":");
lcd.display();
i++;
}
key=myKeypad.getKey();
if(key)
{
lcd.print(key);
lcd.display();
EEPROM.write(j,key);
j++;
i++;
}
}
}

changealarm();
checkalarm();
timedate();
}

void checkalarm(){
if( Hor == h && Min == m)
{
delay(3000);
lcd.setCursor(0,1);
lcd.print("Hold C");
digitalWrite(buz, HIGH);
delay(3000);
}
}

void changealarm(){
buffer[0]=EEPROM.read(0);
buffer[1]=EEPROM.read(1);
h = atoi(buffer);
buffer[0]=EEPROM.read(2);
buffer[1]=EEPROM.read(3);
m = atoi(buffer);
buffer[0]=EEPROM.read(4);
buffer[1]=EEPROM.read(5);
s = atoi(buffer);
}

void timedate(){
lcd.setCursor(0,0);
lcd.print("Time: ");
lcd.print(rtc.getTimeStr());

lcd.setCursor(0,1);
lcd.print("Date: ");
lcd.print(rtc.getDateStr());
delay(3000);
lcd.setCursor(0,1);
lcd.print("Alarm: ");
lcd.print(h);
lcd.print(".");
lcd.print(m);
lcd.print(".");
lcd.print(s);
delay(3000);
}

void welcome(){
lcd.setCursor(0,0);
lcd.print("Welcome");

lcd.setCursor(0,1);
lcd.print("To");
delay(3000);

lcd.setCursor(0,1);
lcd.print("TIMeProject");
delay(3000);
}

Thank you for your help in advance! We really need help for this! :cry:

black boxes-min.jpg

Hudhudpanda:
I've also attached the image of the soldering of the LCD. Below is the latest code that we uploaded on the Arduino board. Is there any fault in the codes?

I wouldn't have any idea, because you are trying to run before you can walk.

To start with, you need a test code for the LCD. No other parts, just the "Hello World" code for the LCD. Once that is working, you can add a piece of code at a time and test at each stage.

You appear to have the contrast set OK.

It is much easier if you have the backlight working. You do not need a potentiometer for it. (Why did you think you did?) If R8 (or R9) on the LCD module is a "101" - 100 Ohms - then just connect "A" to 5 V and "K" to ground. If not, tell us what it is.

We need to know how those wires are connected to your Arduino, and what that breadboard in the background has to do with it? You did not specify which Arduino.

OK, that will do for a start.

Can't see where it goes but for a start ground RW see if that gets you somewhere.

tasmod:
Can't see where it goes but for a start ground RW see if that gets you somewhere.

In that case, it's advisable to disconnect it from the Arduino; shorting an Arduino output is usually not very healthy for the Arduino.

So far, there is no suggestion that RW was connected to an Arduino pin. It is not mentioned in his descriptor. That is why I asked for actual details of connections.

Until we have that answer, any further discussion is simply useless. :astonished: