Notifications
Clear all

External Power on/off control circuit.

126 Posts
5 Users
9 Likes
4,953 Views
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6864
 

@byron The battery is not needed to drive the I2C, when the Interrupt wakes the controller, the controller supplies 5V to the DS3231 VCC pin, so the battery is not used. Yes the CR1632 will last 8 yrs, but I too doubt the rest of whatever it is connected to in most cases will.

Really, you don't remember people telling me I was wrong that the DS3231 HAD to be connected to VCC and would NOT run on battery?

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6864
 

@byron The cost of the Amazon.ca Chronodot is 2 for $17, and the bare DS3231 from AliExpress is 5 for $26.85 delivered, all in CDN $.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1121
Topic starter  

Posted by: @zander

Really, you don't remember people telling me I was wrong that the DS3231 HAD to be connected to VCC and would NOT run on battery?

Dear Ron, you are playing with words.  You confirm the DS3231 will not run on batteries for the purpose of running i2c (well it can, but its lifespan will be limited).  The point of having the DS2321 in the context of resetting the alarm means that the of use of i2c is necessary.  Therefore, if anyone alluded to the DS3231 not running on its coin cell battery, this should be read in the context of its intended use pertinent to the discussion.

So no, no-one to fight a duel with on this subject.  I'm reminded of the song 'abdul the bulbul ameer' where someone's toe was accidentally trodden on.   Now I cant stop singing the blooming song.. 😀 

And the cost I recently paid for the Chinese DS3231 board as per original discussion was £1.04 delivered

All together ....

Now the sons of the prophet were brave men and bold

And quite unaccustomed to fear....   

 


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6864
 

@byron 

The only point was that the onboard coin cell battery would deplete if it was used to entirely power the i2c circuit on the DS3231 board.

When the attached MCU is awake, it powers VCC on the DS3231 thus preserving battery which is estimated at 8 yrs.

 And the i2c would have to be used to reset the alarm, or its a one shot pony.  

Yes, the alarm once fired wakes up the MCU that then executes a couple of lines of code to reset and set a new alarm (not always needed), that is how it works.

I am unclear what you mean by the following

The last thing the pico will do will be to induce its next sleep will be to reset the DS3231 alarm, and if I want a 15 minute cycle then the alarm time,  as the DS3231 has limited alarm sequence settings, the next alarm time will also need to be reset.

Here is how a 15 minute repeating alarm repeats, this is in the main loop after the interupt flag is determined to be true. The setup code and the balance of on interrupt code is different depending on if you want 15, 30,45,60 times or just 15 mins after any initial time and then repeating every 15 minutes. I think the later is the more likely, and the library samples cover that case by extension.

myRTC.alarm(DS3232RTC::ALARM_1); // clear the alarm flag

You said

as the DS3231 has limited alarm sequence settings

but here are all the settings, hardly what I would call 'limited'

 

enum ALARM_TYPES_t {
ALM1_EVERY_SECOND = 0x0F, // trigger alarm every second
ALM1_MATCH_SECONDS = 0x0E, // match seconds
ALM1_MATCH_MINUTES = 0x0C, // match minutes *and* seconds
ALM1_MATCH_HOURS = 0x08, // match hours *and* minutes, seconds
ALM1_MATCH_DATE = 0x00, // match date *and* hours, minutes, seconds
ALM1_MATCH_DAY = 0x10, // match day *and* hours, minutes, seconds
ALM2_EVERY_MINUTE = 0x8E, // trigger alarm every minute
ALM2_MATCH_MINUTES = 0x8C, // match minutes
ALM2_MATCH_HOURS = 0x88, // match hours *and* minutes
ALM2_MATCH_DATE = 0x80, // match date *and* hours, minutes
ALM2_MATCH_DAY = 0x90 // match day *and* hours, minutes

I have no idea what you are trying to accomplish with the following, but Will found the clever ON/OFF circuit and sent it to me so I already have it and am always nice. I used a UNO for testing and used INPUT_PULLUP on the INT pin and did not need to do anything for the SCL/SDA pair of dedicated I2C pins.

The circuit with the use of a DS3231 to trigger a power on has been created and tested by an Electronics expert, and if you are real nice, he may provide you with the circuit diagram if you want it.   Said expert also tested the ability of the DS3231's ability to run i2c without pullups, and whilst it works, for use with a rpi pico, oscilloscope finding indicate the use of pullups is recommended for a cleaner signal.  The int/sqw also needs a pullup.

 

 

 

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1121
Topic starter  

@zander

As you are repeating much of what I put in my post, that must mean we have a consensus of minds. 

Well almost.  The 15 minute alarm - ALM1_MATCH_MINUTES = 0x0C, // match minutes *and* seconds 

The way this works, for me anyway, is the following.  If you put in 15 minutes, then everytime the minutes read 15 the alarm would be triggered.  But how often does the digital clock say 15 minutes.  Thats once every hour.  Test it out and let me know if you find it different.   The way I make it alarm every 15 minutes is, once the first 15 minute alarm is triggered, to reset the ALM1_MATCH_MINUTES = 0x0C to now trigger on 30, and then again on 45 and so on.

The use of INPUT_PULLUP enabled the i2c to work, but apparently the oscilloscope showed triangular instead of nice square waves, and the use of additional pullup resistors sorted that out.  It all comes down to getting a clearer and thus more reliable signal.  Carry on without resistor pullups if you like, but when the i2c signal fails to reset your alarm, you may remember the advice with watery eyes. 

 

This post was modified 1 year ago 2 times by byron

   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6864
 

@byron I am not planning on doing a full alarm test until I have the naked chip so that there is no possibility of external influence. As far as the timers, you may well be right, I find the documentation difficult to understand but that is just me and my autism probably. I have looked at examples where in fact they just get the current time, add 15 minutes and then set the alarm again. On the other hand I saw one earlier today where the code after the interrupt was ONLY an alarm reset as the time was correct, I think maybe 1 minute? Since the interrupt has caused the board to wake up and do whatever was planned, an extra couple lines to set the next wake up is hardly a problem. If I was designing the board, I think I would have had a timer mode for more repeating alarms than it has, but I didn't so can't.

After all this, I am still optimistic that PICO will solve their sleep problems then I can use one of my two PICO stackable RTC boards. Now to figure out how they work.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Page 9 / 9