Hi,
I'm trying to use a DS1307 to wake up a power supply via its enable pin, I have the SQW pin inverting via a P-Channel Mosfet connected to the enable pin of a DC/DC converter (TPS61023) also the RTC is connected to the I2C pins with pull ups to an ESP12E.
When the ESP wakes up it applies 3.3V to the RTC VCC pin so it can talk to it.
It looks like I can talk to the RTC as I can try some examples from the RTClib and I get serial data back when I set the SQW pin mode but I cannot see the SQW pin change, it sits at 0V even when set to a squarewave from the ESP12.
Has anyone any experience with this sort of application, the end goal is for the ESP to set the the RTC to wake-up the supply every hour and the ESP can then reset the alarm for an hours time then clear the alarm flag which, I think, will turn off the power?
Sorry, I forgot to mention the issue I have, the DC/DC is enabled by default as the SQW pin is low on a virgin PCB with no programming done and even if I try to switch it off it stays low.
When VCC falls below VBAT, the device switches into a low-current battery-backup mode. Upon power-up, the device switches from battery to VCC when VCC is greater than VBAT +0.2V and recognizes inputs when VCC is greater than 1.25 x VBAT.
With the ESP would be better an RTC that works at 3.3V level.
Or the the ESP deep sleep consumption level (microamperes) would not be enough for your requeriments? instead of an external RTC.
I have experience doing this with a DS3231, which has an alarm output and an alarm flag, but not with a DS1307, which has neither. The datasheet for the DS1307 says:
"Square Wave/Output Driver. When enabled, the SQWE bit set to 1, the SQW/OUT pin outputs one of four square-wave frequencies (1Hz, 4kHz, 8kHz, 32kHz). The SQW/OUT pin is open drain and requires an external pullup resistor. SQW/OUT operates with either VCC or VBAT applied. The pullup voltage can be up to 5.5V regardless of the voltage on VCC . If not used, this pin can be left floating."
So the only thing you could get out of the DS1307 would be at 1Hz, which is far from one hour.
I should also say that typically the mosfet switches the entire power supply, not just the enable pin, particularly if you're using a boost converter which will pass current even when disabled.
Here's an example for use when the power source is less than 5.5V:
You are correct, I've made a mistake by assuming because it had an output pin it was able to trigger it based on an alarm, my bad.
Looking at some other common RTCs it looks like the ones with a alarm function at two or three times the cost of the DS1307 and would blow the budget for the design.
The reasoning behind just controlling the enable pin is that there is another wake-up trigger source, a button, and that will need the ESP to keep itself awake by controlling the enable input itself until it's finished what it's doing and switching itself off
Ok. And my comment about the boost circuit continuing to pass current even when disabled doesn't apply to your boost chip. It has the diode (or probably a mosfet) inside the chip, and presumably prevents current flow when ENable is low. I was thinking of the more basic setup which has an external schottky diode following the inductor. Even if the boost isn't boosting, current will still flow through the inductor and the diode. But in your case that doesn't apply.
I agree that the mosfet is backward. If you draw in the mosfet's body diode, you'll see why it needs to be the other way.
The RTC I use is the DS3231, which has alarms, but they are not cheap, particularly if you insist on using a genuine part.
Note that the 8563 does not provide for a battery (coin cell) backup. You would have to have the regular Vdd supply and the backup supply both connecting to the Vdd pin through diodes, which should automatically switch over as needed. An alternative would be the 8523, which does have a pin for the backup supply. But it would be more expensive. Here's a thread comparing the two:
But I suggest you also search for any known problems with these chips, including possible errata sheets, just to be sure you're not buying into unexpected problems. I know, for example that one of the Microchip RTCs has lots of issues.
That's OK as it doesn't need a backup,it will be permenantley connected to two AA cells, I beleive the current drain falls to 800nA when the I2C communications stop, looking at the datasheet.
This is the first time I've worked with RTCs and it's a learning curve.
One other thing the 8523 has is an offset register, which would allow you to fine tune the crystal frequency and get more accurate timekeeping, if that is important.
Just another idea....
If you could stretch to an esp32 type, you can use the RTC on board. The accuracy is around 0.5% so likely still need to use a DS3231 for best accuracy or DS1307, if that's good enough.
Use the ESP RTC to wake itself from deep sleep, and do whatever you need it to.
Then check the actual time from the I2C attached RTC, and trim the value used in the ESP for its next wake-up time. (That is set in uS).
I used this principle for temperature logging 4 dallas DS18B20 with a Firebeetle. Its Deep Sleep uses <10uA. A 500mAh lipo will last > 12months. That was taking readings 4 times an hour and writing the data every 12 hours to an SD card.
Just wondering, I can't get the idea behind using exactly that hardware.
Have you looked at TPL5110?
Maybe you can use it (you would also need some RTC if you need timestamp).