2

I am trying to construct a latching circuit with a 1-2 minute shutdown delay so I can soft start/stop a 240V-5V power supply.

I am looking for a momentary push latching (on-off) circuit to switch the 240V supply that will work like this:

---Push once (irrespective of push duration) the circuit latches and switches the 240V supply to a 240V-5V power transformer.

---Push again (irrespective of push duration), the latching releases but the 240V supply continues running to the 240V-5V transformer for a set time (approximately 1.5 minutes) and then the 240V supply is disconnected.

I have previously used a latching circuit I found online http://www.electronics-lab.com/project/toggle-on-off-switch/ and have found a "Power off delay" thread here How can I add a power-off delay to this circuit.

Because my skill level is low I am thinking about combining the two circuits with the relay in the latching circuit replacing SW1 in one of the options provided by Olin Lathrop and EM Fields.

So my current plan is to simply use a rely to connect the seperate soft start and power off delay circuits. However I am wondering if there is a simpler way (I am sure there will be) to integrate the latching circuit into one of the Power off delay options? Or is there a better alternative?

Regards

Barnys
  • 41
  • 1
  • 5
  • Do you want something that uses a momentary switch, but where once pressed the circuit stays powered for some specified delay time and is then automatically switched off? What happens if the push button is held down for a while? Is this to disconnect the 240 V side or the 5 V side? – jonk May 09 '17 at 06:03
  • I need something that uses a momentary switch that with one push will start and the next push will stop the power supply. – Barnys May 09 '17 at 06:55
  • Oh. So what is the "off delay" exactly? I guess I was not able to read your words with any understanding. Must be just me. But I can't tell what you want, I guess. I thought I saw you say "delay." But now you say just "toggle?" – jonk May 09 '17 at 06:58
  • Sorry, I somehow only posted part of my reply. The delay off function will allow the power supply to continue running for a period after the pushbutton/latching circuit has released. I want to switch the 240v (input) side so the all subsequent circuits will be off. R.e. “What happens if the push button is held down for a while”; irrespective of push duration I would like the push function to only act as a momentary push. I have a permanent 12V supply available to run this. – Barnys May 09 '17 at 07:07
  • 1
    Okay. It would be a good idea to edit your question to be thorough and careful in your wording and to discuss all corner cases, clearly. – jonk May 09 '17 at 07:09
  • I have edited the question, hopefully it is clearer... – Barnys May 09 '17 at 07:34
  • Thanks. It's clearer to me, anyway. Sounds like you want a T-FF in parallel with a one-shot, where these outputs are then tied through an OR gate with its output determining whether or not the power is active. – jonk May 09 '17 at 15:57

3 Answers3

1

enter image description here

Good news, I have hit it with a stick a lot, made some guesses, then some changes and have managed to get a result...

I couldn’t get the existing flipflop to work without the timer so I looked at some CD4013 on-off circuits online (and built one to make sure my components weren’t faulty). The result being I combined the flipflop I built with the circuit provided by Jonk. The timer circuit is the same, but the flipflop C2, D4 and R4 area is now a bit different and I have grounded pins 4 and 6 on the CD4013. LED 1 and R6 don’t have an impact on the operation; they are there so I can see when the flipflop switches.

When the circuit is off I am seeing the base of Q2 sitting at 11.27V (collector at 0.01V) and when the button is pushed the base drops to 10.95V (collector rises to 11.65V). The power supply is stable at 11.8V. In its off state (standby) the circuit appears to be consuming about 21mA including LED1 which is on when the circuit is in standby. When active it consumes 87mA which includes the relay and 2 LEDs indicating the relay has switched to the NO pins.

I am interested to hear if this circuit can be improved and/or if the Volts and mA I have recorded are good or could be better...

Thanks.

Edit; I have found the circuit switches on and switches the relay when the power is connected. The flipflop and timer delay work correctly after that. Is there a way to prevent the self starting with power on/the main power supply is connected?

Barnys
  • 41
  • 1
  • 5
1

I believe I now have it working well. Irrespective of button press speed-duration there isn’t any bounce, the off timer duration is (now) consistent, the collector voltage on Q2 is now stable, the Q2 switching base voltage is now around 0.8V (I was seeing less than 0.5V) and the relay is off when powering up the circuit. With the exception of the inclusion of C2 and D4 and a change in the values of R4 (100R) and C3 (100nF) it is basically the same as the one Jonk posted.

