DS3231 Alarm Int Output When On Battery Backup

Use this section to discuss your embedded Flowcode projects.
Post Reply
Matrixv8
Posts: 20
http://meble-kuchenne.info.pl
Joined: Mon Jun 03, 2024 2:51 am
Been thanked: 4 times

DS3231 Alarm Int Output When On Battery Backup

Post by Matrixv8 »

Hi everyone, does anyone have a code for Flowcode that I can use to enable the alarm Int output while the DS3231 is on battery backup. At this time my code works fine on power. This would help me to wake the MCU circuits with a power up circuit that I would design. I would be able to shut the main voltage/power to the entire circuit I am building and conserve the battery life. I have everything else working, I just need help with the DS3231 SQW alarm/Int output while on battery backup.

Thank you,
Pierre

chipfryer27
Valued Contributor
Posts: 1883
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 410 times
Been thanked: 633 times

Re: DS3231 Alarm Int Output When On Battery Backup

Post by chipfryer27 »

Hi

Not sure I understand correctly.

Are you having the uC "sleep" and the DS3231 is to wake it up at a set time? If so a C-code block would do that with the DS3231 Int pin connected to any IOC / Interrupt pin on the uC.

Or is your entire circuit "shutdown" including uC and you will repower at a set time?

From the datasheet

Screenshot 2026-01-29 043122.jpg
Screenshot 2026-01-29 043122.jpg (84.14 KiB) Viewed 73 times

A logic-level FET would do that and they range in currents from mA to many Amps. You would need to "self hold" once triggered, possibly by using a pin on the uC to keep the FET triggered.

Perhaps I have misunderstood?

Regards

Matrixv8
Posts: 20
Joined: Mon Jun 03, 2024 2:51 am
Been thanked: 4 times

Re: DS3231 Alarm Int Output When On Battery Backup

Post by Matrixv8 »

Thank you chipfryer27 for your reply, I am sorry if I was not clear. All I need is to enable the SQW output that matches the alarm when the module goes to battery backup, the battery on the module. I have set the module to go low at every minute with Flowcde already when on power. So all I need, like you said, would be a C-code block to enable the bit(s) in the registers to do just that. I am not very good a C code. I have an electronic background so the rest is easy.

Thank you for your interest,

Pierre

chipfryer27
Valued Contributor
Posts: 1883
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 410 times
Been thanked: 633 times

Re: DS3231 Alarm Int Output When On Battery Backup

Post by chipfryer27 »

Haha

I just looked at the time I sent my reply.... I'm claiming to be half-asleep.... :)

To access that register you just need to send a command to the register using I2C from your microcontroller. Best to set the entire register to what you require all at once. Address is in hex 0E, and it is bit 2 (3rd bit) that needs to be set.

Regards

Post Reply