I have been trying to get a DFR0557 IIC LCD working with my project. Up until now, I have been using a standard 1602 display and have had no problems.
The IIC LCD frequently hangs - either slightly corrupting the last display or sometimes printing a few random characters. To reset, I have to remove power from Arduino and the display.
I tried powering the Arduino and the LCD from a 9v battery and voltage regulator. This seems to make the LCD more stable, as long as the backlight isn't on. As soon as I connect the Arduino to my computer's USB, the screen crashes (program on Arduino is still running fine).
Have tried 10k pullup resistors between SDA and SCL and +5v, but make no difference.
I am using the DFRobot_RGBLCD1602 library. I have similar problems with the Hello World example. When I plug in the USB, I often get "Hello Wold" and/or extra digits on the counter (e.g. it might count 11, 21, 31 ... 91, 10, 11, 12), before crashing within a minute.
Fade example seems to work fine, even plugged in to USB.
We need to see your code.
In the IDE, click on Edit, then on Copy for Forum. That will copy your code for the Forum.
Then come back here and just do a simple paste
I am using an R4 Minima. Here is the Hello World code - the only modification I have made is the RGBaddr (I have a LCD module v1.1):
/*!
* @file HelloWorld.ino
* @brief Show helloworld.
* @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
* @licence The MIT License (MIT)
* @maintainer [yangfeng](feng.yang@dfrobot.com)
* @version V1.0
* @date 2021-09-24
* @url https://github.com/DFRobot/DFRobot_RGBLCD1602
*/
#include "DFRobot_RGBLCD1602.h"
const int colorR = 255;
const int colorG = 255;
const int colorB = 0;
/*
Change the RGBaddr value based on the hardware version
-----------------------------------------
Moudule | Version| RGBAddr|
-----------------------------------------
LCD1602 Module | V1.0 | 0x60 |
-----------------------------------------
LCD1602 Module | V1.1 | 0x6B |
-----------------------------------------
LCD1602 RGB Module | V1.0 | 0x60 |
-----------------------------------------
LCD1602 RGB Module | V2.0 | 0x2D |
-----------------------------------------
*/
DFRobot_RGBLCD1602 lcd(/*RGBAddr*/0x6b ,/*lcdCols*/16,/*lcdRows*/2); //16 characters and 2 lines of show
void setup() {
/**
* @brief initialize the LCD and master IIC
*/
lcd.init();
lcd.setRGB(colorR, colorG, colorB);
// Print a message to the LCD.
lcd.print("hello, world!");
delay(1000);
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
/**
* @brief set cursor position
* @param col columns optional range 0-15
* @param row rows optional range 0-1,0 is the first row, 1 is the second row
*/
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis()/1000);
// lcd.setPWM( 0x7, 0xff );
delay(100);
}
Yes, I have tried the standard LiquidCrystal_I2C library and LiquidCrystal_AIP31068 library (Datasheet says lcd controller is AIP31068L or equivalent). These just display first line with solid squares, second line blank - which seems to be a startup default for this display.
9v still connected. I have just checked and voltage of battery is really low (6v). Have plugged voltage regulator into my main 12v system and everything seems to be working fine now.
I suspect that the R4 minima can't supply enough power to run this lcd, particularly with backlight on (or the wires stuck into 5v and gnd were too loose and there was some resistance).