0

I am trying to make a digital clock using a tiny RTC, 16x2 LCD, and Arduino Uno. The RTC module works fine if 16x2 LCD is not connected to the Arduino. Both RTC and LCD are I2C modules and hence are using the same A4 and A5 pins of the Arduino. I have been informed that the I2C devices if connected in parallel should work. But, in this case, the clock doesn't show the time properly.

4
  • 2
    Have you checked that the i2c addresses are different? A schematic and minimal program that demonstrates the error would be useful.
    – Craig
    Commented Jul 30, 2018 at 16:11
  • Yes, I did and found that the addresses are different (LCD: 0x3F and RTC: 0x50 and 0x68). The addresses for RTC is reasonable since it has an EEPROM memory builtin.
    – picklu
    Commented Aug 1, 2018 at 15:18
  • Without more information we won't be able to help you. Add a schematic and a minimal program that demonstrates the problem.
    – Craig
    Commented Aug 1, 2018 at 15:28
  • Thank you for your quick response. It was my fault that I pulled out the battery from the RTC module for a short time that ultimately reset the module.
    – picklu
    Commented Aug 1, 2018 at 16:16

1 Answer 1

1

An I2C scanner sketch can help to identify the actual addresses in use. I would use a sketch like on this page https://playground.arduino.cc/Main/I2cScanner or on this page http://gammon.com.au/forum/?id=10896&reply=6#reply6 . Or google 'arduino i2c scanner'.

Hook up the RTC by itself and run the scanner, then hook up the LCD by itself and run the scanner. The output will be on the serial monitor. If the devices have the same address, then that is your problem.

If one of the devices does not show up at all, then perhaps it is defective.

3
  • Thank you for the valuable information. I scanned the i2c device and found that they have different addresses.
    – picklu
    Commented Aug 1, 2018 at 15:13
  • I am incredibly sorry for my messy work. It all started when I pulled out the battery from the RTC. I was so frusted that I forgot to test the RTC module alone again. When I tried a different RTC, then that worked perfectly even with LCD. I found that the time can be adjusted as RTC.adjust(DateTime(F(__DATE__), F(__TIME__))); but, that also resets the time when the Arduino's reset button is pressed.
    – picklu
    Commented Aug 1, 2018 at 16:13
  • I find so often that I learn something unrelated to what I'm actually trying to do.
    – user85471
    Commented Aug 2, 2018 at 3:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.