Trying to design an abnormal power up circuit - Page 1
Forum section: electronics / projects

author: EasyGoing1
author_rank: Regular Contributor
timestamp: July 14, 2024, 05:07:51 am
content: 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?

author: madires
author_rank: Super Contributor
timestamp: July 14, 2024, 09:27:49 am
content: 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).

author: EasyGoing1
author_rank: Regular Contributor
timestamp: July 14, 2024, 11:03:41 am
content: Quote from: madires on July 14, 2024, 09:27:49 amIs this what you're describing?

author: madires
author_rank: Super Contributor
timestamp: July 14, 2024, 11:16:58 am
content: Yep!

author: Ian.M
author_rank: Super Contributor
timestamp: July 14, 2024, 12:02:38 pm
content: 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 12PWRThe 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 circuitMany soft-latching power control circuits have previously been discussed here. If you refine your requirements we can probably point you at a suitable one.

author: EasyGoing1
author_rank: Regular Contributor
timestamp: July 14, 2024, 01:30:31 pm
content: Quote from: Ian.M on July 14, 2024, 12:02:38 pmI'm happy to see that my command of the English language is still accurate. You summarized it perfectly.Quote from: Ian.M on July 14, 2024, 12:02:38 pmI'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.

author: Ian.M
author_rank: Super Contributor
timestamp: July 14, 2024, 01:46:57 pm
content: 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.

author: EasyGoing1
author_rank: Regular Contributor
timestamp: July 14, 2024, 02:07:33 pm
content: Quote from: Ian.M on July 14, 2024, 01:46:57 pmI'm still searching for the datasheet, but this is the buck I'm using:https://www.amazon.com/gp/product/B08R6337QY

author: EasyGoing1
author_rank: Regular Contributor
timestamp: July 14, 2024, 02:20:06 pm
content: 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.

author: Ian.M
author_rank: Super Contributor
timestamp: July 14, 2024, 02:35:30 pm
content: Googling suggests "1AGC*" is aMP2315Quote from: datasheetThat 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.

author: Ian.M
author_rank: Super Contributor
timestamp: July 14, 2024, 02:44:46 pm
content: 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 . . .

author: EasyGoing1
author_rank: Regular Contributor
timestamp: July 14, 2024, 02:50:22 pm
content: Quote from: Ian.M on July 14, 2024, 02:35:30 pmYou're suggesting to remove this resistor if it is connected to these pins?

author: EasyGoing1
author_rank: Regular Contributor
timestamp: July 14, 2024, 02:55:59 pm
content: Quote from: Ian.M on July 14, 2024, 02:44:46 pmThis 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

author: Ian.M
author_rank: Super Contributor
timestamp: July 14, 2024, 03:09:32 pm
content: 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.

author: EasyGoing1
author_rank: Regular Contributor
timestamp: July 14, 2024, 03:19:07 pm
content: Quote from: Ian.M on July 14, 2024, 03:09:32 pmIt 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.Quote from: Ian.M on July 14, 2024, 03:09:32 pmDon't forget to refresh the page, I made some edits.

author: Ian.M
author_rank: Super Contributor
timestamp: July 14, 2024, 04:38:59 pm
content: 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.

author: EasyGoing1
author_rank: Regular Contributor
timestamp: July 14, 2024, 07:26:08 pm
content: Quote from: Ian.M on July 14, 2024, 04:38:59 pmI 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.

author: Ian.M
author_rank: Super Contributor
timestamp: July 14, 2024, 07:34:04 pm
content: 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

author: EasyGoing1
author_rank: Regular Contributor
timestamp: July 14, 2024, 10:00:42 pm
content: Quote from: Ian.M on July 14, 2024, 07:34:04 pmOK, 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

author: Ian.M
author_rank: Super Contributor
timestamp: July 14, 2024, 11:08:20 pm
content: 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.

author: EasyGoing1
author_rank: Regular Contributor
timestamp: July 15, 2024, 11:13:47 am
content: Quote from: Ian.M on July 14, 2024, 11:08:20 pmWhat kinda temperature are we talking about here?I bought this, it will be here in the afternoonhttps://www.amazon.com/BOJACK-Values-Rectifier-Schottky-Assortment/dp/B07YG8K1R9

author: Ian.M
author_rank: Super Contributor
timestamp: July 15, 2024, 01:26:17 pm
content: Lets look at the BAT54 datasheet:https://www.vishay.com/docs/86410/bat54_bat54a_bat54c_bat54s.pdfRefer to the graph "Fig. 4 - Typical Reverse Leakage Current vs. Reverse Voltage" on page 3The 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

author: EasyGoing1
author_rank: Regular Contributor
timestamp: July 15, 2024, 01:58:19 pm
content: Quote from: Ian.M on July 15, 2024, 01:26:17 pmThis 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?

author: Ian.M
author_rank: Super Contributor
timestamp: July 15, 2024, 02:51:51 pm
content: 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.

author: EasyGoing1
author_rank: Regular Contributor
timestamp: July 15, 2024, 03:06:29 pm
content: Quote from: Ian.M on July 15, 2024, 02:51:51 pmLike this?

author: Ian.M
author_rank: Super Contributor
timestamp: July 15, 2024, 03:20:56 pm
content: Not quite. Reverse D3, then its good.

