# DS1307 not detected by i2cdetect

**URL:** <https://forums.balena.io/t/ds1307-not-detected-by-i2cdetect/20123>\
**Category:** balenaFin\
**Created:** [July 16, 2019, 1:17pm UTC](https://forums.balena.io/t/ds1307-not-detected-by-i2cdetect/20123 "2019-07-16T13:17:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![scholz](https://avatars.discourse-cdn.com/v4/letter/s/e47c2d/32.png) [@scholz](https://forums.balena.io/u/scholz)\
**Post date:** [July 16, 2019, 1:17pm UTC](https://forums.balena.io/t/ds1307-not-detected-by-i2cdetect/20123/1 "2019-07-16T13:17:44Z")

</div>

I have the following setup:

- BalenaFin v1.1 with CM3+ lite attached
- RTC battery (fresh, measured 3.24V) placed in its socket
- flashed Raspbian Stretch (using Balena Etcher)
- I2C activated in raspi-config -\> Interfacing Options -\> I2C
- last line of /boot/config.txt is “dtoverlay=i2c-rtc,ds1307”

However, the output of “sudo i2cdetect -y 1” still shows that there is no I2C device.  
Other I2C devices (for example an ADS1115 a/d-converter) are seen by i2cdetect (after connected to the I2C pins), so I guess the I2C bus itself is working.

I also tried flashing the following operating systems and got the same result:  
Raspbian Jessie  
Raspbian Buster  
Raspbian (balena version from [https://www.balena.io/fin/1.1/docs/downloads/](https://www.balena.io/fin/1.1/docs/downloads/))

Am I missing something?  
Is there any way to tell if the RTC module is working/broken?

Any help would be appreciated.

// Philipp

---

<div class="post-metadata">

**Author:** ![thundron](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/thundron/32/1379_2.png) [@thundron](https://forums.balena.io/u/thundron)\
**Post date:** [July 16, 2019, 4:18pm UTC](https://forums.balena.io/t/ds1307-not-detected-by-i2cdetect/20123/5 "2019-07-16T16:18:30Z")

</div>

Hi and welcome to the forums!  
You could try using the `timedatectl` utility: if that shows the RTC output, then RTC is working.  
More info on that [here](https://www.freedesktop.org/software/systemd/man/timedatectl.html)  
Tell us if this solves your issue or if you need anything else!

---

<div class="post-metadata">

**Author:** ![scholz](https://avatars.discourse-cdn.com/v4/letter/s/e47c2d/32.png) [@scholz](https://forums.balena.io/u/scholz)\
**Post date:** [July 17, 2019, 5:30am UTC](https://forums.balena.io/t/ds1307-not-detected-by-i2cdetect/20123/7 "2019-07-17T05:30:11Z")

</div>

Hi,  
the ouput of `timedatectl` on Raspbian Stretch says `RTC time: n/a`.

If I flash the balena-preconfigured Raspbian, `timedatectl` says `RTC time: Wed 2019-07-17 05:17:47`.  
The command `i2cdetect -y 1` still indicates that no I2C device is found, but the RTC seems to work.

This would mean that some configuration step is missing on Raspbian Stretch apart from these:

- I2C activated in raspi-config -\> Interfacing Options -\> I2C
- last line of /boot/config.txt is “dtoverlay=i2c-rtc,ds1307”

Can anyone give me a hint what I am missing?

---

<div class="post-metadata">

**Author:** ![scholz](https://avatars.discourse-cdn.com/v4/letter/s/e47c2d/32.png) [@scholz](https://forums.balena.io/u/scholz)\
**Post date:** [July 17, 2019, 9:26am UTC](https://forums.balena.io/t/ds1307-not-detected-by-i2cdetect/20123/8 "2019-07-17T09:26:16Z")

</div>

Hi,  
just made it work. Here is my setup now:

- BalenaFin v1.1 with CM3+ lite attached
- RTC battery (fresh, measured 3.24V) placed in its socket
- flashed Raspbian Stretch (using Balena Etcher)
- I2C activated in raspi-config -\> Interfacing Options -\> I2C
- added to /boot/config.txt: “dtoverlay=balena-fin”
- added to /etc/modules: “rtc\_ds1307”

Why it didn’t work:

- I assumed that the DS1307 was on i2c-1 (as described on [https://learn.adafruit.com/adding-a-real-time-clock-to-raspberry-pi/set-rtc-time](https://learn.adafruit.com/adding-a-real-time-clock-to-raspberry-pi/set-rtc-time)). Instead, the RTC is on i2c-3, which is not available without using “dtoverlay=balena-fin”.
- Adding “dtoverlay=i2c-rtc,ds1307” does not load the module “rtc\_ds1307”. Without that, “timedatectl” does not give an RTC output. I had to load the module explicitly in /etc/modules

Thanks for the hint with `timedatectl`, that led me on the right track.

Greetings

// Philipp
