Author Topic: Trying to design an abnormal power up circuit  (Read 869 times)

0 Members and 2 Guests are viewing this topic.

Offline EasyGoing1Topic starter

  • Regular Contributor
  • *
  • Posts: 68
  • Country: us
Trying to design an abnormal power up circuit
« on: July 14, 2024, 05:07:51 am »
The application of this circuit is such that I need to use a 12 volt source (12IN) to turn on an SSR DC/DC relay that then sources a completely different 12V source to power a Pi Pico through a buck converter.

After the Pico powers up, however, I am going to use one of its pins to keep that relay turned on which will then use an inactivity timer to turn itself off after a few hours.

The reason for that is because 12IN will not stay powered on all the time, as it will be used for different purposes after the circuit is on, so it needs to be able to go to 0 volts without the Pico losing power.

IDEALLY, once the Pico turns on, I would like to SOMEHOW use one of its pins to cut off 12IN from being able to apply any voltage to pin 1 of the relay, relegating it back to its main purpose while the circuit remains powered on.

Here is what I have come up with that I think would probably work as is. But I would like to modify this somehow so that 12IN cannot affect pin 1 of the relay once the Pico pin has taken over to keep the relay turned on.

The transistor and pico pin at the top is what 12IN does while the Pico is running. 12IN goes high sometimes causing PICO_2 to be sunk to ground through the transistor which then causes other things to happen.



My question is, what could I use to accomplish my desired goal?
« Last Edit: July 14, 2024, 05:09:26 am by EasyGoing1 »
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 7946
  • Country: de
  • A qualified hobbyist ;)
Re: Trying to design an abnormal power up circuit
« Reply #1 on: July 14, 2024, 09:27:49 am »
Swap D3 with the 5.3k resistor and add an NPN to ground after the resistor (driven by the Pico). The NPN shunts the 12VIN signal to ground while the diode protects PICO_3V3. And the 5.3k resistor limits the current to ground (about 2 mA).
 

Offline EasyGoing1Topic starter

  • Regular Contributor
  • *
  • Posts: 68
  • Country: us
Re: Trying to design an abnormal power up circuit
« Reply #2 on: July 14, 2024, 11:03:41 am »
Swap D3 with the 5.3k resistor and add an NPN to ground after the resistor (driven by the Pico). The NPN shunts the 12VIN signal to ground while the diode protects PICO_3V3. And the 5.3k resistor limits the current to ground (about 2 mA).

Is this what you're describing?

 

Offline madires

  • Super Contributor
  • ***
  • Posts: 7946
  • Country: de
  • A qualified hobbyist ;)
Re: Trying to design an abnormal power up circuit
« Reply #3 on: July 14, 2024, 11:16:58 am »
Yep!
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12975
Re: Trying to design an abnormal power up circuit
« Reply #4 on: July 14, 2024, 12:02:38 pm »
That looks over-complex, and I doubt there is any need for a SSR. 

Lets restate the problem:
  • There are two 12V sources, 12IN and 12PWR.  12IN may be on or off.
  • Power for the MCU shall be drawn from 12PWR only.
  • Power to the MCU shall switch on when 12IN switches on, and shall remain on till the MCU commands it off.
  • The MCU uses 3.3V logic levels.

To avoid confusion I've renamed the permanent 12V supply 12PWR

The first thing to do is to determine if the buck regulator's enable pin can be used to switch power to the MCU.  This depends on whether there are any other 12V devices that need power switched together with the MCU and if the buck regulator's quiescent current when shut down is acceptable.  If the regulator enable can be used, use it!  If not, you probably need a high side P-MOSFET with its gate pulled up via a high value resistor to 12PWR, rather than a SSR, which invariably require more control power than a bare MOSFET.   

Next you need to decide if 12IN shall be edge triggered (MCU can switch off while 12IN remains on, 12IN must go low to high to switch on) or level triggered (if 12IN is high it overrides switch off signal from MCU).

Next you need to decide whether or not you need to optoisolate 12IN.  If it shares a common ground with 12PWR, the answer is almost certainly not.

