3
\$\begingroup\$

I bought DS1307 RTC but it is 5V so it can't be connected to the Pi. I know it can be modified to use 3.3V by removing 2 resistors. This sensor is different than the adafruit kit so I am not sure which resistors to remove. It also has 2 sets of pins. What are the extra pins for and which should I use and which pins do I remove?

Here is the image of the RTC:

enter image description here

Here's the datasheet for the DS1307 RTC.

\$\endgroup\$
7
  • \$\begingroup\$ Which one is the RTC, P1 or P2? \$\endgroup\$
    – DominicM
    Jan 31, 2014 at 21:10
  • \$\begingroup\$ I guess it's P1 because of the oscillator. So essentially it is 2 devices on 1 pcb divided in half at the center with no interaction at all? \$\endgroup\$
    – DominicM
    Jan 31, 2014 at 21:13
  • 1
    \$\begingroup\$ Vbat pin: Backup Supply Input. SQW/OUT (SQ in your board): Square Wave/Output Driver. Read page 6 of the datasheet \$\endgroup\$
    – alexan_e
    Jan 31, 2014 at 21:48
  • 3
    \$\begingroup\$ @alexan_e saying they are independent without a schematic or board layout or even a good picture is wrong. For one, i2c is designed as a bus protocol. Having both ics on separate i2c buses would be stupid. P1 to P2 is most likely pass through. \$\endgroup\$
    – Passerby
    Feb 1, 2014 at 1:45
  • 1
    \$\begingroup\$ @Passerby I have a similar board and I thought they were independent but I was wrong, I have stated that the I2C lines are connected in my reply, maybe I should delete my comment to avoid any confusion \$\endgroup\$
    – alexan_e
    Feb 1, 2014 at 1:51

4 Answers 4

7
\$\begingroup\$

In order to make it work with 3.3v lines you have to remove the two pull-up resistors connected between SCL->5v and SDA->5v and then use 3.3v pull-up resistors on the MCU side (unless they are already integrated).

In the board I see four 332 (3k3) resistors which are definitely the pull-ups, just locate which two connect to the relevant I2C pads, it shouldn't be difficult with an ohmmeter.


Your RTC connection pins are on the right side (P1 header)

I finally managed to find a schematic here

enter image description here

The pull-ups for the RTC I2C lines are R2 and R3

enter image description here


According to the schematic and the comments in the reference site, the SCL and SDA lines of both headers are interconnected.
There is also a DS pin (one in each side, interconnected), it is currently unused but is intended for the 1wire signal of a DS18B20 temperature sensor which can be added on the board in the three pads located in the left top side.

enter image description here

\$\endgroup\$
8
  • \$\begingroup\$ I found the datasheet for the RTC and I can just about see the traces so I can figure it out without an ohmmeter. \$\endgroup\$
    – DominicM
    Jan 31, 2014 at 21:29
  • \$\begingroup\$ What do you mean by 3.3V resistors? I am connecting it to Raspberry Pi so I think I don't need additional resistors as Raspberry Pi has them integrated. \$\endgroup\$
    – DominicM
    Jan 31, 2014 at 21:41
  • 1
    \$\begingroup\$ @DominicM I was talking for microcontroller I2C lines in general, if your board has these pull-ups already then you don't need to add anything \$\endgroup\$
    – alexan_e
    Jan 31, 2014 at 21:46
  • 1
    \$\begingroup\$ Removed R2 and R3 resistors and it worked perfectly.Thank you! \$\endgroup\$
    – DominicM
    Feb 7, 2014 at 2:41
  • \$\begingroup\$ I tried removing resistors etc, but it won't work because Vcc needs 5V in order to work properly. The only option (as far as I can find) is to use a 3.3 - 5 V DC/DC or just buy the DS1672 or other 3.3 V native RTC. \$\endgroup\$
    – user53253
    Sep 15, 2014 at 7:03
1
\$\begingroup\$

In order to make these modules to work good with Raspberry Pi and CR2032 (non-chargable) battery, you need to:

  1. remove diode and ALL resistors

  2. short pins where r6 were placed

  3. solder the crystal to the pad below it

  4. (optionally) remove the 24C32 I2C memory chip (the one one the right)

  5. connect SDA/SCL/GND to the RPi corresponding pins, connect the Vcc pin to the 5V on the RPi. Here's the pinout of RPi.

\$\endgroup\$
1
\$\begingroup\$

Alexan_e's accepted answer is not a good solution. Having 3.3V I2C lines on the 5V DS1307 makes it operate out-of-spec. (Powering the DS1307 from a 3.3V source is even worse.)

A better solution is to swap the DS1307 for the pin-compatible NXP PCF85263A. The latter can operate from 1.8V, is superior to the DS1307 in every aspect, and costs less than a dollar (less than a third the DS1307's price).

You can find a comparison between the two here.

Note: the RTCs are hardware compatible, but you'll have to modify your software.

\$\endgroup\$
1
  • \$\begingroup\$ Why is it out-of-spec with 3.3V lines (and 5V VCC)? The DS1307 datasheet says 2.2V min for logic high. Or are those pullups required by I2C regardless? Thanks. \$\endgroup\$
    – Sz.
    Aug 30, 2016 at 14:43
0
\$\begingroup\$

I have the exact same module and it works just fine with the 5 Volt pins on the Banana Pro which is pin-compatible with the Raspberry Pi. Pins 2 and 4 are 5 Volt. enter image description here

\$\endgroup\$
1
  • \$\begingroup\$ On other answer when they talk about 5v, is not the about the VCC. it's about the SDA and SCL that uses 5v, where raspi uses 3.3v. \$\endgroup\$
    – llazzaro
    Feb 24, 2017 at 5:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.