Fixing Wemos D1 Mini RTC module

By | 2018-08-26

I have bought two pieces from the same RTC (Real Time Clock) module for the Wemos D1 Mini (aka. “WIFI D1 MINI Data loggar shield”) from China. The idea here is to keep a time-sensitive smart-thing working even without internet.

Is the module faulty?

This module utilizes the DS1307 RTC chip, that always requires the backup battery, so I have inserted the CR1220 battery into the slot. I have used the Makuna/Rtc Arduino library.

When I tried to use the module, everything appeared to be working correctly. But after some days of I have realized that something is wrong.

The Makuna/Rtc library has a method for checking time validity in the sample code:

Rtc.Begin();
RtcDateTime compiled = RtcDateTime(__DATE__, __TIME__);
if (!Rtc.IsDateTimeValid()) 
{
  Serial.println("RTC lost confidence in the DateTime!");
  Rtc.SetDateTime(compiled);
}

Now this sample turns out to be problematic. It was part of my initialization phase, but when I plug the Wemos into the USB and I open the serial console, the initialization phase was already passed. So I can never see this message. What I saw is that the time is off.

So what I did is to disable setting the date in the initialization phase, and instead let the thing run in a “time-unknown” state until the time was set properly.

With this modification it turned out, that the module always loosing the date when not powered.

So I have checked the CR1220 battery and it was dead. It was very suspicious, as an RTC module should run for years with the same battery.

At this point I was pretty sure, that the module is not working as expected.

Investigating the circuit

So instead of inserting a new coin cell, I was hooked my bench-top lab-power-supply, and set it to maximum 0.3 Amps output at 3Volts.

When I turned it on the module immediately maxed out the 0.3 Amps, as seen in the picture above. So, yes. Definitely something is wrong. And yes. Both modules I have purchased suffered from the same problem. (Of course I have made a visual inspection and checked for shorts, but no problems there.)

Schematics from robotdyn.com

According to the schematics, there is a diode and a resistor connected parallel with the battery. These are the only components, that can make trouble, as otherwise the DS1307 is okay. I have checked the diode (with the diode tester of my multimeter) with no batteries inserted. It seams that the diode is defective.

Now, I’m not an expert in circuit design, but with my knowledge I don’t understand the goal of this two components. Searching online for DS1307 circuits, there is no mention of adding such components. So I decided to completely remove both of this extra items.

(Off-circuit I have again tested the diode, and yes, the diode was indeed defective.)

Final note

Before you insert coin cell into this module, you should either test the diode on it, or to be on the safe side you can safely remove both the diode and the 2MOhms resistor. (Or just buy things from proper sources.)