author: EasyGoing1
author_rank: Regular Contributor
timestamp: July 15, 2024, 05:33:35 pm
content: Quote from: Ian.M on July 15, 2024, 02:51:51 pmAll I had on hand were 1N4001 but the circuit works. However, with the 470nf cap in there, I could not get a voltage on the divider so I removed it, then ran the diode to ground before the 200k resistor. That was the only change I made, but it does work and it works well.This is what worked:

author: Ian.M
author_rank: Super Contributor
timestamp: July 15, 2024, 05:41:12 pm
content: The 470nF cap was to prevent 12IN keping EN active when the MCU tries to shut it off. It only lets through a short pulse to start up the buck module so you shouldn't expect to measure a DC voltage on the divider. The code in the MCU must takeover keeping EN active as soon as it starts. However 470nF was a best guess for how long it needs to get going. If the startup pulse is too short, increase C1 till the MCU starts successfully, then increase it another 50% to have a safety margin.

author: EasyGoing1
author_rank: Regular Contributor
timestamp: July 15, 2024, 06:02:26 pm
content: Quote from: Ian.M on July 15, 2024, 05:41:12 pmOK, I bumped it to 680nF and it worked so the next size up that I had was a 1µF. I'd have to put the scope on it to measure the time that it stays on but its probably around 10ms or less based on what the meter shows me. I had to add a resistor to drain the cap... this is the final circuit:

author: EasyGoing1
author_rank: Regular Contributor
timestamp: July 15, 2024, 06:17:40 pm
content: Quote from: Ian.M on July 15, 2024, 05:41:12 pmIt's a nice circuit. It's simple yet effective and the short burst on is a nice touch. I can't foresee it ever causing a problem for the Pico since the voltage applied to EN is actually under 3 volts (like 2.6-ish). So much nicer than using the SS Relay.OK, now I have questions:1) Am I correct in assuming that once the cap charges, the full 12 volts will be applied to that 50k resistor feeding the base of the transistor?2) The 1N4001 seems to be working (though I'm not sure what to expect if they weren't working). Do you foresee a problem sticking with this diode?3) How did you find the datasheet for the buck converter based on only having the data from the Amazon page?4) How did you know that the resistor on pins 2 and 6 was the one causing EN to default high?Edit: I just confirmed that when in the off state, it only draws .3µA from the 12 Volt source feeding the buck. Life is good

author: Ian.M
author_rank: Super Contributor
timestamp: July 15, 2024, 08:40:28 pm
content: The 50K resistor always gets the full 12IN voltage - the cap doesn't affect it.1N4007 is slow and has a lot of junction area (its rated 1A continuous) so may let too big a reverse recovery spike through to the MCU. Replace with 1N4148 or 1N914 or other fairly fast small signal silicon PN diode.Generally you google: SMD code "<code>" <package>where <code> is the code on the chip and <package> is what package its in e.g SOIC-8 or SOT-23-6 (not your chip) and if you are lucky you'll find a site that lists what the chip may be in the search results. If no result and the code is >3 characters, drop one character from the end of the code and try again.When you've got a candidate chip, google its datasheet see if the function and pinout make sense and and look at the datasheet's package markings section to check for a match.The datasheet has a sample circuit + explanation of its operation - see the section I quoted in Reply #9, then the pinout tells me which pins the EN pullup must connect to.

author: EasyGoing1
author_rank: Regular Contributor
timestamp: July 16, 2024, 12:12:59 am
content: Quote from: Ian.M on July 15, 2024, 08:40:28 pmThank you again for the time you took to help me figure this out. Your logical approach to the problem was clearly necessary. I'm really happy with how well it works. It's exactly what I wanted.Mike

author: EasyGoing1
author_rank: Regular Contributor
timestamp: July 19, 2024, 09:03:02 pm
content: Quote from: Ian.M on July 15, 2024, 08:40:28 pmThis SMT component kit I got looks to have two different kinds of 1N4148 as you can see here ... do you have any idea what the difference is between these two?

author: Ian.M
author_rank: Super Contributor
timestamp: July 19, 2024, 10:20:01 pm
content: The package! LL-34 is aMELFstyle glass package, similar to the original thru-hole package but with flat disc ends. SOD-123 is the usual rectangular epoxy 'brick' package and has the major advantage of not rolling away as you try to solder it!

author: EasyGoing1
author_rank: Regular Contributor
timestamp: July 20, 2024, 01:46:02 pm
content: Quote from: Ian.M on July 19, 2024, 10:20:01 pmWhat an odd thing to do ... make a cylinder into an SMD component.

author: Ian.M
author_rank: Super Contributor
timestamp: July 20, 2024, 03:36:42 pm
content: Not so odd. MELF is very much a technology of its era when the electronics industry was transitioning from thru-hole to SMD. The component manufacturers knew how to package components in little tubes with wire ends, and switching to little tubes with disc ends wasn't too big a change. Its hung on for parts where a true hermetic metal to glass seal is desirable, or for greater dissipation than epoxy packages if for whatever reason a ceramic package can not be used, as little externally square glass tubes cant be practically manufactured at a reasonable cost vs little round glass tubes. *Nobody* likes it from an assembly point of view!