logo

Tiny Real Time Clock (RTC) I2C module
DS1307 AT24C32 TE187

February 2019

Candid photo

Introduction:

I recently purchased some I2C RTC modules for an Arduino-based project. The specific model was the XCSOURCE version available on Amazon. These modules are based on the DS1307 8 pin IC and worked fine for the project since they can:

  1. Store the time set by the SetTime example (from this library: https://github.com/PaulStoffregen/DS1307RTC)


  2. Return the time with the ReadTest example (from the same library as above).

    Arduino sketches

  3. Provide the real time clock date and time for my project and retain the time when the power is lost (running in low power mode from the battery). There is some drift, the clock may lose or gain a few seconds, but this is acceptable for my application since I only read the time from the RTC when the Arduino boots.

    If I wanted a more precise timekeeper, I would probably purchase something like the Adafruit DS3231 Precision RTC Breakout board i.e. one which has a temperature sensor to help compensate for frequency changes in the crystal.

The problem(s):

There are however some important points to note about these modules:

  1. The supplied battery is NOT rechargeable.

    Most cheap lithium coin cells are not specifically rechargeable. The manufacturer supplied a battery like this:
    Reverse side of the RTC module

    It says CR2032. A real rechargeable battery in this form factor would be labelled LIR2032 and state 'rechargeable' on the back, as shown below.

    A LIR2032 battery

  2. A simple voltage divider (R6 and R4) is used to keep the VBAT value below the *maximum required by the DS1307 (3.50V). This is because a rechargeable lithium battery voltage will typically be around 3.70V and may exceed 4.00V (see below). *The DS1307 compares VCC with VBAT and if VBAT is too high, it will think VCC is too low and stay in it's disabled state.

    LIR2032 datasheet

    The problem here is that if you read VBAT in your project, you will need to convert the reduced value into the real battery voltage (VBAT will be lower).


    Basic RTC circuit

    Also it is worth noting that if you try reading VBAT by connecting it to an Arduino input pin (for example), the battery will be more rapidly discharged, especially when the power is off.

  3. The charging circuit is very simple / basic via R5 (200 ohms) and D1.

    This means that the charging voltage is typically too high for a LIR2032 (assuming VCC is from a 5V USB power supply, for example).

    Only 0.09V is dropped across D1, so assuming VCC is 5.00V, the charging voltage would be 4.91V! The data sheet above for the LIR2032 recommends a charging voltage of 4.20V.

Suggestions:

There are 2 principal / obvious suggestions to resolve the main battery concerns:

  1. If you are happy to use the supplied NON rechargeable battery and accept that it will eventually run down and need replacing in (probably) a few years time you should disable the charging circuit. The easiest way to do that is to remove (de-solder) D1 (or R5) from the module's PCB.
    Front side of the RTC module

    The module seem okay "off the shelf", but it is essentially attempting to recharge non-rechargeable batteries and this may damage the CR2032 and reduce its lifespan.

  2. If you want to replace the supplied battery and use a rechargeable LIR2032 battery instead, you should reduce the battery charging voltage.


    Overcharging a lithium battery can damage it and maybe even cause it to go pop.


    There are several ways to reduce the charging voltage, but I found the simplest / easiest way was to place one or more diodes between the supply voltage and VCC on the module:
    Use of diodes to reduce the voltage

    This is the easiest way I have found because it is convenient, cheap (using easy to locate components) and does not require any soldering work etc on the module itself.

    The diodes reduce the voltage before it reaches VCC on the module board. This in turn means the floating voltage on the battery is reduced to a more suitable level. It can be fine-tuned by selecting one or more diodes with different voltage drops.

    The power supply I am using is quite "beefy" and with a low load (a simple Arduino project) the USB +5V rated supply actually provides 5.22V. This means I needed to use a silicon diode (IN4007) and germanium diode in series to reduce VCC to 4.26V, and the charging voltage on the battery to float at 4.17 (just below the 4.20 recommended value).
    The RTC module seems to be quite happy operating on 4.26V instead of the quoted 5.00V.


Actual Theoretical
Original VCC 5.22 5.00
Drop across silicon diode 0.65 0.65
Drop across germanium diode 0.31 0.31
New VCC 4.26 4.04
Voltage at battery contact 4.17 3.95


Diagram showing how the supply voltage is reduced with diodes:

Diode diagram


I recommend using a multimeter to fine tune the new VCC. You will need to select one or more diodes depending on the power supply you are using etc.

You may find a single silicon diode is sufficient to bring the new VCC to 4.29V or below (assuming 0.09 is dropped across D1), if your power supply is producing 4.94V or less.

NOTE: When selecting diodes, you should remove the battery and connect the positive multimeter probe to the positive battery contact on the RTC module. Then try different diode combinations until the voltage falls to 4.20V or below.


The diodes being used in a breadboard
Photo showing the silicon and germanium diode connected in series between the positive supply voltage and VCC on the RTC module (a rechargeable LIR2032 battery is fitted):


The new VCC voltage (with a silicon and germanium diode in series), as shown on a multimeter.
The voltage supplied to the battery is actually 4.17V in this example (since a further 0.09V is dropped with D1 on the module):

Using a multimeter to check the battery contact voltage

Related links:


BBC News - Technology RSS feed

Clearview AI: Face-collecting company database hacked
27/02/2020 11:10 AM
Google asked to justify Toronto 'digital-city' plan
27/02/2020 03:39 PM
YouTube 'not a public forum' with guaranteed free speech
27/02/2020 02:32 PM
Tim Cook says Apple's first Indian store to open 2021
27/02/2020 12:48 AM
Tesla Autopilot crash driver 'was playing video game'
26/02/2020 02:02 PM
Redcar council IT hack confirmed as ransomware attack
26/02/2020 06:01 PM
Pets 'go hungry' after smart feeder goes offline
25/02/2020 02:35 PM
What happens when the internet vanishes?
25/02/2020 12:54 AM
Met Police chief defends facial recognition from 'ill-informed' critics
25/02/2020 12:15 PM
Young drivers 'let down over insurance app faults'
25/02/2020 12:01 AM


Website by Neo   -   Hosted by Kieran O'Shea