For the simplest case of a P-MOSFET or an active low buck enable and level triggered, it could be as simple as a transistor controlled by 12IN pulling down the gate or enable, to initially apply power to the MCU with another transistor in parallel with it controlled by the MCU to hold the power on until it decides to remove it.   

An active high enable will need a small signal P-MOSFET to pull it high, when  the gate is pulled low.  Edge triggering will probably need a capacitor between 12IN and the transistor it controls, so 12IN cant hold the transistor on.  You cant simply use the power state to gate 12IN, as immediately after switch-off that will let a still-high VIN retrigger the circuit

Many soft-latching power control circuits have previously been discussed here.  If you refine your requirements we can probably point you at a suitable one.
« Last Edit: July 14, 2024, 12:04:57 pm by Ian.M »
 

Offline EasyGoing1Topic starter

  • Regular Contributor
  • *
  • Posts: 68
  • Country: us
Re: Trying to design an abnormal power up circuit
« Reply #5 on: July 14, 2024, 01:30:31 pm »
Lets restate the problem:
  • There are two 12V sources, 12IN and 12PWR.  12IN may be on or off.
  • Power for the MCU shall be drawn from 12PWR only.
  • Power to the MCU shall switch on when 12IN switches on, and shall remain on till the MCU commands it off.
  • The MCU uses 3.3V logic levels.

To avoid confusion I've renamed the permanent 12V supply 12PWR

I'm happy to see that my command of the English language is still accurate. You summarized it perfectly.

The first thing to do is to determine if the buck regulator's enable pin can be used to switch power to the MCU.

I'm still digesting the rest of what you said, but I wanted to answer this point because it was relatively easy to find the answer.

The buck converter can accept 4.5v to 24v at the input pin and is rated to be able to sustain 3A output. It says that at 12V in and 1.5A out continuously, no need for anything else but if higher than that, then extra cooling should be considered. I'm running a Pi Pico and three ULN2003 16 pin chips that have very low current draw. I won't be pulling anywhere near 1.5 amps when this circuit is on.

The EN pin is listed as being capable of turning off the Buck converter when its voltage is brought to 0V and will turn on the buck converter at 2v to 5v where 5v is the max you can hit it at.

It also mentions that the quiescent current is 0.85 mA when the unit is off. This is more than acceptable. That kind of drain wouldn't be a problem at all in its off-state.

So assuming we can control the power by just using the buck converter itself, how could we use 12IN to start it while allowing the Pico to shut it off after the no-activity timer runs out?

