Core Electronics Forum

DS1307 RTC Module with Battery for Raspberry Pi (DFR0386)


#1

This is a placeholder topic for “DS1307 RTC Module with Battery for Raspberry Pi” comments.



This RTC module is specifically designed for the Raspberry Pi. It communicates with Raspberry Pi through I2C bus and includes a Maxim DS1307 and CR1220 button cell on the board to keep a real time clock for a long time after the Pi has powered down. Just set a serial port, and you have a convenient way of online debugging using TTL. Supports Raspberry Pi B/A+/B+/2 model B/3 model B.


Read more


#2

How does this 5V device (with no level-shifting) not damage a 3V3 logic-level device, such as a Pi (with no 5V tolerant GPIOs)?


#3

Hi Peter,

There are inline resistors on the I2C pullups, so it’s safe to use with Raspberry Pi. This approach makes it a lot easier to use the DS1307 (or any I2C device) with any 3.3-5V hardware.

image


#4

Hi Graham,
Thank you for your prompt response!

As you stated, they are pull-ups; they pull the IIC signals to 5V when the master or slave is not pulling the level to logic-LOW (perhaps the slave uses open- collector/drain).

Hence, I would expect 5V will appear on the IIC GPIOs of the Pi. However, the 5k resistors will limit the current from the 5V rail to the 3V3 master device to ( (5-3.3)/5k ) 340 micro-Amps, which, I guess, prevents damage (the Pi must be able overcome this to maintain 3V3, risky!). This may not be the case with all 3V3 master devices!

The DS1307 can only be supplied with 4.5 to 5.5V, but the minimum logic-HIGH level is 2V2, great!

To be safe, for a 3V3 master, I would have tied these to 3V3! A jumper to select 3V3 or 5V would be ideal.


#5

Hi Peter,

No worries, happy to help. There’s nothing risky about it; in addition to the 5k resistors are the internal 1k8 resistors wired between GPIO 2/3 (SDA/SCL) and 3V3, the RPi is going to be fine.


#6

Hi Graham,
From my calculations, 5k in series with 1k8 gives a voltage drop of 0V45 across 1k8; add the 3V3 and there should be appox. 3V75 where they meet (SCL and SDA).

Lets give the calculations a break and measure it: Approximately 3V85: Above spec, risky!
I used Sparkfun’s “DS1307 RTC Module”, which uses 4k7 pull-ups.

DF Robot’s DFR0151 utilises 3k3 pull-ups, while Adafruit’s 264 uses 2k2 pull-ups. According to my calculations, that approx. results in 3V9 and 4V1, respectively. I’ll measure the real-world values when I get some time!

I understand this somehow works and has worked for a long time with many people, but I wouldn’t do it!
If it wasn’t for the internal 1k8 pull-ups, the master would “see” 5V!
It’s just too much for an Electrical and Electronic Engineer to assume/risk.


#7

Hi Peter,

I hear you, the lack of datasheet for BCM2837B0 / other RPi-only Broadcom chips can leave people feeling polarised on this topic. Rest assured it’s safe given the internal hardware and ample use-cases of this nature.

To be clear though; RPi is not 5V tolerant. This situation is quite different as I2C typically uses an open drain design and there’s plenty of input impedance to accommodate a simple method, safely.


#8

Thanks Graham,
Just for completeness, using the DFR0151 and Adafruit 264, 4V2 and 4V0, respectively, is applied to the IIC pins of a Pi3. It does work and doesn’t seem to create any issues!

I recommend the DS3231 for 3V3 logic-level master devices: ADA3013 (I have used a fair bit) and ADA3028 (Slightly cheaper, “sits” flat, larger, but I haven’t used it, yet!).