My issue is how to build the circuit and what is the most efficient one to trigger a MCU from the Alarm of the RTC DS3231.
(The blue rectangle simulates de RTC, the battery with 0v is the SQW pin and the red rectangle is the rRasberry)
The problem is the RDS drop is making that during startup it dies when it reaches a mA peak (cause I imagine it has 4,7 volts instead of 5volts). Is this correct? Can I improve it?
I have tried also to put the P-channel mosfet before the DC-DC, but is not working, the DC does not convert, the red led is OFF, I dont know why.
ps: I know how to trigger the alarm, program the RTC, etc.
- Ah, le me see. (1) So you have a 3V3 RTC DS3231 which outputs a 3V3 logic High/Low alarm signal which used to to switch On/Off a P-channel power MOSFET IRF9540. (2) You want the IRF9540 in turn be used as a high side current switch to switch On/Off the 5V power supply for the Rpi. Pleast let me know if I understand your problem correctly, before I move on to suggest how to troubleshoot. – tlfong01 6 hours ago
- 1Yes exactly, and for info the 5v power supply they come from the output of a DC DC converter step up, whos input is a Li-ion bettery 3.7V model 18650. (When I meant I tried to put it before the DCDC converter is this one) – user8920367 5 hours ago
- Ah, thank you for your confirmation, and give me more details on your 5V power supply. Let me think about it and come back to you later. Cheers. – tlfong01 5 hours ago
- Your spec can be boiled down to the following: How to use a 3V logic signal to switch on/off a P-Channel power MOSFET which in turn switches on/off a 5V power supply for Arduino, Rpi, or ESP32. I mean the DS3231 is not relevant, any 3V signal can do. Let me draft an answer below. – tlfong01 4 hours ago
- 1The power supply is the following: 3.7Volts Li-Ion Battery 18650 (orbtronic.com/content/sony-VTC6-datasheet-specs.pdf) —> DcDc StepUp converter (2V to 5v to 5V) amazon.fr/gp/product/B07SSXVHP8/…. – user8920367 4 hours ago
How to use a 3V logic signal to switch on/off a P-Channel power MOSFET which in turn switches on/off a 5V power supply for Arduino, Rpi, or ESP32?
Either P-Channel or N-Channel can do the job, as shown in the following schematic.
Discussion, Conclusion, and Recommendation
(1) Using DS3231 to control the power MOSFET which in turn to switch on/off might not be a very solution. My usual trick is to use DS3231 interrupt to direct switch on/off the LM2596 PSU through its power on/off switch pin. See Appendix B for more details.
(2) Using P-Channel or N-Channel power MOSFET, High or Low side switching?
I usually prefer NPN BJT and N-Channel power MOSFET for switch, because (a) more EE guys prefer NPN and N-Channel so you will find more tutorials to follow, and circuits to copy, (b) N guys are more efficient, (c) In case you need to ground complicated circuits, N-Channel and NPN BJT low side switch can ground easier. On the other hand, high side mosfet switches “floats” in the air, so not so easy to make a common ground.
(2) The Sony 18650 tech spec is the best I can google.
(3) The OP’s step up regulator is interesting. I bought one long time ago but never tried it, because my projects don’t have any space problem. I usually use 18650 x3 or even x4 and step down to 5V. The switching power supply regulator has a very high, or 90% efficiency, so your PSU does not loses that much energy, but lasts 3 or 4 times longer.
(4) I think the OP’s design is very good. My suggestions are a bit subjective. The OP need to do engineer trade offs and cost benefit/risk analysis. It is a good learning experience and fun trying different approaches, compare and contrast.
Appendix A – DS3231 Testing Notes
I am reading my old post to show (1) how to use Rpi OS’s DS3231 DT drivers and also (2) basic python program for setting up and also how the program the interrupt for alarming external devices as asked by the OP. I have also used a scope to display the DS3231 1Hz and 32kHz wave forms and found them a bit noisy.
Rpi3B DS3231 pythonProgramming Notes
Appendix B – Using DS3231 interrupt signal to switch on LM2596 PSU for Rpi
Using High/Low side power MOSFETs to switch on off PSU might not be a very good solution. One trick I always use is to use DS3231 interrupt signal to switch on/off the LM2596 PSU, or using the interrupt to switch on LM2941 current switches.
I modify ordinary DC-DC (12V to 5V) PSUs’ so that any Rpi or MCP23x17 GPIO pins can power on/off the LM2956/LM2947 voltage regulator chip of the PSU. (LM2941 can be used for 1A current switches, LM2596 for 5V 3A PSU. The on/off pin is also connected to a push button, for manual power on/off testing.)
Actually each of my 7 Rpi3B+’s is connected to a cheapy DS3231 Real Time Clock Module which has a hardware interrupt pin to reset PSU, Rpi, or other devices.
Now the external DS3231 RTC wakes up everybody in the morning, and switches off lights at midnight, so everybody goes to bed.
- 1The SQW output of the RTC is active to level low so the chanel N in your picture is not doing the job. Also, I want to suply with just one 3.7 volts Li-Ion battery – user8920367 4 hours ago
- #user8920367, Ah, I remember the 32kHz square wave signal is an optional always on/off signal for timing to binary count down to precisely 1 second (I forot the details, need to read datasheet). It is only the DS3231 low active interrupt alarm signal to trigger/switch on the power MOSFET. I am not very sure. I need to read the datasheet to confirm. Many thank for pointing out my possible careless mistake. Ah, locking down supper time. See you late this evening or tomorrow. Cheers. – tlfong01 4 hours ago
- Just now I read the datasheet (Ref 5 of my answer’s reference list) to confirm. (1) I found that I made a mistake. 32kHz square wave is an optional always on signal for timing. My apologies. (2) For the alarm signal thing, the datasheet’s INT/SQ pin description says that you can config either INT or SQ. I always use INT, but never SQ. So I might have made another careless mistake. My apologies again. You might like to confirm and I will correct my answer accordingly. Supper time. See you later. – tlfong01 4 hours ago
- 1You cannot really use a low side switch for this, as that would drastically complicate safely managing the I2C connection in the switched off state. And as mentioned previously please read the guidelines on what constitutes an “answer” on a stack exchange site – the majority of the content of this post is another of your excessively “chatty” off-topic posts, at least this one does contain a tiny bit of technical solution proposal responding to the actual question, but that is largely mistaken. – Chris Stratton 50 mins ago
- Thank you for pointing out my ignorance in using low side switching MOSFET for I2C devices. I never thought aobut that. I need to google and study more before I make an apology and suggest replacement answers here. – tlfong01 44 mins ago Delete