I have the following problem: I am using an arduino micro, attached to a 54 matrix keypad and a 162 LCD display through an i2c adapter. Initially, everything works well, but after a couple of mi utes, the lcd starts displaying garbage. Sometimes, switching it off and on again does the trick, but for some reason that doesnt work anymore. However, I am almost sure there is no issue with the code, since the programme runs smoothly on my arduino uno for hours.
I am not using any resistors: I connected the 4 i2c pins to the arduino.
Do you have any idea what could be wrong/what I should perhaps try/further test?
Thank you so much for your reply!
I have attached a copy of the sketch and the libraries for the keypad and the lcd.
In terms of the wiring, I have connected GND and VCC to GND and 5V, on the Arduino, SDA and SCL to pins 4 and 5 and the keypad to pins 2 to 11. The wiring must be correct, since it was working perfectly fine for some time, but then it stopped working. Strangely, on another LCD the same setup with the same wiring (Arduino and keypad) was working again.
david_prentice:
If you use the dedicated I2C header pins on the 10-way header, it should work on a Uno, Leonardo, ...
Not necessarily.
On Leonardo SDA is digital pin 2 and SCL is digial pin 3.
Both of these seem to be being used in the sketch.
So if a Leonardo is being used, that is definitely an issue as pressing certain buttons will short out the i2c bus.
Worst case a pin has been damaged from this.
WCP1992,
If you want an easier to install & use lcd i2c library, you could consider my hd44780 library.
It will auto locate the i2c address and automatically figure out the pin mapping.
It is available in the IDE library manager.
It also includes a diagnostic test that will test your I2c signals as well as the internal RAM of the LCD.
You can read more about it here: GitHub - duinoWitchery/hd44780: Extensible hd44780 LCD library
The i/o class is hd44780_I2Cexp
The diagnostic sketch is called I2CexpDiag.
It does not conflict with any other LCD library so you don't need to uninstall any existing LCD library to try it.