Issue with Freenode I2C LCD 1602

Hi, i’m trying to use Freenove I2C LCD 1602 Module FNK079A, and the problem is it shuts down after a minute or so. It’s currently driven by Arduino Yun, but I also have a RaspberryPi 2b, and a ZeroW available.

I tried different power sources (laptop usb3 port, power bank, wall charger) and it doesn’t change much.

Maybe I’m missing some really basic information.

The library I’m using is markub3327/LiquidCrystal_I2C 2.0.0, and I also tried RobTillaart/I2C_LCD0.2.6 with similar code, it also shuts down in less than a minute.

Code is really simple. With delay 1000, it shuts down in about a minute. With delay 100, it shuts down after 15 seconds. Period is slightly different each time.

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

unsigned long startTime;

void setup() {
  lcd.init();
  lcd.backlight();
  startTime = millis();
  lcd.setCursor(0, 0);
  lcd.print("Hello!");
  lcd.setCursor(0, 1);
  lcd.print("Freenove LCD");
}

void loop() {
  unsigned long elapsed = millis() - startTime;
  unsigned int minutes = elapsed / 60000;
  unsigned int seconds = (elapsed / 1000) % 60;
  unsigned int deci = (elapsed / 100) % 10;

  char buffer[17];
  snprintf(buffer, sizeof(buffer), "%02u:%02u:%1u      ", minutes, seconds, deci);

  lcd.setCursor(0, 0);
  lcd.print(buffer);

  delay(1000);
}

Please post schematics. Pen and paper drawing is fine. The symtom points out powering. Are You sure You gave the full and correct name of the controller? No sub bransches?

A general rule is: Don't use micro controllers as power supply for other things than one or two LED.

Like this? I didn’t find the yun in the site i found, but the pins are similar.

(edit: removed inaccurate schematic, good one in the next post)

Do you have a basic, common type of Arduino available, like an Uno R3 or Nano V3? That would help the eliminate the Yun as the problem.

We can't see which pins you are using on the Yun from your photos, so a diagram of a different model of Arduino with "similar" pins connected to a different LCD module does not help.

Why not draw a diagram for us? Do you have pencil and paper?

I don't have a Yun or a Freenove LCD, but I do have a Nano V3 and a 16x2 LCD with i2c backpack.

Your code, with no changes, runs fine and doesn't shut down. I let it run for 10+ mins:

(Excuse my faulty LCD!)

My first suspicion would be an intermittent wire and/or wire connector. Once the PCF8574 on the backpack misses a bit, it's not coming back.

Though a well lit, in focus picture of the back of the LCD might also be instructive.

This site has some photos how it should look like

There are apparently at least 2 models

It's odd that the shutdown time varies with the loop delay. If the backlight stays on, the current drawn by the display presumably doesn't change much, no matter what the delay is. So what would account for this? I wonder if anything is getting warm.

@ironbishop

Can you do a Serial.print(strlen(buffer)); Serial.println(buffer); in loop()?

Hypothesis 1 to test is if the processor is blocked too.
Hypothesis 2 is to test is if the buffer overflows...

I could not find a schematic for the LCD device board to see what kind of pullups, if any, are on that LCD device. It does appear that there are pullups on the YUN board.

I would install the hd44780 library.

The hd44780_I2Cexp i/o class is for the LCD device you have.
Run the included i2CexpDiag sketch that is part of the hd44780_I2Cexp i/o class examples.

This will do some tests on the i2c signals and then do internal memory test of the LCD CGRAM and DDRAM.
Then fall into a loop doing an lcd update.

You could also run LCDiSpeed and LCDlibTest which will do some tests that stress the i2c interface and the LCD more than I2CexpDiag.

There is also a ReadWrite example that will continuously write to the LCD and read back the data and checks for i2c errors as well as data corruption during the process.

The library has a wiki here:
https://github.com/duinoWitchery/hd44780/wiki

I think he can just disconnect everything, then use his multimeter to measure resistance between the display's SDA pin and Vcc pin, then the same for SCL. Then reverse the leads and measure again. If reversing produces a different result, the lower resistance value is the value of the pullup resistor, if present at all. Odds are quite high that it will be 10K or 4.7K.

He could probably make the same measurements on the Yun. The Yun schematic has pullup resistors shown, but with no value assigned, and they are marked DNP, which I assume is Do Not Populate.

Seems easier to run the I2CexpDiag test and let it tell you if it detected pullups. :wink:

Thank you all for the replies.

I tried using a different board, but my SD adapter is not working, both Raspberry need one, so i will need to find another one.

Adding Serial.print(strlen(buffer)); Serial.println(buffer); before lcd.print(buffer); : the serial stops updating when the LCD stops, but still says “connected”.

This is the accurate schematic:

This is the back:

Arduino <–> LCD:

  • GND - VSS
  • 5V - VDD
  • SDA - SDA
  • SCL - SCK

Removing all wires, the resistance between VSS and SCL is 18.2k, and the same backwards. Also between VSS and SCK, i read 18.2k.

During operation, i read voltage between VSS and SDA: it’s 4.5 when working, then goes to 5 when the output freezes. Same between VSS and SCK: 4.6 while the clock updates, goes to 5 as soon as the output freezes.

I2CexpDiag output:


********************************************************************
Serial Initialized
--------------------------------------------------------------------
I2CexpDiag - i2c LCD i/o expander backpack diagnostic tool
--------------------------------------------------------------------
hd44780 lib version: 1.3.2
--------------------------------------------------------------------
Reported Arduino Revision: 1.6.7
CPU ARCH: AVR - F_CPU: 16000000
--------------------------------------------------------------------
SDA digital pin: 2
SCL digital pin: 3
--------------------------------------------------------------------
Checking for required external I2C pull-up on SDA - YES
Checking for required external I2C pull-up on SCL - YES
Checking for I2C pins shorted together - Not Shorted
--------------------------------------------------------------------
Scanning i2c bus for devices..
 i2c device found at address 0x27
Total I2C devices found: 1
--------------------------------------------------------------------
Scanning i2c bus for all lcd displays (4 max)
LCD 0 begin() failed: -1
No working LCD devices

I also tried the same test, with the same result, using the other I2C pins:

The initial example code runs into the same issue, even with this different wiring.

Is that a picture of the actual board that you are using ?

If so, then why is nothing soldered to the LCD interface pins ?

I assume I can use the integrated I2C interface, not the parallel one. The LCD does display the strings I send, but it hangs in a few seconds.

The LCD is brand new, the Yun is something I had in a box for some years.

OK, understood. I had not appreciated that the LCD had both interfaces on it

Hi, @ironbishop
Welcome to the forum.

Can you please try a 4k7 pullup resistor on each of the SDA and SCK data lines to Vdd.

Thanks.. Tom.... :smiley: :+1: :coffee: :australia:

Maybe you can try adding this after the delay() at the end of the loop to see if the issue is
some sort of corruption which can be recovered from or a power supply or power component dropping out.
The strange characters which appear on the display indicate corruption.

static uint32_t lastClean = millis() ;  // static initialised once only
if ( millis() - lastClean > 5000UL ) {
  lastClean = millis() ;
  lcd.init();
}

Are the SCL/SDA pins on the YUN Board connected to the 5V Atmega or the 3v3 Atheros AR9331?

Is your LCD a 5V or a 3v3 variant? (based on the missing U3 I would assume its a 5V Version).

Can you please link to a description/datasheet of your exact LCD?