Hi, I wanted to know what a good RTC module is for the Arduino Uno R4. Ive heard of DS3231 but there are some variants, so not sure on the drawbacks if any for certain variants. Im aiming to get an RTC module just to reduce error on time measurement, so I wanted to know whats a good rtc module with easy connection to the arduino as well as fewer wires needed. This was what Id found and seemed to be easy enough to use with about 6 wires to connect.
As I also use an I2C lcd on the same arduino, I wanted to know if both can be connected at the same time on the arduino, and used through their different i2c addresses, since the arduino has just A4/A5 and SDA/SCL but these share the same I2C ports. Would I be able to simply change the I2C address 'connected' to, and then display on LCD what I just used the rtc module to measure?
Define good If you buy from a reputable manufacturer like Adafruit or SparkFun you get the good stuff. If you buy for Ali and/or eBay you take a risk; you might get the good stuff or you might get crap.
Yes.
How it usually works is that you specify the address when your create an I2C object (RTC, LCD). So that is taken care of.
Install the libraries of interest and look at how the examples work. Be aware that there are far too many I2C libraries for the LCD and most are no longer supported by their authors. Your best bet is probably the HD44780 by Bill Perry but I have not check if it supports the Uno WiFi R4.
There are also plenty of RTC libraries; I would advise the one used by SparkFun for their board(s) or the one used by Adafruit for their board(s).
Note:
I'm not an Uno R4 WiFi user so never tested the libraries.
Well, good in the sense of decent documentation on its use and troubleshooting issues, and also good value. For eg ive heard the DS1307 rtc module is worse than the DS3231 in accuracy and both are similarly priced, so id say the DS3231 is good there. Just wondering if theres any variant of the DS3231 or even any other RTC modules that are considered good choices for their price.
If I did go for an adafruit/sparkfun RTC, what are the popular choices from them? And would those also be easy to connect to the arduino? (same level as the LCDs, with 2 power, 2 i2c wires and maybe 2 or 3 more for the rtc functions)
definitely better than the DS1307, just read and compare the data sheets.
Ultimate alternative is to use NTP over the network, but don't know if that is an option.
The DS1307 uses an external crystal and so is dependent on the accuracy of the crystal. It is not temperature compensated so that is also dependent on the crystal type and environment. With the proper crystal over a narrow temperature range it can give good performance. With a module you are at the mercy of what the maker considered to be the important crystal attributes. (Hint: 99% of the time it is price - the lower the better.)
The DS3231 has an internal oscillator that is temperature compensated. It also has other features that may be useful.
I2C is a bus protocol, intended to connect multiple devices. Every device on the bus must have a unique address. Many devices have some form of jumper to change the address (some only have one alternate address where others have more). I can pretty well guess that your LCD and an RTC module will have very different addresses. If all else fails, Google and download "Arduino I2C scanner" (it's a common sketch) and run it with one module connected at a time (this will verify your wiring, that the module works and what address it uses).
You shouldn't need it for what you're doing, but the R4 WiFi has a second I2C port called Wire1 in the QWIIC connector. The cool thing about it is that this one runs at 3.3V. So if you have any 3.3V I2C stuff, you don't need a level converter anymore. You can use the I2C connection from the QWIIC connector.