Hi,
I’m new on this forum and have for some time been using this Serial LCD:
https://www.sparkfun.com/products/16398
with a Raspberry Pi Zero 2 W using this library:
https://github.com/sparkfun/Qwiic_SerLCD_Py
It has been running fine continuously for several weeks now as a clock display. However recently it has gone blank, i.e. it does not display any text at all and it only maintains its RGB setting (which is (255, 255, 255), aka white).
That is not to say it is always blank, a simple reboot fixes it for a few days before it goes blank again.
Below I have included the code that’s running the display:
from __future__ import print_function
import qwiic_serlcd
from time import sleep
from datetime import datetime, timedelta, timezone
try:
#Setup code for 20x4 LCD.
lcd = qwiic_serlcd.QwiicSerlcd()
lcd.setBacklight(255, 255, 255)
lcd.setContrast(5)
lcd.begin()
lcd.disableSystemMessages()
lcd.clearScreen()
sleep(1)
lcd.print("UTC Time:")
interval = 1
next_time = timedelta(seconds=interval) + datetime.now(timezone.utc)
while True:
now_ts = datetime.now(timezone.utc)
if next_time <= now_ts:
lcd.setCursor(0, 1)
lcd.print(now_ts.strftime("%Y-%m-%d %H:%M:%S"))
next_time = timedelta(seconds=interval) + next_time
except BaseException:
print("\nExited 'UTC_Clock.py'.")
finally:
lcd.clearScreen()
I also have set the Pi’s I2C bus speed to 9600 to be the same as that of the display. When it was not set to 9600 the Pi would not communicate properly with the display. I have checked the physical connection for the SHIM to the Pi, the cable to the SHIM and the cable to the display.
If anyone knows why my display keeps blanking please let me know, it’ll be most appreciated.