enter image description here

Barnys
  • 41
  • 1
  • 5
0

I'll provide an approach. I haven't reviewed the CD4013B datasheet well enough, so take it with a grain of salt. But the following might be an approximate solution:

schematic

simulate this circuit – Schematic created using CircuitLab

I've chosen to use \$V=12\:\textrm{V}\$ here. It is NOT designed for any arbitrary load, though. It can handle up to \$250\:\textrm{mA}\$. Perhaps more. But it can certainly drive an appropriate relay as the load if you would prefer that.

The "T" showing for the CD4013B is really the "D" input of the device (darned schematic program here doesn't have a full D-FF picture.) You can adjust \$C_1\$ and \$R_3\$ to get you where you need to be, but this would be in the area of 1.5 minutes. \$SW_1\$ is assumed to be a momentary push button that either powers the LOAD (first time) continuously or else (second press) initiates the start of the timed interval.

Here's a simulation of the output, where the RED line is the momentary push of the push-button and the GREEN line is the application of power to the LOAD. The first push turns the device on and does not time things. The second push allows the timing period to start.

enter image description here

The circuit is really two parts: a flip-flop and a timer. This whole thing could be replaced by a sot23-6 or DIP8, 50 cent microcontroller. But if you don't have the ability to program something like a PIC10F200, then this is where you wind up. I'd go with the PIC10F200, because the above circuit is far too much to do for something so simple with a micro.


The above example is probably one good reason among many why almost any electronics engineer these days must also have at least some experience programming microcontrollers, along with using the associated tools properly.


Circuit description:

The basic idea is this:

schematic

simulate this circuit

When active, the timer's output connects almost directly to the \$+12\:\textrm{V}\$ supply rail and is able to source \$250\:\textrm{mA}\$ into a grounded load. So any load attached to \$OUT\$ can expect to see \$+12\:\textrm{V}\$ with a current compliance up to about \$250\:\textrm{mA}\$ (when the timer is active.) Otherwise, the timer's output is high impedance and therefore "tied towards ground" by the load itself, if present.

\$C_1\$ and \$R_3\$ form a timing circuit. Normally, this RC timing circuit is inactive because the timer's \$V_{OUT}\$ is inactive. So there is about \$0\:\textrm{V}\$ across \$C_1\$ and across \$R_3\$ and the \$THRH\$ input is close to ground. Also, the D-type flip-flop should be in its reset state with \$\overline{Q}\$ high, keeping \$Q_2\$ off and inactive so that \$R_4\$ also has no impact on the RC timing section. This is the "inactive" case.

At the moment when \$SW_1\$ is closed, it pulls upward rapidly on \$C_1\$ through \$D_3\$ causing that end of \$C_1\$ to rapidly reach perhaps \$+11.5\:\textrm{V}\$. Since \$C_1\$ has little or no voltage across it, this also means that the timer's \$THRH\$ input is pulled to about the same voltage, as well. This causes the timer circuit to activate and cause \$V_{OUT}\approx +12\:\textrm{V}\$. Now, \$D_3\$ is no longer providing any function and \$SW_1\$ becomes irrelevant (de-bounced, in effect) for a time. Now, the timer itself is holding one end of \$C_1\$ high, allowing a small current to flow in \$R_3\$, which now begins to charge \$C_1\$ moving the voltage at the timer's \$THRH\$ input downward towards ground (over time.) When the voltage at the timer's \$THRH\$ input reaches some threshold, the timer circuit shuts off and inactivates its \$OUT\$ pin causing it to become high impedance. When this happens, the load itself then pulls downward on the top end of \$C_1\$ causing the load to lose its supply voltage but also pulling the top end of \$C_1\$ to ground. (It uses the applied load itself to do that.)

Unattended, this sudden turn-off behavior would cause the voltage at \$THRH\$ to become quite negative and to slowly discharge through \$R_3\$. If left unattended, this would be a serious problem. However, within the timer circuit there is a diode (\$D_2\$) which discharges \$C_1\$ quite rapidly and allowing the timer circuit to be completely reset in very short order, ready for a new switch event to take place.

However, there is a D-type flip-flop circuit now which gets a clocking signal every time \$SW_1\$ is engaged. It toggles between two states: inactive and active. The inactive state has \$\overline{Q}=+12\:\textrm{V}\$ so that \$Q_2\$ is off. The active state has \$\overline{Q}=0\:\textrm{V}\$ so that \$Q_2\$ is turned on via \$R_5\$. When active, \$R_4\$ supplies a strong pull-up and overwhelms \$R_3\$, forcing the timer's \$THRH\$ input to be held high and keeping the timer circuit active. But when inactive, \$R_4\$ does nothing and the timer circuit is allowed to operate normally.

Together, this provides the instant on behavior and delayed off behavior.

For the whole circuit to power up inactive, it does require that the D-type flip-flop also powers up in its inactive state. An additional RC timing circuit could be added to the RESET input in order to make sure this happens (not shown.)

Note: \$D_3\$ and \$D_4\$ isolate the timer circuit from the flip-flop circuit, allowing them to each observe \$SW_1\$ independently without interfering with each other.

jonk
  • 77,059
  • 6
  • 73
  • 185
  • Thanks for the circuit, it looks a lot (more elegant) less complicated than my efforts. Re. the CD4013B; just to clarify, the pins used are 1 (Q1), 2 (Q dash 1), 3 (Clock 1) and 5 (Data 1)? Re. the BSS145, I have found them to be quite expensive (the ones I have found are over €10 each delivered), is there an alternative? Re. the T=RC pair (R3-C1), is it better to aim for a larger R value so C will be smaller? – Barnys May 11 '17 at 08:50
  • Also, I recall reading that it is better to use something other than electrolytic capacitors because the leakage from electrolytics may interfere with the discharge/time, although the cap in this circuit isn’t polarised I am wondering, what would be an “ideal” type of cap for this role? – Barnys May 11 '17 at 08:50
  • @Barnys I just picked the BSS145 out of the blue. I don't know what you can find cheaply, so you tell me what you have available. Chances are it will work okay. – jonk May 11 '17 at 15:57
  • @Barnys Regarding the resistor and capacitor, sure. At some point the leakage in the board and parts, dirt, humidity, and a lot of things start to come into play. So you can play the game of using "as high a value for \$R_3\$ as possible, but no higher" if you want. From a theoretical point of view it all just works. But reality impinges and there will be a point where you won't like the results anymore. I tried to pick a rational balance and to select a resistor value that is cheap and easy to find, too. The cap leaks too, but not so much that you should be worrying here, I think. – jonk May 11 '17 at 16:00
  • How about a BSS138 it looks like the same thing but @ 50V it is 15V less than the BSS145. Also, would a 2N7000 work? – Barnys May 12 '17 at 04:19
  • @Barnys Yeah. A BSS138 should work fine. However, it has a lower threshold voltage, so the time-out will take longer to occur. That's a good thing because it means you can lower the capacitor value still more. Perhaps cutting it nearly in half? (Not quite.) But it should otherwise be fine. The 2N7000's threshold is close to the earlier devices so you'd use the same size cap as before (not smaller as you might with the BSS138.) Mostly just watch the threshold value: lower thresholds means a given R-C lasts more time and higher thresholds means a given R-C lasts less time. – jonk May 12 '17 at 04:42
  • That’s good news Jonk. I will get some parts and try this out. Thank you for your time it is much appreciated. – Barnys May 12 '17 at 04:53
  • If it works out for you, mark it as an answer. If not, feel free to let me know how I screwed up! ;) Do you plan to use a relay as the load? Or? (Oh. And you might consider playing around with \$C_2\$ and \$R_6\$ to debounce the switch a bit more or less if there is a problem with the "feel" of the switch here.) – jonk May 12 '17 at 04:58
  • Yes, I am planning on a Zettler relay (AZ742-2C-12DE) with a 1N4148 across the coil and (because I am still working it out) switch the relay via a resistor-transistor combo possibly a 10K and a BC547 to ground, or perhaps something like a 2N3906 pnp on the +12v side. Figuring this out is a slow process. I will definitely report on how it works out. Thanks. – Barnys May 12 '17 at 05:24
  • @Barnys The LOAD I show on the schematic can be simply replaced with a 12 V relay coil and diode. You don't need another transistor if that's all you need. The circuit can comply with up to a quarter amp or more, which is more than enough for the relay. \$Q_1\$ supplies the needed current. If you need some more details about how it works, just ask. – jonk May 12 '17 at 05:27
  • Oh, I was going to connect the relay via Q1. I need to go through it some more. – Barnys May 12 '17 at 05:50
  • @Barnys \$SW_1\$ pulls up on \$C_1\$ through \$D_3\$ and that triggers the delay circuit. However, \$SW_1\$ also pulls up on \$C_2\$ through \$D_4\$ and changes the FF state, which itself acts to hold \$M_1\$ and therefore \$Q_1\$ ***on***. But the next action of the switch toggles the FF again, releasing the hold on \$M_1\$ and allowing the timing circuit to act. (Both sides of \$C_1\$ were held up high before, ensuring it is discharged and held that way while the FF was holding back the timing process.) – jonk May 12 '17 at 06:06
  • Thanks for the extra info, the parts are on their way and should be here in 10 days(ish). I will post a report about the outcome. Thanks for your work it is appreciated. – Barnys May 14 '17 at 14:55
  • @Barnys Thanks for the kind words and the willingness to update me on the outcomes here. (I probably should add a behavioral description to my answer rather than leave things in the comments here.) – jonk May 14 '17 at 15:51
  • Part 1: the parts arrived and are assembled. Good news first, the momentary push starts the circuit, the relay closes and changing C1-R3 alters the delayed shutdown time. But then there is a problem, the circuit automatically/immediately begins a timed shutdown without a second button push. I need the circuit to stay on until the button is pushed a second time which would release the latching side of the circuit but the 240V supply continues running (via the timer) for a set time (approximately 1.5 minutes) and then the relay releases thereby cutting the 240V supply to the transformer. – Barnys May 23 '17 at 13:57
  • Part 2: Have I assembled it incorrectly or is the circuit working correctly and it was my initial description that caused some confusion? – Barnys May 23 '17 at 13:57
  • @Barnys I would be worried about the power on reset state of the flip flop. Can you determine that? Another possibility might be the exact values of \$C_2\$ and \$R_6\$. Disconnect \$D_3\$ entirely (leaving the timer completely out of the loop) and disconnect \$R_5\$ and then focus on the flip flop side of things. Does it work? It should toggle to the next state each time you press the button. – jonk May 23 '17 at 16:18
  • @Barnys Also, you may need to re-check all your pin assignments. I didn't specify pin numbers on my diagram. Did you correctly pick out right pins for the right functions from a datasheet? – jonk May 23 '17 at 16:24
  • I have compared the circuit I posted above (as an answer) with the one you gave me. Apart from grounding pins 4 and 6 the only real difference is the position of C2. The circuit works when C2 is connected between +12V and the D4-R6 junction, it doesn’t matter what type of capacitor is there and within reason, the capacitor size doesn’t make a lot of difference. A larger uF appears to increase the required latch/release button press duration. I would appreciate any thoughts you might have about the reliability-stability of the circuit I have posted. – Barnys May 26 '17 at 07:39
  • @Barnys That is different in the sense that the capacitor is no longer on the other side of the diode I had placed in order to isolate the two circuits. And the diode now isolates that capacitor away from the trigger input. Which means it isn't doing anything useful. If things are working without it, I'd just remove it, since it doesn't make any sense where you have it. – jonk May 26 '17 at 17:09
  • thanks for the reply and your help so far. The C4-D2 positioning is (to me) a bit confusing. The only way I can get it to work is to have C2 connected directly to the +12V. The circuit works best if I move D4 between C2 and the switch-D3 junction (a little different to the circuit I posted). Placing D3 between C2 and the switch-D3 junction appears to help with switch bounce, i.e. irrespective of button push frequency and/or duration, the circuit switches more reliably in that configuration. – Barnys May 31 '17 at 10:08
  • Part 2. The circuit is running about 95% reliably in that occasionally the flipflop doesn’t change its state with each button press. I have been looking at 4013 debounce circuits but haven’t improved on what I have (I have seen a lot that are the same as the D4, C2 and R6 combo you suggested). – Barnys May 31 '17 at 10:09
  • @Barnys One thing I didn't add to the circuit was an RC reset. I do think this is more about debouncing because you say it doesn't always change its state. But the reset circuit is easy to add. A series cap+resistor from Vcc to ground, with the midpoint tied to CLR of the FF. A 0.47uF for the cap and a 10k for the resistor (to ground) would be good enough, I think. The rest is really about debouncing that switch. When you see that the FF hasn't changed, I think this is because an even number of pulses are seen. Bigger cap where I had it, or try a different switch? – jonk May 31 '17 at 16:01