1602 LCD scrolling and displaying katakana when it shouldn't be

I’ve started a project trying to display the DHT11 temp and humidity on a 1602 display, along with the high and low temps since the device has been powered on. It also uses a DS1302 RTC module so I can log event times. The board is a “Kuman” brand UNO that looks identical to the official Arduino UNO. The libraries are some that I found online that seemed easiest for me to work with.

All components appear to function normally when tested separately. I was getting a proper readout on the display with all 4 parameters mentioned previously. The serial output looks good. It seems the problem started after adding the RTC. It does display event time and temp on serial, but now the display appears to scroll (or maybe just puts the cursor to the end of current data instead of set point in code???) and also displays Japanese katakana characters. It should be stationary on the screen with no katakana. There’s also an occasional gibberish character.

Any insight would be much appreciated!

#include <LiquidCrystal.h>
#include <dht.h>
#include <ThreeWire.h>
#include <RtcDS1302.h>

#define dataPin 8
dht DHT;
LiquidCrystal lcd(1, 2, 4, 5, 6, 7);
ThreeWire myWire(10,9,11); //IO, SCLK, CE ----- used for rtc
RtcDS1302<ThreeWire> Rtc(myWire); // used for rtc

int thi = 0;      //initialized low so first reading will be > 0 and set a value for thi
int tlo = 99;     //initialized hi so first reading will be < 99 and set a value for tlo

void setup() {
  lcd.begin(16,2);    //turn on lcd
  Serial.begin(9600);
  Rtc.Begin();
}

void loop() {

  int readData = DHT.read11(dataPin);   //get readings
  int t = DHT.temperature;
  int h = DHT.humidity;
  t = (t * 9) / 5 + 32;                 //convert C to F
  
  lcd.setCursor(0,0);     //display current temp
  lcd.print("T: ");
  lcd.print(t);
  lcd.print("F");

  lcd.setCursor(8,0);     //display hi temp
  lcd.print("Hi: ");
  lcd.print(thi);
  lcd.print("F");
  
  lcd.setCursor(0,1);     //display current humidity
  lcd.print("H: ");
  lcd.print(h);
  lcd.print("%");

  lcd.setCursor(8,1);     //display lo temp
  lcd.print("Lo: ");
  lcd.print(tlo);
  lcd.print("F");

//lcd.noDisplay(); delay(500); lcd.display();     //shuts off text but NOT backlight

  if(t > thi){            //always check current temp to see if new high
    thi = (t);
    RtcDateTime eventtime = Rtc.GetDateTime();
    printDateTime(eventtime); Serial.print(": High = "); Serial.println(thi);
  }
  if(t < tlo){            //always check current temp to see if new lo (else if would not set new low if temp steadily increased from turn on time)
    tlo = (t);
  }

  delay(2000);            //important!!! gives time for next reading. sensor's capability is every 2 sec. gives erroneous readings if not present)

}


#define countof(a) (sizeof(a) / sizeof(a[0]))

void printDateTime(const RtcDateTime& dt)
{
    char datestring[20];

    snprintf_P(datestring, 
            countof(datestring),
            PSTR("%02u/%02u/%04u %02u:%02u:%02u"),
            dt.Month(),
            dt.Day(),
            dt.Year(),
            dt.Hour(),
            dt.Minute(),
            dt.Second() );
    Serial.print(datestring);
}

Update: It looks like the display works right if I comment out Serial.begin(9600); in the setup. Obviously that prevents output to the serial monitor.

Is there a way to get both to work right? Do I need to look at interrupts or some other technique?

pin 1 is shared with the serial port.
Have a look at the figure for the UNO board to see all the shared pins.

Pick a different pin for your LCD.

--- bill

That did the trick. Forgot to pay attention to pin assignments. Thank you!