I2c-library needed: DS1307, HD44780 (PCF8574)

for a little school project I need i2c-libraries that works on Arduino Nano and ATtiny85.
RTC: DS1307,
LCD: HD44780 (PCF8574)

any tipps?

You will not find one library for both.

I don't know of a DS1307 library, but the best library for I2C enabled hd44780 LCDs is the hd44780 library.

To install the hd44780 library. The hd44780 library is the best available for I2C LCDs. The library is available in the Library Manager. Go to Library Manager (in the IDE menus, Sketch, Include Libraries, Manage Libraries) and in the Topics dropdown choose Display and in the Filter your search box enter hd44780. Select and install the hd44780 library by Bill Perry.

The class that you want to use is the hd44780_I2Cexp class. There are examples to show how to use the library. The nice thing about the hd44780 library is that it will autodetect the I2C address and the I2C backpack to LCD pin mapping.

In the examples, there is a diagnostic sketch that will help us to help you if you still have trouble with the display. Run the diagnostic sketch and post the results.

The path to the diagnostic, the Hello World and other examples and the documentation (red box).

2 Likes

The DS1307 is not a great RTC in my opinion. In my experience they do not keep great time. I would use the DS3231 instead.

1 Like

Hello groundFungus,
thank you for your answer!
I have tried this with the following result:

********************************************************************
Serial Initialized
--------------------------------------------------------------------
I2CexpDiag - i2c LCD i/o expander backpack diagnostic tool
--------------------------------------------------------------------
hd44780 lib version: 1.3.2
--------------------------------------------------------------------
Reported Arduino Revision: 1.8.19
CPU ARCH: AVR - F_CPU: 16000000
--------------------------------------------------------------------
SDA digital pin: 18 A4
SCL digital pin: 19 A5
--------------------------------------------------------------------
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
 i2c device found at address 0x68
Total I2C devices found: 2
--------------------------------------------------------------------
Scanning i2c bus for all lcd displays (4 max)
 LCD at address: 0x27 | config: P01245673H | R/W control: Yes
Total LCD devices found: 1
--------------------------------------------------------------------
LCD Display Memory Test
Display: 0
 LCD stuck BUSY status
--------------------------------------------------------------------
No working LCD devices

the hardware works with a library named "Soft_LCD-I2C" but this is unstable (in my opinion) and unsupported. :-/

That often indicates a problem with wiring or soldering of the backpack to the LCD or, less likely, the soldering on the backpack itself.

Please post some clear photos of the LCD and backpack showing the soldering.

Disconnect the RTC, temporarily, and run the diagnostic.

1 Like

I am not at home now. So I test this in "Simul-IDE" – with the same result. It seems to be another problem?!?

1 Like

I will suspend judgment till I can see the result on real hardware.

I have actually used an I2C enabled HD44780 display with the hd44780 library and a DS1307 before with no trouble, so I know that the combination works. The hd44780 library is in wide use so I, also, trust the library.

I have seen many simulators and have little trust in them. That is just my opinion formed over 50 + years in the electronics and microcontoller hobby. Some are better than others, but I have yet to see a perfect sim.

1 Like

Try using time library or Adafruit's RTClib.
Links coming soon.

1 Like

This is for RTCLib(note that it also has a assembly tutorial just skip to the wiring and programing part):

TimeLib's GitHub(you'll need another library to use this with a RTC I will have to look for mine):

Currently my favorite RTC library is the RTCLib.
Hope this helps.

2 Likes

Hi Karsten,
you can find an example in the Simul-IDE Project Forum but I agree with groundFungus and v205! hd44780-lib, RTClib and Time-lib is the perfect choice!
Best regards.

1 Like

Hi Karsten,
follow the tip of the author Bill Perry:
https://forum.arduino.cc/t/lcd-1602-with-i2c-problem/645404/11

modify one line in the I2CexpDiag sketch and it works. :wink:

2 Likes

Well, it at least gets a bit further.
It could be that the SimulIDE simulator is incomplete and does not fully/properly support reading the LCD through the PDF8574 chip.
This used to be an issue for Wokwi. I worked with the Wokwi developers to get LCD reads working properly so I2CexpDiag now works with Wokwi.

@karstenlehmann
Can you post some photos of your hardware so we can look at the soldering on the header pins and the PCF89574 chip?

--- bill

2 Likes

THANK YOU! I test all your Arduino-tips.
Do you have some tips about my ATtiny85-question?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.