DS3231 alarm start arduino and Soft Latching Power Switch

hello
I have a problem combining two circuits.
The first circuit is with DS3231 which turns on the arduino when an alarm appears on the RTC pin, when the process is completed via I2C I turn off the alarm on DS3231 and it works OK. However, when I connect the second circuit with the switch, it happens to me that the arduino does not turn off after the end of the D7 pin program, which was HIGH until then.
And to note each of the circuits separately works OK.

Where I'm wrong.

Sorry for my bad English

Q3 seems incorrect. It looks like the emitter and collector are swapped.

The 1M pull up for Q2 gate is very large, 1k or 10k sort of value will be better, much more robust to
noise spikes in a digital circuit (although C2 is preventing this in this circuit).

The 10uF capacitor C2 sets a very long time constant with that resistor, 10 seconds, which is over long,
and may be why your circuits don't play together. Its also a large enough capacitor that you risk
welding the push-button switch contacts together. Adding 100 ohms in series with the push button
would fix this.

Q3 is indeed incorrectly oriented. Emitter to ground, collector to the FET gate is how it should be.

The DS3231 module has no supply connected - is this a mistake drawing the circuit?

What's an 8DM9433 MOSFET? Google can't find it. Your circuit requires p-channel logic-level
MOSFET, I was trying to check this.

It also appears C1 serves no function where it is placed - the 5V supply is already directly connected to the mosfet source. Perhaps C1 should go to the gate.

It's not clear what the function of C1 and C2 would be. They delay the power turnoff. Is that what you want?

MarkT, I believe it's SDM9433. Just as the "D83231" module is actually DS3231. Speaking of which - if you are using the ZS-042 RTC module, there is a 4.7K pullup resistor on SQW to the module's Vcc pin. You may want to disconnect that pullup since you already have R2, particularly if you are not powering the RTC from the 5V supply. See below.

And finally, you might try increasing the value of the base resistor of Q3 so less current will be wasted when the power is on. And I agree Q3 is inverted, at least on the drawing.

One other comment. Everybody has his own way of designing circuits, but it seems to me that you could eliminate Q2, and move the push button and Q3 over to the gate of Q1. Then the gate will be grounded when the button is pushed, or by the collector of Q3 when the processor asserts D7, or when the RTC alarm triggers. All three of those things would ground the gate when active, but do nothing at all other times, so they would not interfere with each other. The only thing trying to bring the gate high is R2. That's assuming you cut the trace to the pullup resistor on SQW, which you need to do anyway.

That would let you eliminate Q2, the 1M resistor, and C2.

I thank everyone for their help I succeeded. Here is a scheme on which everything works properly.

Schematic_atmega2_2021-02-02.pdf (82.4 KB)

Here are the pictures.
Thanks again to everyone
Cheers

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.