Ds3231 library customize

Hello guys, i'm using an rtc ds3231 with rtcds3231.h library .

I need to change the signals like
when alarm hits, the sqw gives 5volt for 3 minutes and then goes back to 0 volt.

Can someone give me the way to change that?

Thanks

You can't make the INT/SQW pin behave like that.

In SQW mode, the pin outputs a square wave.

In INT mode, the pin is high and goes low when an interrupt event occurs.

Usually you would use a pin on the micro to create this behaviour.

Is there any way to adjust the volt of signal to 5 volts??

You can connect the output to the base of a PNP transistor which will source 5 v when turned on.

Hello

what are you trying to do exactly ?

1 Like

Hello guix thanks for your enquiry..

I can switch a relay from an rtc but the signal is opposite from that i want.. with some changes I can fix it but relay doesn't all times switch because the signal isnt 5volts .. its 3volts i think

You need some sort of intelligent device to talk to and configure the RTC, so why not use a spare pin on that device to control your relay. You would need additional circuitry to interface with the relay coil, which you would have needed anyway.

1 Like

Many optocoupled relay modules turn on the secondary when one side of the primary input is switched to ground.

What relay are you using?

1 Like

Don't quote me, it's been a while since I played with that chip, but I think in IRQ mode, the pin goes active on an alarm match, and remains on until you reset it. So you could wait 5 minutes to reset it. But then you could do very much the same thing on some I/O pin so I don't understand your desire to do it that way.

You still need one processor pin to detect the interrupt unless you're polling the RTC (but then what is the point?).

I can't use a pin because my processorcis closed the time i want to turn it on .

I use optocoupled relay module, so i will try to make a different circuit to tske advantage of low signal at alarm start..

But can someone give me this information??
After alarm how much time needs the sqw to change the voltage?? Is 5minutes?

The square wave pin will go low within a second as the alarm is triggered. It will not go high until the alarm flag is cleared by an i2c command from the code.

That's my problem how can i do that?

You can not do it without processor intervention. So forget about it and tell us what you are doing, so we can suggest alternatives.

Please go read the DS3231 data sheet to understand why.

I want to turn on/off and Arduino uno from a relay that takes the signal from RTC .
I can store the alarm to rtc and turn on the Arduino.
But i need to stop sqw signal when i want to switch off Arduino

When the Arduino is on, you can time using either the processor clock or the DS3231 clock. So any time you want to turn it off, you can just clear the interrupt flag in the DS3231.

That is so easy, that I don't understand why you have a problem.

I don't know how to... Give me some details please

Is that because you don't understand the documentation, or because you haven't read it?

Is the RTC connected to the Arduino on the i2c bus? What library are you now using with the RTC?

An obscure library. Likely making the problem worse.

Im not familiar with the code.. i searched but i dant understand where is this changes..