Hello,
After successfully created a prototype using an Arduino Leonardo (A000057) and a Tiny rtc module I want to make more but I can't get the rtc modules to work.
The wiring and code is exactly the same as the prototype, but I get a random response (like:165/25/165 85:45:85), this even continues after disconnecting the rtc module.
After searching the internet I found the i2c scanner program and this cannot find an i2c device. When connecting the rtc module from the prototype it works, so the problem is not on the Arduino side nor programming.
I tried with 3 different rtc modules, all with the exact same problem.
#include "Arduino.h"
#include "uRTCLib.h"
// uRTCLib rtc;
uRTCLib rtc(0x68);
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
void setup() {
Serial.begin(9600);
delay(3000); // wait for console opening
URTCLIB_WIRE.begin();
// Comment out below line once you set the date & time.
// Following line sets the RTC with an explicit date & time
// for example to set January 13 2022 at 12:56 you would call:
rtc.set(0, 49, 13, 3, 13, 6, 23);
// rtc.set(second, minute, hour, dayOfWeek, dayOfMonth, month, year)
// set day of week (1=Sunday, 7=Saturday)
}
void loop() {
rtc.refresh();
Serial.print("Current Date & Time: ");
Serial.print(rtc.year());
Serial.print('/');
Serial.print(rtc.month());
Serial.print('/');
Serial.print(rtc.day());
Serial.print(" (");
Serial.print(daysOfTheWeek[rtc.dayOfWeek()-1]);
Serial.print(") ");
Serial.print(rtc.hour());
Serial.print(':');
Serial.print(rtc.minute());
Serial.print(':');
Serial.println(rtc.second());
delay(1000);
}
Obviously there is something different between the two in that case.
Don't see how anyone could resolve what you have in front of you except to say, find the difference by means of substitution.
Took a better look at the rtc modules themselves.
The working module is actually called HW-111 and the once not working Tiny rtc.
On the working module there is no R7 installed and R2 and R3 are 332.
On the not working modules R2 and R3 are 472.
It removed R7 on one of them, no change.
As far as I've understood from internet this are simply version differences.
When I measure between BAT and GND there's about 3V on the working module, the modules that aren't working indicate 0V.
Any suggestions what this means ?
Same thing. Connecting the working rtc module and all is fine again.
I also tried to just disconnect the SCL and SDA wires from the good module and I get the same weird response. Connecting them back and it's responding with the correct time again.
There must be a communication problem with the faulty modules. SLC and SDA are connected correctly on all 3 modules I tried. I checked this a 100 times.
I found the problem. For anyone experiencing the same:
Apparently, the ground pins weren't actually connected to anything.
I now soldered the ground wire to the ground pin of the DS18B20 temperature sensor which actually is connected to ground, and it's working fine now.