Also, The no activity timer on the Pico gets reset whenever 12IN goes high (along with some other pins that aren't relevant here) so the Pico is programmed to shut off when 12IN (and other sources) remain low for period of time.

This means that when 12IN goes from low to high, that should turn the circuit on when it is off.
« Last Edit: July 14, 2024, 01:40:45 pm by EasyGoing1 »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12975
Re: Trying to design an abnormal power up circuit
« Reply #6 on: July 14, 2024, 01:46:57 pm »
Which buck converter are you using?  We need to study its datasheet to figure out the best way to drive its enable pin. 

Also from your description of the 'no-activity timer' it sounds like if 12IN stays high, the Pico doesn't start the timeout so stays on.  That means you want the level triggered option.

However if it turns on at 2V, its likely it can driven direct from 3.3V logic, so the problem becomes how to get a turn-on signal to Enable when the 3.3V rail is at 0V.   One possible approach (to be confirmed after reading datasheet) would be a diode OR gate and pull-down resistor - e.g. a single BAT54C combining the signals from a MCU GPIO and a potential divider reducing the 12IN to a pulse of between 3V  and 5V at the diode OR.  That's one double diode and three passives!  Monitoring if Vin is present could use the same potential divider, just add a N-MOSFET to pull a GPIO low, gate driven by the divider.
« Last Edit: July 14, 2024, 01:55:38 pm by Ian.M »
 

Offline EasyGoing1Topic starter

  • Regular Contributor
  • *
  • Posts: 68
  • Country: us
Re: Trying to design an abnormal power up circuit
« Reply #7 on: July 14, 2024, 02:07:33 pm »
We need to study its datasheet to figure out the best way to drive its enable pin. 

I'm still searching for the datasheet, but this is the buck I'm using: https://www.amazon.com/gp/product/B08R6337QY
 

Offline EasyGoing1Topic starter

  • Regular Contributor
  • *
  • Posts: 68
  • Country: us
Re: Trying to design an abnormal power up circuit
« Reply #8 on: July 14, 2024, 02:20:06 pm »
I came up with this off the cuff, but I have unknowns with it. Such as, with P3 turned high (3.3v), would having P2 high sink that whole line to ground through the transistor? Also with P2 high, what would the voltage be at 12IN if it were high?

When the circuit is off, the 2.5k / 820 divider puts out 2.96v which would turn it on, the problem, of course, is what happens when P2 and P3 go high.

 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12975
Re: Trying to design an abnormal power up circuit
« Reply #9 on: July 14, 2024, 02:35:30 pm »
Googling suggests "1AGC*" is a MP2315
Quote from: datasheet
Enable/SYNC control
EN is a digital control pin that turns the regulator on and off. Drive EN high to turn on
the regulator, drive it low to turn it off. There is an internal 1MEG resistor from EN to GND thus EN can be floated to shut down the chip. Also EN pin voltage was clamped to around 6.5V by an internal zener-diode. Please use large enough pull up resistor connecting between VIN and EN to limit the EN input current which should be less than 100uA. Generally, around 100k resistor should be large enough for all the applications.
That means to switch it off you'd be 'fighting' the pullup resistor to Enable on the module.  Remove that and its is easier to control.  It  *may* be the resistor '204' between the board edge and the IC, but confirm that it connects to pins 2 and 6 of the IC before removing it.
 
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12975
Re: Trying to design an abnormal power up circuit
« Reply #10 on: July 14, 2024, 02:44:46 pm »
P2 and P3 are controlled by your code, so you simply ensure they can never be both high.

However you can't do it that way.  As soon as P2 goes high, it turns on the  2N2222 which shuts off the buck converter, overriding 12IN still being present, so the MCU looses power, the 2N2222 turns off and the still present 12IN turns the buck converter back on.  The MCU sees this as a fresh power-on so waits for your timeout before turning off again, then the cycle repeats as long as 12IN remains high.   

If you need the MCU to be able to switch off while 12IN remains high it gets quite a bit more complex . . .
« Last Edit: July 14, 2024, 02:47:47 pm by Ian.M »
 

Offline EasyGoing1Topic starter

  • Regular Contributor
  • *
  • Posts: 68
  • Country: us
Re: Trying to design an abnormal power up circuit
« Reply #11 on: July 14, 2024, 02:50:22 pm »
Remove that and its is easier to control.  It  *may* be the resistor '204' between the board edge and the IC, but confirm that it connects to pins 2 and 6 of the IC before removing it.

You're suggesting to remove this resistor if it is connected to these pins?

 

Offline EasyGoing1Topic starter

  • Regular Contributor
  • *
  • Posts: 68
  • Country: us
Re: Trying to design an abnormal power up circuit
« Reply #12 on: July 14, 2024, 02:55:59 pm »
If you need the MCU to be able to switch off while 12IN remains high it gets quite a bit more complex . . .

This setup ... follow my thinking here ... I outlined essentially three voltage dividers that are only "on" when their transistors are on except for D1. The D1 divider turns on the D2 transistor when VIN goes high. the D2 voltage divider brings EN high turning on the buck. When the buck is on, P3 gets turned high which brings up the D3 voltage divider which keeps EN high. At the same time, pin P2 goes high which sinks the base voltage for D2 to ground turning off D2. So with P2 and P3 high, VIN cannot affect the EN pin until the Pico turns P3 off which shuts down everything.

Still not sure what happens at 12IN when P2 stays high. I need 12IN to turn on the transistor at the top when the circuit is up and running.




Maybe like this, when P2 goes high, it ensures there is enough voltage at 12IN so that the upper transistor can turn on

« Last Edit: July 14, 2024, 03:11:32 pm by EasyGoing1 »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12975
Re: Trying to design an abnormal power up circuit
« Reply #13 on: July 14, 2024, 03:09:32 pm »
Yes, that resistor.  Without a pullup, it defaults to off and you have to provide logic '1' at the EN pad to turn it on.   A capacitor from 12IN feeding a potential divider (say 33K:10K) and a diode from the potential divider  tap (cathode to EN) can provide the initial pulse to get it started, and another diode from a MCU GPIO (cathode to EN) can keep it on under software control.  Although you could rely on the IC's internal 1Meg EN pulldown, a 100K external pulldown would be  advisable to avoid noise turning it on.

Sorry, got to pop out for a bit so cant comment on your new circuit till later.
 

Offline EasyGoing1Topic starter

  • Regular Contributor
  • *
  • Posts: 68
  • Country: us
Re: Trying to design an abnormal power up circuit
« Reply #14 on: July 14, 2024, 03:19:07 pm »
Yes, that resistor.  Without a pullup, it defaults to off and you have to provide logic '1' at the EN pad to turn it on.
It sounds like what you're saying is that if that resistor stays on the board, then the buck defaults the EN being high and the buck stays on, which is of course the default behavior. But with that resistor removed, then the default state of the buck is OFF until I bring EN high. Is that correct?

ALSO, I did confirm that the resistor does in fact connect to pins 2 and 6 as I drew on the photo.

Sorry, got to pop out for a bit so cant comment on your new circuit till later.

Don't forget to refresh the page, I made some edits.
« Last Edit: July 14, 2024, 03:23:49 pm by EasyGoing1 »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12975
Re: Trying to design an abnormal power up circuit
« Reply #15 on: July 14, 2024, 04:38:59 pm »
With the onboard pullup resistor removed, this should do the job:

If you don't remove it, all the passives must be scaled by a factor of 20.  e.g. make R1 10K, R2 4K7 and C1 10uF.

D1 can be any small signal Schottky diode.  The MCU must set the GPIO high to stay on. Increase C1 if you need longer from powerup till you can get the GPIO set high. 
If the negative going spikes on EN are too large (when 12IN goes off after the MCU has already shut off), add an extra Schottky diode, anode to ground, cathode to C1 R1 junction. 

N.B. if 12IN doesn't have a path to ground when off, C1 cant discharge so add a resistor from 12IN to ground.

« Last Edit: July 14, 2024, 07:35:41 pm by Ian.M »
 

Offline EasyGoing1Topic starter

  • Regular Contributor
  • *
  • Posts: 68
  • Country: us
Re: Trying to design an abnormal power up circuit
« Reply #16 on: July 14, 2024, 07:26:08 pm »
With the onboard pullup resistor removed, this should do the job.

I can't see where the 12V source is that keeps the Pico running. 12IN remember goes off and on during the running of the circuit.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12975
Re: Trying to design an abnormal power up circuit
« Reply #17 on: July 14, 2024, 07:34:04 pm »
I didn't show the 12PWR 12V supply feeding the buck module or its output to the Pico, or your transistor + base resistor to let the Pico monitor 12IN. Add all that stuff yourself.  It only shows the EN pad control circuit
 

Offline EasyGoing1Topic starter

  • Regular Contributor
  • *
  • Posts: 68
  • Country: us
Re: Trying to design an abnormal power up circuit
« Reply #18 on: July 14, 2024, 10:00:42 pm »
I didn't show the 12PWR 12V supply feeding the buck module or its output to the Pico, or your transistor + base resistor to let the Pico monitor 12IN. Add all that stuff yourself.  It only shows the EN pad control circuit

OK, I understand what's happening in your schematic. It seems too simple ... But I'll breadboard it and see how it turns out. I don't have any Schottky diodes on hand, so I'll have to get some. I'll let you know how it turns out.

I sincerely appreciate the time you've spent helping me figure this out.

Mike
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12975
Re: Trying to design an abnormal power up circuit
« Reply #19 on: July 14, 2024, 11:08:20 pm »
It will probably work even with a 1N4148 silicon PN junction signal diode, definately if the on-board pullup is removed so it can use higher value divider resistors or if the extra clamping diode is fitted.  I was concerned about the margin it had for the EN logic high threshold if the divider was using 10K and 4K7 resistors not being enough to keep it on with a hard falling edge from 12IN spiking EN downwards.  Add the extra clamp diode (again 1N4148 should do) ground to R1-C1 junction and that issue pretty much goes away.

 I probably use Schottky diodes too much in these sorts of circuits as their low Vf doesn't compromise the logic level margins so badly, so they preserve reasonable noise immunity, but of course you then have to allow  for them being rather leaky when reverse biased at elevated temperature, so its probably worth not being lazy and analysing thee circuit properly to see if an ordinary silicon PN diode can do the job.
« Last Edit: Yesterday at 01:26:56 pm by Ian.M »
 

Offline EasyGoing1Topic starter

  • Regular Contributor
  • *
  • Posts: 68
  • Country: us
Re: Trying to design an abnormal power up circuit
« Reply #20 on: Yesterday at 11:13:47 am »
but of course you then have to allow  for them being rather leaky when reverse biased at elevated temperature

What kinda temperature are we talking about here?

I bought this, it will be here in the afternoon https://www.amazon.com/BOJACK-Values-Rectifier-Schottky-Assortment/dp/B07YG8K1R9
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12975
Re: Trying to design an abnormal power up circuit
« Reply #21 on: Yesterday at 01:26:17 pm »
Lets look at the BAT54 datasheet: https://www.vishay.com/docs/86410/bat54_bat54a_bat54c_bat54s.pdf
Refer to the graph "Fig. 4 - Typical Reverse Leakage Current vs. Reverse Voltage" on page 3
The blue line is 25°C (room temperature) and the orange line 75°C.  The leakage current is roughly 50 times greater than at 25°C.  Go up to 100°C and the leakage current is nearly three orders of magnitude higher than at 25°C.
This is fairly typical of Schottky diodes - they all get very leaky when hot.

Those are regular silicon PN (1N400x) 1A rectifiers and Schottky (1N581x) 3A rectifiers.    The 1N400x are suitable for line frequency rectifiers and general use up to 1A DC, The 1N581x are suitable for switching power supplies and DC-DC converters, (and occasionaly when you need to squeese an extra fraction of a volt DC out of a line frequency transformer.

They aren't signal diodes and are unsuitable for the above circuit.  If youi want a through hole signal Schottky to keep in stock, I suggest BAT41: https://www.vishay.com/docs/85659/bat41.pdf
 

Offline EasyGoing1Topic starter

  • Regular Contributor
  • *
  • Posts: 68
  • Country: us
Re: Trying to design an abnormal power up circuit
« Reply #22 on: Yesterday at 01:58:19 pm »
This is fairly typical of Schottky diodes - they all get very leaky when hot.

This circuit will be installed inside a wooden box essentially and will from time to time be outside in temperatures around 110 degrees F ... like outside in the Arizona desert kinda heat....

Will this be a problem?
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12975
Re: Trying to design an abnormal power up circuit
« Reply #23 on: Yesterday at 02:51:51 pm »
Yes, desert temperatures and small signal Schottky diodes aren't a good mix.  Try if it works OK with 1N4148 for D1 and for the diode clamp from ground to the C1-R1 junction.
 

Offline EasyGoing1Topic starter

  • Regular Contributor
  • *
  • Posts: 68
  • Country: us
Re: Trying to design an abnormal power up circuit
« Reply #24 on: Yesterday at 03:06:29 pm »
Yes, desert temperatures and small signal Schottky diodes aren't a good mix.  Try if it works OK with 1N4148 for D1 and for the diode clamp from ground to the C1-R1 junction.

Like this?

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf