First of all I am sorry for starting a new topic on this but all other DS1307 topics are closed
Datasheet says that DS1307 requires 5v supply. Does that mean that I need level shifters when interface this module to my ESP32 board?
I just connected the module to 3.3v and works just fine. I didn't use a backup battery as I didn't remove charging circuit yet. It keeps time while powered and onboard eeprom (at24c32) is accessible for read/write (tested). NVRAM is accessible. I.e Time, EEPROM, NVRAM - all works. Should I leave it as is or mess with 5v supply and level shifters?
Thanks
Is this ok to power it from 3.3v or I have to power it from 5v and use level shifters?
Just do an experiment:
Get a DS1307 based RTC Module (Fig-1) with 3V Coin Battery installed, and connect it with ESP32. Check if the RTC is working or not. The operating specifications of DS1307 chip will be analysed based on the result of your experiment.
If you have WiFi near, then why a RTC.
The ESP, with daily NTP updates, could be as good as a DS1307.
The only reason for a (possibly mediocre 1307) RTC would be a power-up without WiFi near.
Time/RTC is built into the latest ESP32 core, and requires only a few lines of code to tell the MCU where on the planet you are. Then daylight savings is also included. See this post.
Leo..
It looks like the I2C bus can be operated at 3.3V while the DS1307 is powered by 5V, if the I2C pullup resistors are connected to 3.3V. The 24C32 EEPROM adds a bit of complexity, since it is likely connected to the same 5V line as the DS1307.
Something else to keep in mind, the DS1307 has a maximum I2C clock frequency of 100KHz.
You should not remove R4-R6 network of the Battery circuit for the following reason. Removal of the charging circuit may appear ok as the CR2032 coin cell is non-rechargable and yet it can keep the clock circut running for about 3 years.
R4 limits the supply current to the RTC resulting extended life of the battery. R6 helps to sense the stable presence of Battery at the time of switching power on the Battery.
According to the DS1307 datasheet the battery is connected straight to IC's vbat, no resistors there. I don't use BAT pin on the board, i do not need to monitor the CR2032 voltage. I need the RTC to be alive on rare occasions when I have to power off the whole thing (solar panel/lead-acid battery maintenance) .
I have 11 pages data sheests for the DS1307 RTC, which does not show the Battery connection. The Block diagram has shown the Battery Terminal. It is up to the designer to implememnt most technically valid circuit. The reference schematic (Fig-1) of DS1307 RTC Breakout Board has included the R6(510 k) - R4 (1.5 M) network for good reasons as I have metioned in post #11.
Figure-1:
The clock circuitry of the RTC continuously monitors VCC and VBAT supply to implement that -- 1. If VCC <= 1.5xVBAT, access to the device by the host MCU is inhibited to prevent erroneous read/write operation.
2. If If VCC <= VBAT, the device switches into a low current battery backup mode.
There is a comment from another forum on the battery->ground resistor (1.5M). Ther refer to it as to R1
Apart from the problems mentioned above I found another interesting one when running without a battery, the Vbat pin is also a threshold voltage for I2C lockout and unless there is a bleed in R1 (I used 10Meg) Vbat rises to VCC due to chip leakage & consequentially I2C is locked out. This resistor does load the battery (300nA) and if I had a higher value in my junkbox I would have used it on the basis the leakage is probably <20nA
However, I think, keeping R4-R6 is good for the RTC. In the case of sudden switch over to Battery power, the clock circuit may draw inrush current from the battery, which can only be limited by R6.
It has no purpose if you replace the rechargeable battery from the original circuit with a primary battery source. It should be replaced with a jumper wire.
If you will look at the details of the charging circuitry of OP's board you will see that R6 and the other components limit the potential at Vbat input to the data sheet range of 2V to 3v5 during the two modes of operation. Power applied and battery backup.