OpenSprinkler › Forums › Hardware Questions › OpenSprinkler › RTC chip
- This topic has 13 replies, 2 voices, and was last updated 3 days, 1 hour ago by kakas.
-
AuthorPosts
-
July 23, 2024 at 9:12 am #79625
kakasParticipantWhich RTC chip can be used? In the schematics I see both DS1307 and PCF8563. Will the firmware detect the chip type? The PCF8563 works from 1.8V, that is fine.
But the recommended minimum operational voltage of DS1307 is 4.5V according to datasheet. Still it works from 3.3V? Datasheet is really foggy about it.July 24, 2024 at 1:12 am #79636
RayKeymasterThe current OpenSprinkler design uses PCF8563. The firmware can auto-detect the chip:;
https://github.com/OpenSprinkler/OpenSprinkler-Firmware/blob/master/I2CRTC.cpp#L46
so you can use any of PCF8563, DS1307, and MCP7940.You are right that DS1307 requires at least 4.5V VCC. So the previous version of the OpenSprinkler that used DS1307 has its VCC tied to +5V, whereas PCF8563 can work with 3.3V so its VCC is tied to 3.3V.
July 25, 2024 at 12:19 am #79642
kakasParticipantThank you Ray. I have both chips and test them. I used the 8563 first, it worked well if the AC was on. With power outage I got delays and weird dates/times. The batt voltage was 2-3V well above the required minimum for the 8563. So now I try to find the reason.
The firmware has its own clock, and periodically refreshes it from the RTC? If so, how frequently?July 25, 2024 at 12:38 pm #79646
RayKeymasterIt’s hard to tell without seeing your schematic. The firmware writes the current UTC time into RTC every time it gets a successful time sync from NTP server. The firmware maintains a system time. When the controller reboots, it will first retrieve the system time from the RTC. If it subsequently gets a successful NTP result, that will overwrite the system time (and writes that to RTC). The firmware does time keeping on ESP8266, which is pretty accurate, so it only needs to perform NTP occasionally to ensure the time is still accurate. The involvement of the RTC is pretty minimal here — it primarily covers the situation when the controller has rebooted but can’t access NTP yet (e.g. because the router hasn’t finished booting). Normally if the controller has NTP access (which is the common scenario), it will get time from that.
July 26, 2024 at 12:15 am #79649
kakasParticipantSchematics is v3.3. Thank you for the clear explanation, it will help a lot to find the bug.
August 3, 2024 at 1:05 am #79764
kakasParticipantSo what I experience: board is v3.3 with PCF8563. I let the backup cap get charged fully, and let NTP to sync. I switch off NTP sync, and disconnect power. After some minutes I re-connect power, and the actual time will be the time moment when I disconnected the power. I do not know if ESP saves the time and retrieves it, or the RTC provides this time. Backup voltage is OK. I have replaced the RTC and resonator, same result.
August 3, 2024 at 4:49 am #79766
RayKeymasterThis is a v3.3 board you bought from us or did you make it yourself? Do you have the 32.768kHz crystal connected to your PCF8563? Without the crystal the time will not move.
August 18, 2024 at 9:03 am #79924
kakasParticipantI made the board, but I think schematics is the same at the RTC chip. See attached.
Experience: after NTP sync, NTP swiched off. Power off.
After re-connecting, behavior seems to be always the same. Depending on the time of the re-connection, it jumps back an hour, then starts to go backwards.What I have already tried:
– built a new board with all chips new
– re-burned the firmware
– checked with oscilloscope that 32kHz clock is workingWhat else to check?
Attachments:
August 18, 2024 at 4:50 pm #79930
RayKeymaster1) What firmware are you using? The OpenSprinkler firmware, or your own program?
2) Is your super capacitor charged to at least 2V, so that it can keep the RTC chip going when power is off?I just verified that with the current OpenSprinkler firmware, power on, NTP sync, then power off, keep the unit away for 1 hour and power it on again, the LCD shows the correct time right away before NTP sync. So it’s working as expected.
August 26, 2024 at 6:33 am #80001
kakasParticipantFirmware is the latest official from github. Voltage is above 2V.
thank you for checking the functionality.
I will try the DS chips I have. What is the necessary hardware modificaton (to operate from higher voltage)?August 26, 2024 at 7:57 am #80002
RayKeymasterCan you be more specific about ‘to operate from higher voltage’ — as in to power the RTC chip from a higher voltage? How high?
August 26, 2024 at 8:13 am #80003
kakasParticipantRay, as you pointed out in your previous post:
You are right that DS1307 requires at least 4.5V VCC. So the previous version of the OpenSprinkler that used DS1307 has its VCC tied to +5V, whereas PCF8563 can work with 3.3V so its VCC is tied to 3.3V.
So wiht DS chip I have to connect VCC of DS to 5V. But the supercap’s max voltage is 3.3V, so I’m interested how the complete schematic with DS chip should look like.
August 26, 2024 at 8:34 am #80004
RayKeymasterYou want to use DS1307 or PCF8563? With DS1307, it has dedicate battery backup pins, so the backup battery voltage doesn’t have to be the same as the supply voltage. In fact, you don’t need to use a supercap, you can use a 3V lithium coin battery, connect the positive to DS1307’s VBat pin, and negative to ground. That way you don’t need the diode and the super capacitor.
October 3, 2024 at 2:26 am #80272
kakasParticipantI have tested the PCF8563 again. Inserted some code to the firmware to see the operation. The PCF8563 does not work. After sync (and stopping sync), it jumps back an hour, then starts to go backwards. (or something like that). I have replaced the chip from the same batch, same results. Then I purchased it from an other source, still it works in the same way.
It has nothing to do with Opensprinkler code or hardware.
So I replaced to DS1307 and that works fine. (VCC is 3.3V) -
AuthorPosts
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › Hardware Questions › OpenSprinkler › RTC chip