Odd Display Issues with 1602 HD44780

I recently started a project for a UV Box that will use an Arduino Un0 R3 as a timer that will send a voltage to the base of a transistor thus powering up the LED Arrays. I had the project working a few days ago - then I soldered it up and it didn't work - so I took it all apart and replaced all components - even the Arduino and the problem persists.

Here is the Code:

// include the LCD library code:
#include <LiquidCrystal.h>

int startPin = 9; //start button pin
int upPin = 6; //up button pin
int downPin = 8; //down button pin
int transistorPin = 7; //transistor base pin 
int buzzerPin = 13; //piezo buzzer pin

int upRead1 = 0; //variable to read up button
int upRead2 = 0; //debounce variable for up button
int downRead1 = 0; //variable to read down button
int downRead2 = 0; //debounce variable for down button
int startRead1 = 0; //variable to read start button
int startRead2 = 0; //debounce variable for start button

int timerCount = 0; //variable for timer setting
int minutesCount = 0; //minutes value
int secondsCount = 0; //seconds value

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);


void setup() {
lcd.print("Franklin's UVBox");
delay(2000);
lcd.clear();
lcd.print("Exposure Time?");
delay(1500);
pinMode(transistorPin, OUTPUT);
pinMode(buzzerPin, OUTPUT);
pinMode(startPin, INPUT);
pinMode(upPin, INPUT);
pinMode(downPin, INPUT);
}


void lcdWrite()
{
   lcd.setCursor(0, 0); //set cursor to top left
   lcd.print(minutesCount); //print minutes value
   lcd.setCursor(3, 0); //set cursor on other side of minutes value
   lcd.print("min"); //print min string
   lcd.setCursor(7, 0); //set cursor further right
   lcd.print(secondsCount); //print seconds value
   lcd.setCursor(10,0); //set cursor further right
   lcd.print("sec"); //print sec string
}


void loop() {

  //read all three buttons
  upRead1 = digitalRead(upPin);
  downRead1 = digitalRead(downPin);
  startRead1 = digitalRead(startPin);

  //debounce read for all three buttons
  delay(10);
  upRead2 = digitalRead(upPin);
  downRead2 = digitalRead(downPin);
  startRead2 = digitalRead(startPin);

  //slow down button value change speed
  delay(100);

  //if up button pressed increment timer count and print to lcd
  if(upRead1==upRead2 && upRead1==HIGH)
  {
   lcd.clear(); //clear screen
   secondsCount = secondsCount+5; //increment in sec intervals
   if(secondsCount==60) //increment minute & rest sec for every 60 sec
   {
    minutesCount++;
    secondsCount=0; 
   }
   lcdWrite(); //print values
  }

  //if down button pressed decrement timer count and print to lcd
    if(downRead1==downRead2 && downRead1==HIGH)
  {
   lcd.clear(); //clear lcd
   secondsCount = secondsCount-5; //decrement minute & reset sec for every 60 sec
   if(minutesCount>0) //if more than a minute left
   {
    if(secondsCount==-5) // reset sec value of -5 to 55 & decrement minute
   {
    secondsCount=55;
    minutesCount--;
   } 
   else
   {
    if(secondsCount<0) //if countdown finished, reset values to zero
   {
    secondsCount = 0;
    minutesCount = 0;
   } 
   }
   }
   lcdWrite();

   if(secondsCount<0)
   {
     secondsCount=0;
     lcd.clear();
     lcd.print("0");
   }
  } 

  //if start button pressed activate transistor base and 
  //print timer count down to lcd
  //activate buzzer to signal end of count
  if(startRead1==startRead2 && startRead1==HIGH)
  {

    timerCount = (minutesCount*60) + secondsCount;
    int timerCount2 = timerCount;
    Serial.println(timerCount);
    for(int i=timerCount;i>0;i--)
    {
       lcd.clear();

       if(timerCount2>60)
       {
         minutesCount = timerCount2/60;
         secondsCount = timerCount2%60; 
       }
       else if(secondsCount==60)
       {
          secondsCount=59; 
       }
       else
       {
        minutesCount = 0;
        secondsCount = timerCount2; 
       }


   lcdWrite();

       //send transistor base pin high
       digitalWrite(transistorPin, HIGH);
       delay(1000);
       timerCount2--;
    }

   lcd.clear();
   lcd.print("I am Done");

   //turn transistor off
   digitalWrite(transistorPin, LOW);

   //turn on piezo buzzer
   analogWrite(buzzerPin, 255);
   delay(1000);

   //turn off piezo buzzer
   analogWrite(buzzerPin, 0);
   delay(2000);
   lcd.clear();
  delay(1000);
   lcd.print("Exposure Time?");
   delay(1000);

   //reset timer values
   timerCount = 0;
   minutesCount = 0;
   secondsCount = 0;
  }

}

Al connections are correct - the Arduino and Buzzer receive power from a 9v battery and the rest of the components(buttons, and LCD) receive power from a 5v supply - the buttons have a 10k ohm pull up resistor

The project is supposed to work like this: Arduino UV LED PCB Exposure Box - YouTube

I modified a few things to fit my needs but it is mostly the same as the original creators project

I am using this LCD: http://www.ebay.com/itm/181295337227?_trksid=p2059210.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

I would have attached images but every time I try it crashes - they are compressed and are well within the size limits

Half the time the screen is blank - backlight and logic are recieving power and the contrast pot works just fine - the other half of the time the "Franklin's UVBox" and "Exposure Time?" come up but the minute and second values do not - when I press any button random numbers, symbols and percent signs come up on the screen until I reset it - and it does it all over again.

Once again I had it working like a charm - nothing has changed from then until now which is why i'm so stumped - if anybody has any ideas please help - THANKS!

then I soldered it up and it didn't work

Did you remember the connection between the negative terminals of both power supplies?

I would have attached images but every time I try it crashes - they are compressed and are well within the size limits

Try again. I think there may be some limitations for your first post.

Don

Well I still couldn't upload them so here they are in a video: - YouTube

I made it so all components are now powered off the arduino - now no symbols show up - it always comes on - everything works - the only thing im having issues with is that it says "Franklin's UVBox" then "Exposure Time?" all like it is supposed to - but the time values as in "0 min 0 sec" never shows up - I have press the up button(the one that increments the time by 5 seconds) - when I do this the values show up - then I can press the start button and everything works accordingly

THANKS!

Okay I figured it out - its done now - THANKS!

What did you figure out ?
Help others that run in the same trouble by telling what was your problem and the solution.

Well I had all components except for the Arduino powered by a separate 5v power supply. Even my tactile switches were grounded and were powered separately - the only thing connecting them to the Arduino was the wire going to the digital input reading the status of the switch. I also had a 10k resistor in series with 5v power because I did not use the internal pull up resistors - but this was separate from the Arduino as well.

I all of a sudden thought that the digital input reading the status of the switch was "floating" because when the switch is not closed it is not connected to anything - therefore it was probably screwing up all my readings on the LCD because the switches controlled everything - by isolating both power circuits I defeated the purpose of using a pull up resistor.

So I removed the separate power supply and made it so that everything was grounded and powered by the Arduino - when I did this all weird behavior stopped

I have no idea if my assumption of what the problem was was even correct - I just know that my lucky guess fixed it.

Hope this helps anyone having the same problem!

So ... MAS3's footnote was stunningly apt.

As it so frequently is. :smiley:

  • the only thing connecting them to the Arduino was the wire going to the digital input reading the status of the switch.

So I removed the separate power supply and made it so that everything was grounded and powered by the Arduino - when I did this all weird behavior stopped...

Now go back and read the first half of reply #1.

Don