Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
KC868-A6 DS1307 Issue
#1
Hi there

I'm having an issue with getting the KC868-A6 RTC working.

I've taken the example code in the A6 thread as per below, and it returns an error of "Couldn't find RTC".

I've made sure that the I2C SDA and SCL pins are set correctly in the NodeMCU-32S config file.

The RTClib I've used is the Adafruit library below:
https://github.com/adafruit/RTClib

The battery has been installed into the socket on the board.  I've successfully coded up things so that the PCF8574 outputs and inputs to work so I know that the I2C SDA and SCL are working.

The comments in the example code mention the Wire lib, so I've tried including this as well, but it didn't fix the problem.

Any thoughts would be appreciated.


/*KC868-A6 DS1307 CODE*/
// Date and time functions using a DS1307 RTC connected via I2C and Wire lib
#include "RTClib.h"

RTC_DS1307 rtc;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

void setup () {
  Serial.begin(115200);

#ifndef ESP8266
  while (!Serial); // wait for serial port to connect. Needed for native USB
#endif

  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    Serial.flush();
    while (1) delay(10);
  }

  if (! rtc.isrunning()) {
    Serial.println("RTC is NOT running, let's set the time!");
    // When time needs to be set on a new device, or after a power loss, the
    // following line sets the RTC to the date & time this sketch was compiled
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
  }

  // When time needs to be re-set on a previously configured device, the
  // following line sets the RTC to the date & time this sketch was compiled
  // rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  // This line sets the RTC with an explicit date & time, for example to set
  // January 21, 2014 at 3am you would call:
  // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}

void loop () {
    DateTime now = rtc.now();

    Serial.print(now.year(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.day(), DEC);
    Serial.print(" (");
    Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
    Serial.print(") ");
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();

    Serial.print(" since midnight 1/1/1970 = ");
    Serial.print(now.unixtime());
    Serial.print("s = ");
    Serial.print(now.unixtime() / 86400L);
    Serial.println("d");

    // calculate a date which is 7 days, 12 hours, 30 minutes, and 6 seconds into the future
    DateTime future (now + TimeSpan(7,12,30,6));

    Serial.print(" now + 7d + 12h + 30m + 6s: ");
    Serial.print(future.year(), DEC);
    Serial.print('/');
    Serial.print(future.month(), DEC);
    Serial.print('/');
    Serial.print(future.day(), DEC);
    Serial.print(' ');
    Serial.print(future.hour(), DEC);
    Serial.print(':');
    Serial.print(future.minute(), DEC);
    Serial.print(':');
    Serial.print(future.second(), DEC);
    Serial.println();

    Serial.println();
    delay(3000);
}
Reply
#2
we have used this RTC arduino library, you can try to use this.

.zip   RTClib.zip (Size: 49.39 KB / Downloads: 244)
Reply
#3
(10-23-2022, 10:39 AM)admin Wrote: we have used this RTC arduino library, you can try to use this.

Thanks for this.

We tried this library and we get the exact same issue where the RTC couldn't be found.

I've also done an I2C scan, and the only 2 addresses are found which are the PCF8574 chips (0x22 and 0x24).

What else might be causing the RTC to not be found?

Looking closely at the circuit board, just near the DS1307 chip, the capacitors C1 and C2 are missing.

Would this be the issue?
Reply
#4
we have tested, not C1,C2 problem. C1, C2 not need to use. you can download our BIN file directly to test.

.zip   ds1307.ino.nodemcu-32s.zip (Size: 110.08 KB / Downloads: 231)

   
   
   
   
Reply
#5
Wink 
Hi
Thanks for all the info - very much appreciated.

I can confirm that:
- I've been adjusting the SDA and SCL in the pins_arduino.h file
- I've selected the NodeMCU-32S device
- I'm running the same ESP32 version (1.0.6)
 - I'm running the RTC library that you provided in the ZIP file

The RTC chip still can't be found.

I've attached the output of an I2C scan below:

21:53:09.314 ->
21:53:14.298 -> Scanning...
21:53:14.298 -> I2C device found at address 0x22  !
21:53:14.343 -> I2C device found at address 0x24  !
21:53:14.343 -> I2C device found at address 0x3C  !
21:53:14.343 -> done
21:53:14.343 ->

It's finding the 2 PCF8574 chips and it's finding the SSD1306 display.
Normally I would expect the DS1307 RTC chip to also be listed, with an address of 0x68 but it's not showing up. 
I've tried removing the SSD1306 display but in this scenario it just shows the 0x22 and 00x24 devices.
If I connect the SSD1306 display via the IIC Header and it works fine via that as well.

I tried uploading the .bin to the A6 using the esptool that comes with the Arduino IDE, but after successfully uploading it, the A6 went into a continuous reboot cycle.

I tried the BIN file again and managed to get it working.
It returns a "Couldn't find RTC" message.
Reply
#6
here is source code i am using.  you can compile in arduino ide and upload to ESP32.

.zip   ds1307.zip (Size: 1.01 KB / Downloads: 226)
download bin need to set address.

if you really can't work, you can compile in arduino ide export a BIN file upload to here, i download it see whether KC868-A6 RTC work well.
Can you compare my photos carefully to see if there are any missing components on the PCB board.
Reply
#7
Hi again
I've looked over the board and I can't see anything missing or any cracks in any tracks etc.
I've included the ds1307 bin file.
Thanks  Smile


Attached Files
.zip   ds1307.zip (Size: 110.07 KB / Downloads: 183)
Reply
#8
ok, tomorrow we will check it.
Reply
#9
tested your BIN file, work well. make sure download to 0x10000 address, see the photo.
   
Reply
#10
Hi there

I'm glad to hear my bin file worked on your KC868-A6.

I successfully loaded your bin file to my KC868-A6 using that address and it returned the error "Couldn't find RTC".

To summarise:
 - my bin file works on your A6,
 - your bin file works on your A6
 - my bin file doesn't work on my A6
 - your bin doesn't work on my A6

I think the only conclusion we can now draw is that there is a fault with my KC868-A6.

What are the next steps?  How do I arrange to get a replacement?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)