I often use a data logging shield with an UNO, with the RTClib. When I try to use this library with the R4 MINIMA, nothing happens. Do I have to make some changes in the .h or .cpp files for this library? I already found that I had to modify a software library for a sensor to work with the R4.
The RTC on the UNO R4 Minima can be accessed using the RTC library that is included in the UNO R4 Board Package. This library allows you to set/get the time as well as using alarms to trigger interrupts
➜ https://docs.arduino.cc/tutorials/uno-r4-minima/rtc/
or are you saying you added an external RTC like a DS3231 that you want to access?
What is this Logging Shield -- is it a DS3231 RTC (Fig-1) or a DS1307 RTC (Fig-2)?
Figure-1:
Figure-2:
It's a DS1307 RTC shield.
If you are using RTC Module of Fig-2 of post #3, then it is a breakout board and NOT a shield.
"[quote] If you're familiar with Arduino shields, you might be wondering what's the difference between shields and breakout boards. The most noticeable difference is size. Unlike shields, breakout boards don't use the whole surface of Arduino to accomplish what they need to . They use much less space and pins."
For example: Fig-1 is a Motor Driver Shield for UNOR3/UNOR4 boards. Fig-2 is a Motor Driver breakout board for any Arduino board.

Figure-1:

Figure-2:
The RTCLib.h on which my DS1307 Module was running alright with UNOR3, now the same Module is running ok with the same Library with original UNOR4WiFi.
Output:
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 rtc;
DateTime myDT;
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
byte lastReadSecond = 0;
void setup ()
{
Serial.begin(9600);
Wire.begin();
Wire.beginTransmission(0x68);
byte busStatus = Wire.endTransmission();
if (busStatus != 0)
{
Serial.println("RTC is not present.");
while (true);
}
Serial.println("RTC is present.");
rtc.begin();
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// rtc.adjust(DateTime(2021, 12, 31, 01, 59, 57));//set date-time manualy:yr,mo,dy,hr,mn,sec
}
void loop ()
{
myDT = rtc.now();
if (lastReadSecond != myDT.second())//wait 1-sec as long as they are equal = 1s has not gones
{
showTimeDate();//1-sec has e;apsed; show time and date
}
}
void showTimeDate()
{
//update to the new second
myDT = rtc.now();
lastReadSecond = myDT.second();
//------------------------------
Serial.print(myDT.year(), DEC);
Serial.print('/');
//-----------------------------
Serial.print(myDT.month(), DEC);
Serial.print('/');
Serial.print(myDT.day(), DEC);
Serial.print(" (");
Serial.print(daysOfTheWeek[myDT.dayOfTheWeek()]);
Serial.print(") ");
//-----------------------------
byte myHour = myDT.hour();
myHour = myHour - 12;
if (myHour < 10)
{
Serial.print('0'); //show leading zero
}
Serial.print(myHour, DEC);
Serial.print(':');
//-----------------------------
byte myMin = myDT.minute();
if (myMin < 10)
{
Serial.print('0'); //show leading zero
}
Serial.print(myMin, DEC);
Serial.print(':');
//--------------------------
byte mySec = myDT.second();
if (mySec < 10)
{
Serial.print('0'); //show leading zero
}
Serial.print(mySec, DEC);
//----------------------------
Serial.println();
}
You don’t need an external (and DS1307 is of poor quality) RTC with a UNO R4. there is one built in.
DS1307 has a battery backup which is missing for the RTC of UNOR4.
Hi @brooksdr
You'll require an external RTC module, as Uno R4 Minima board lacks an external 32.768kHz crystal with which to keep accurate time.
On the Uno R4 Minima the RTC is instead clocked by the microcontroller's on-chip LOCO oscillator. The Renesas RA4M1 datasheets states that the LOCO's accuracy can vary between between 27.86kHz and 37.68kHz. This means its timekeeping could be out by as much as ±3hours and 35 minutes per day.
Fair point. The VRTC pin can be used to keep the onboard RTC (Real Time Clock) running even when the boards main power supply is turned off So just need to add the battery ![]()
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.


