Arduino Forum

Products => Arduino Due => Topic started by: shteii01 on Feb 14, 2013, 11:00 pm

Title: DS1307 RTC + Due + i2c
Post by: shteii01 on Feb 14, 2013, 11:00 pm
I need a little bit of guidance.  I want to use Adafruit DS1307 shield, connected to Arduino Due board, using i2c.

Arduino Due i2c is setup to use:
Logic Low: 0 volt
Logic High: 3.3 volt

Looking at DS1307, its i2c is setup to use:
Logic Low: 0 volt
Logic High: 5 volt

So.  When I sent date and time from DS1307 to Due, I will be sending 0 volt and 5 volt.  I assume 5 volt will be too much for Due.  I don't want to break my Due.  What are my options?
Title: Re: DS1307 RTC + Due + i2c
Post by: chriskner on Feb 15, 2013, 03:35 pm
You need a voltage translator to interface the DUE's 3.3V logic to the DS1307's 5V logic.

Something like this should work (but there are also many, many others): (

See fig 10 of the P82B96 datasheet.  The +5V pullup you see on the left of this figure is already taken care of on the DUE board (it is actually pulled up to 3.3V on the DUE pcb).
Apply 5V (Vcc) to the P82B96 ("pin 8"), and add your own pullup resistors to 5V for SDA and SCL that go to the DS1307's I2C interface (10k are usually fine).
This figure shows one-half of the connections.  You would need to connect the SCL line in a similar manner.

The DS1307 maxes out at a 100KHz I2C clock.  The DUE's default I2C clock rate is 100KHz.

Some warnings about I2C on the DUE:

I can't believe I mentioning this, but:
The DS1307 may work if you attach the I2C lines (SDA and SCL) to the DUE directly (without using the translator chip).  Be absolutely certain that there are not any existing pullup resistors on the DS1307 I2C lines.  If there are existing resistors, then you need to remove them completely from the DS1307 board, as these resistors are probably connected to +5V (which is undesirable/dangerous for the DUE).  I am not familiar with the adafriut DS1307 board, you will need to figure this out yourself. (

Not using a proper voltage translator chip may result in inconsistent operation of the DS1307, but no damage should be done to either the DUE or the DS1307 (as long as the warnings shown above are understood and followed).

If you don't understand these issues, then please Google some more, and then ask more questions here...

Good luck!

Title: Re: DS1307 RTC + Due + i2c
Post by: shteii01 on Feb 15, 2013, 05:17 pm
Chris, thank you for your help.  The Adafruit DS1307 shield does have two pullup resistors, 2.2 kOhm each.  I just double checked it.  So yes, I was hooking up the DS1307 shield to Due with the 2.2 kOhm external pullup resistors and it worked, but yes, I don't know how long the Due would have lasted, and I want it to last for a long time..

In the Raspberry Pi pdf, page 4, I found this information, apparently Pi is also 3.3 volt system:

To make the job really easy, we'll use the the Adafruit
DS1307 RTC Breakout Board Kit ( it comes with all the parts you need,
even a coin battery!
The Kit does require a little light soldering. In theory you could use all the parts and build them
onto a breadboard, but the coin holder is a little difficult since its not breadboard-friendly, so
please go ahead and build the kit. (

When building the kit, leave o ut the 2.2K&o hm; resisto rs - by leaving them o ut,
we fo rce the RTC to communicate at 3.3V instead o f 5V, which is better fo r the

Wiring is simple:
1. Connect VCC on the breakout board to the 5.0V pin of the Pi
2. Connect GND on the breakout board to the GND pin of the Pi
3. Connect SDA on the breakout board to the SDA0 pin of the Pi
4. Connect SCL on the breakout board to the SCL0 pin of the Pi


The diagrams below show the 2.2K? resistors in place - but plleasse rremove tthem
eiittherr by nott ssollderriing tthem iin orr cclliippiing tthem outt iiff you diid ssollderr tthem iin!! Thiiss
way,, we''llll usse tthe Pii''ss 1..8K pullll--up rressiissttorrss tto 3..3V

This is the clearest explanation I have found so far of what to remove and where.  So I am going to remove the two 2.2 kOhm resistors from the Adafruit DS1307 shield. 
Title: Re: DS1307 RTC + Due + i2c
Post by: SomeRandomGuy on Feb 18, 2013, 09:22 pm
I have gone through this too. Yes, the two resistors on the DS1307 breakout board pull the I2C lines up to 5V. This is NOT what you want. Remove/Don't Install those resistors and connect your own from the 3.3V supply on the board to the I2C lines. You can do this on a proto shield or something, on the arduino side of the I2C lines. The DS1307 will need 5V connected to its VCC pin, but it will not bleed over onto the I2C lines with those resistors on the breakout board removed  :)

In summary, do not attach these resistors

Instead, attach resistors from the 3.3V supply of the Due to the Due's I2C pins.

On the breakout board:
VCC = 5V
GND = gnd
SDA = Due SDA pin
SCL = Due SCL pin.

The resistor values on the Due side will require some playing with. As mentioned above, the Due will not drive/sink much current at all. Let me know if you find a combination that works best. It will also depend on the length of your wires.

Best of Luck!
Title: Re: DS1307 RTC + Due + i2c
Post by: AaronA on Dec 19, 2014, 10:56 pm
Was there any resistor values that worked for anyone? I am trying to figure that out right now.
Title: Re: DS1307 RTC + Due + i2c
Post by: Hammus on Oct 07, 2015, 06:48 pm
Was there any resistor values that worked for anyone? I am trying to figure that out right now.
I just learned that 2k is a good value that worked for me. I started with 10k, but the clock was freezing a few times a day. Then I tried 4k, and it was freezing once or twice a day. With 2k everything seems to be running fine.

I'm glad this thread was here, because it helped me figure out how to get this RTC working with the Due.