Author Topic: Press and Hold Latching Circuit Questions  (Read 1828 times)

0 Members and 1 Guest are viewing this topic.

Offline Kuusou

  • Contributor
  • Posts: 22
  • Country: us
Press and Hold Latching Circuit Questions
« on: September 16, 2020, 07:33:04 am »
So I'm attempting to layout this circuit I found from http://www.discovercircuits.com/H-Corner/Press-and-Hold-Latching-Circuit.htm into my PCB layout for a project of mine. I've been looking for a long press on AND off latch and this is the only circuit I've personally come across to do what I want. The following text is from the site:

"A Discover Circuits visitor needed a latch circuit which could operate using a power supply voltage ranging from 3v to 24v.  He wanted to use a tiny pushbutton switch to turn on and off power to a load.  However, he wanted a 2 second delay between the switch activation and the state change of the output.  The delay would prevent accidental activation of the circuit from a quick push button switch closure. The circuit below performs this function.  A dual Schmitt trigger inverter IC and a single flip/flop IC form the heart of the circuit.  The A1A section performs the 2 second delay function.
The Q output of the flip/flop is inverted by the A1B inverter section and fed to the flip/flop’s data input.  This configuration forms a data type flip/flop which changes state with each leading edge pulse from the A1A inverter.  The transistor chosen should be able to handle about an Amp of current.  I used a 3.3v shunt type voltage regulator, which draws about 15ua of current from the supply voltage to limit the voltage fed to the circuit to 3.3v but the circuit can operate fine from a 3v supply.  In fact, the latch circuit will operate below 1v but at such a low voltage the Q1 transistor will not fully turn on.  If the supply voltage is limited to 5v, the shunt regulator is not needed and the circuit will operate while drawing a very low current of about 1ua."


Being new to PCB design and electronics in general, I have several questions. My project is powered from a single cell lipo that goes to this switch, and then to a boost converter which will boost the voltage up to 5 volts to run everything. It appears that in this original schematic they had a need for up to 24v, and as a result of that they've used a "shunt type voltage regulator", which is suppose to limit the current to the switch to 3.3V. It says you can remove this if the voltage is limited to 5V. So I believe I've made this change correctly but would like someone to confirm.

My second question is concerned with my PCB layout. In the schematic it has 3.3V going to each of the IC's but no decoupling caps. I've included those caps in my schematic, are they correct and am I feeding power to them properly on the PCB layout? B1 is the battery terminal so the lipo will be directly connected to those pads.

My other questions is the 4 wire junction of the schematic, In my schematic that would be the junction of D5, R5, and C3 leading to pin 1 of U4. These are always rather confusing to me and I'm unsure exactly how to lay this out, so I've used a via. Is this acceptable/will it work?

So basically I'm just hoping someone could take a look over my PCB layout and make sure I'm not making any obvious mistakes. I should mention that the green pads on the PCB layout image are the switch for the circuit which is located on the underside of the board. R5 IS connected to the switch, its just the trace is underneath another one on the top layer so its not visible.

Below is my list of components I'll be using, as far as I can tell they appear to match whats in the original schematic.
Gate/Inverter: https://lcsc.com/product-detail/Gates-and-Inverters_Texas-Instruments_SN74LVC2G14DBVR_Texas-Instruments-Texas-Instruments-SN74LVC2G14DBVR_C12401.html
Flip Flop: https://lcsc.com/product-detail/Flip-Flops_Texas-Instruments_SN74LVC1G79DBVR_Texas-Instruments-Texas-Instruments-SN74LVC1G79DBVR_C42878.html
Didoe: https://lcsc.com/product-detail/Switching-Diode_1N4148W_C81598.html/?href=jlc-SMT
MOSFET: https://lcsc.com/product-detail/MOSFET_Shikues-FDN337N_C475694.html/?href=jlc-SMT

Below is my current schematic and PCB layout.



« Last Edit: September 16, 2020, 07:43:03 am by Kuusou »
 

Offline ledtester

  • Frequent Contributor
  • **
  • Posts: 961
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #1 on: September 16, 2020, 07:46:04 am »
Quote
My project is powered from a single cell lipo that goes to this switch, and then to a boost converter which will boost the voltage up to 5 volts to run everything.

Will this also shutdown the boost converter?
 

Offline Kuusou

  • Contributor
  • Posts: 22
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #2 on: September 16, 2020, 07:47:22 am »
I believe so, this is suppose to be a soft latch switch, so one button to control both on and off functions. Q1 leads to the boost converter although the silk screen is very tiny for some reason on the pcb layout. I hope i'm not missing something obvious and this wouldn't actually turn it off! That's why I'm posting here for help lol
 

Offline strawberry

  • Frequent Contributor
  • **
  • Posts: 279
  • Country: lv
Re: Press and Hold Latching Circuit Questions
« Reply #3 on: September 16, 2020, 08:59:19 am »
SN74LVC1G80 or connect Data to Q1 drain through resistor
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 14584
  • Country: gb
  • 0999
Re: Press and Hold Latching Circuit Questions
« Reply #4 on: September 16, 2020, 09:52:10 am »
Why not use a microcontroller and a suitable low drop-out regulator? There are plenty of cheap, six pin MCUs available: ATtiny4 and PIC10F200 spring to mind. The NCP730 is a decent LDO, capable of working up to 38V and will withstand surges of up to 40V.
 

Offline badgerthing

  • Contributor
  • Posts: 25
  • Country: nz
Re: Press and Hold Latching Circuit Questions
« Reply #5 on: September 16, 2020, 11:09:52 am »
I can't speak for the circuit myself, but why have you used two dual inverter ICs, but only used one inverter in each?
Just use a single LVC2G14.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 14584
  • Country: gb
  • 0999
Re: Press and Hold Latching Circuit Questions
« Reply #6 on: September 16, 2020, 01:03:18 pm »
Even if you don't want to use an MCU, the circuit is much more complicated than necessary. Use the 74LVC1G74, which has Schmitt trigger inputs and the LVC2G14 is superfluous. I'd still recommend a LDO, over a shunt regulator.
https://assets.nexperia.com/documents/data-sheet/74LVC1G74.pdf
 

Offline ledtester

  • Frequent Contributor
  • **
  • Posts: 961
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #7 on: September 16, 2020, 03:56:59 pm »
Just noticed that VCC of U6 is not connected in your schematic.
 

Offline ledtester

  • Frequent Contributor
  • **
  • Posts: 961
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #8 on: September 16, 2020, 04:02:17 pm »
A question about the original design...

Quote
... The Q output of the flip/flop is inverted by the A1B inverter section and fed to the flip/flop’s data input. ...

Instead of an inverter could one use the /Q output of the flip-flop? Or are there other considerations like what happens at power-up?
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 14584
  • Country: gb
  • 0999
Re: Press and Hold Latching Circuit Questions
« Reply #9 on: September 16, 2020, 07:51:59 pm »
A question about the original design...

Quote
... The Q output of the flip/flop is inverted by the A1B inverter section and fed to the flip/flop’s data input. ...

Instead of an inverter could one use the /Q output of the flip-flop? Or are there other considerations like what happens at power-up?
The 74LVC1G79 doesn't have an inverting output pin. It's the wrong IC for the job.
https://datasheet.lcsc.com/szlcsc/1811011912_Texas-Instruments-SN74LVC1G79DBVR_C42878.pdf

EDIT:
Here's a schematic with the 74LVC1G74.
« Last Edit: September 16, 2020, 08:49:01 pm by Zero999 »
 

Offline Kuusou

  • Contributor
  • Posts: 22
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #10 on: September 16, 2020, 11:15:07 pm »
Wow thanks for catching that. So the above schematic looks simpler and uses less parts and will have the same desired effect of a long press to turn on and off?
 

Offline Kuusou

  • Contributor
  • Posts: 22
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #11 on: September 16, 2020, 11:17:27 pm »
Even if you don't want to use an MCU, the circuit is much more complicated than necessary. Use the 74LVC1G74, which has Schmitt trigger inputs and the LVC2G14 is superfluous. I'd still recommend a LDO, over a shunt regulator.
https://assets.nexperia.com/documents/data-sheet/74LVC1G74.pdf

Well I'm not sure what you mean. In my design i'm not using the shunt regulator because the board is powered by a 3.3V lipo and goes to this switch, then to a boost converter to run everything at 5V so I removed that aspect of the design. Also my concern with using a MCU would be programming the chip.
« Last Edit: September 16, 2020, 11:42:44 pm by Kuusou »
 

Offline Kuusou

  • Contributor
  • Posts: 22
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #12 on: September 16, 2020, 11:35:18 pm »
A question about the original design...

Quote
... The Q output of the flip/flop is inverted by the A1B inverter section and fed to the flip/flop’s data input. ...

Instead of an inverter could one use the /Q output of the flip-flop? Or are there other considerations like what happens at power-up?
The 74LVC1G79 doesn't have an inverting output pin. It's the wrong IC for the job.
https://datasheet.lcsc.com/szlcsc/1811011912_Texas-Instruments-SN74LVC1G79DBVR_C42878.pdf

EDIT:
Here's a schematic with the 74LVC1G74.


Ok so I'm confused by this schematic of yours. It appears that you're using the IEC logic symbol from the datasheet but I'm not sure how to match that up with the IC's actual pin configuration. I'm guessing 1D is the data input, C1 is suppose to be the clock input? R would be the asynchronous reset-direct input and S would be the asynchronous set-direct input? I'm unsure which pin is suppose to lead to the gate of the MOSFET or which pin is leading from the ic back into the data input.

Also why are there two 3.3V going to the IC?

Also I'm not able to find that exact IC however I did find the following that's available at JLCPCB: https://lcsc.com/product-detail/74-Series_TI_SN74LVC1G74DCUR_SN74LVC1G74DCUR_C70285.html/?href=jlc-SMT

Would this work? It appears to be relatively the same, the other aspect I'm confused about is that the datasheet lists another IC in a typical power button circuit



Sorry for what I'm sure are noobish questions but I REALLY appreciate all the help!
 

Offline ledtester

  • Frequent Contributor
  • **
  • Posts: 961
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #13 on: September 17, 2020, 01:44:38 am »
Quote
Ok so I'm confused by this schematic of yours.

The little right-angle triangles just indicate that those pins are active-low. The outputs on the right side of the chip are Q and /Q (has the triangle next to it).

The "10.2 Typical Power Button Circuit" is basically the same, but it has a nice feature in that it ensures the flip-flop is cleared at power up through the RC-timer at /CLR. There is a similar RC-timer at the A input of the SN74LVC1G17.

That prompts the question -- what behavior do you want when power is applied? Should the switch be off and the user has to press the button to turn it on, or should power be immediately applied to the application?

The SN74LVC1G17 squares up the push button input. It might not be needed. You will need R2, D1, R3, C2 from the original and Zero999's circuit to get the 2 second delay - those component replace the RC timer at input A.

 

Offline Kuusou

  • Contributor
  • Posts: 22
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #14 on: September 17, 2020, 02:07:42 am »
Quote
Ok so I'm confused by this schematic of yours.

The little right-angle triangles just indicate that those pins are active-low. The outputs on the right side of the chip are Q and /Q (has the triangle next to it).

The "10.2 Typical Power Button Circuit" is basically the same, but it has a nice feature in that it ensures the flip-flop is cleared at power up through the RC-timer at /CLR. There is a similar RC-timer at the A input of the SN74LVC1G17.

That prompts the question -- what behavior do you want when power is applied? Should the switch be off and the user has to press the button to turn it on, or should power be immediately applied to the application?

The SN74LVC1G17 squares up the push button input. It might not be needed. You will need R2, D1, R3, C2 from the original and Zero999's circuit to get the 2 second delay - those component replace the RC timer at input A.

So why the double 3.3V inputs?

I'm not sure I understand the question. This switch is between the battery and the boost converter. So once I hook the battery up to the terminals the user will only have the button to control it. It's either in an on or off state correct? If I hook the battery up and the circuit powers up I'll simple press the button to turn it off and it will remain that way. I guess the only thing I could see is if the battery fully drained and the user went to plug it in, could that cause the entire device to turn on? That wouldn't be desired however its not exactly make or break. Ideally that wouldn't happen though.
 

Offline ledtester

  • Frequent Contributor
  • **
  • Posts: 961
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #15 on: September 17, 2020, 02:26:34 am »
So why the double 3.3V inputs?

The /R and /S pins are digital inputs. Connecting them to 3.3V sends a logical HI signal to them.

Quote
I'm not sure I understand the question. This switch is between the battery and the boost converter.

When you apply power to the circuit (i.e. connect it to a battery pack or some other DC power source) the flip-flop will assume either a 0 or 1 output. There are three possibilities:

- you can force it to be a 0 at power up
- you can force it to be a 1 at power up
- you can leave things to chance

If the flip-flop is a 0 at power up the user will have to press the button to turn the MOSFET on.
If the flip-flop is a 1 at power up the MOSFET will turn on and power will be applied to the rest of the application immediately.
 

Offline Kuusou

  • Contributor
  • Posts: 22
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #16 on: September 17, 2020, 02:52:15 am »
So why the double 3.3V inputs?

The /R and /S pins are digital inputs. Connecting them to 3.3V sends a logical HI signal to them.

Quote
I'm not sure I understand the question. This switch is between the battery and the boost converter.

When you apply power to the circuit (i.e. connect it to a battery pack or some other DC power source) the flip-flop will assume either a 0 or 1 output. There are three possibilities:

- you can force it to be a 0 at power up
- you can force it to be a 1 at power up
- you can leave things to chance

If the flip-flop is a 0 at power up the user will have to press the button to turn the MOSFET on.
If the flip-flop is a 1 at power up the MOSFET will turn on and power will be applied to the rest of the application immediately.

So if the flip-flop is at 1 then after the application is turned on once the battery is connected won't simply pressing the button again turn it off? Also how to determine which state is set? I guess it would be best to have it set to 0 so that in the invent it loses all power it reverts to being off rather than on.
 

Offline ledtester

  • Frequent Contributor
  • **
  • Posts: 961
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #17 on: September 17, 2020, 03:09:28 am »
Quote
So if the flip-flop is at 1 then after the application is turned on once the battery is connected won't simply pressing the button again turn it off? Also how to determine which state is set? I guess it would be best to have it set to 0 so that in the invent it loses all power it reverts to being off rather than on.

The flip-flop doesn't have any state when there is no power. It doesn't remember anything after you disconnect power.

When you apply power the flip-flop will either assume a state of 0 or 1. You can influence what its initial state is at power up through an RC-timer like the /CLR pin has in the "10.2 Typical Power Button" schematic.

Note that this power-up state is the state of the flip-flop before the user has pressed any buttons.

If you force the power-up state to be a 0 then once the user inserts batteries or plugs the device into a wall adaptor the user will still have to press the button to "turn it on".

Otherwise, the application will turn on once the device goes form an un-powered state to a powered state (i.e. you insert the last needed battery or plug it into an AC adaptor.)

« Last Edit: September 17, 2020, 03:11:27 am by ledtester »
 
The following users thanked this post: Kuusou

Offline Kuusou

  • Contributor
  • Posts: 22
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #18 on: September 17, 2020, 04:17:15 am »
I'm completely unsure how I'm suppose to determine the value for the resistor and cap on the RC circuit (R6 & C13)  to ensure that the CLR pin stays at 0 on power up. I just picked those values but I have no idea  :-// I've checked the datasheet here https://datasheet.lcsc.com/szlcsc/Texas-Instruments-TI-SN74LVC1G74DCUR_C70285.pdf
and can't find any mention of how to determine the values.



« Last Edit: September 17, 2020, 04:54:09 am by Kuusou »
 

Offline ledtester

  • Frequent Contributor
  • **
  • Posts: 961
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #19 on: September 17, 2020, 04:54:58 am »
It will be about R*C (R measured in ohms, C measured in Farads).

1K * 100nF = 100 microseconds

The same applies to the RC-timer at the input when the switch is closed:

4.7M * 470nF = 2.2 secs.

And at power up the R4 and C3 will produce a rising edge of CLK after:

100K * 470 nF = 47 milliseconds

Given that, I might change the /CLR RC timer (R6, C13) to 100 milliseconds so that /CLR remains low until after the R4 and C3 produce the rising edge on CLK.
 
The following users thanked this post: Kuusou

Offline Kuusou

  • Contributor
  • Posts: 22
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #20 on: September 17, 2020, 05:09:04 am »
It will be about R*C (R measured in ohms, C measured in Farads).

1K * 100nF = 100 microseconds

The same applies to the RC-timer at the input when the switch is closed:

4.7M * 470nF = 2.2 secs.

And at power up the R4 and C3 will produce a rising edge of CLK after:

100K * 470 nF = 47 milliseconds

Given that, I might change the /CLR RC timer (R6, C13) to 100 milliseconds so that /CLR remains low until after the R4 and C3 produce the rising edge on CLK.

Ok I think I get it. So if I change the resistor value from 1k to 100K and the capacitor to 100nF that would produce 100 milliseconds correct?
 

Offline Kuusou

  • Contributor
  • Posts: 22
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #21 on: September 17, 2020, 05:21:03 am »
Another issue I'm just now realizing is that because this device is the switch between my battery and the boost converter won't that be an issue in terms of amps going through the system? This board can draw up to about 1.3 amps, wouldn't that fry this IC?
 

Offline ledtester

  • Frequent Contributor
  • **
  • Posts: 961
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #22 on: September 17, 2020, 05:46:00 am »
Which IC? Only the MOSFET will be handling large currents.
 

Offline Kuusou

  • Contributor
  • Posts: 22
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #23 on: September 17, 2020, 05:48:35 am »
Which IC? Only the MOSFET will be handling large currents.

I guess I'm confused because the 3.3V from the battery goes to the IC and through it, then to the MOSFET...maybe i'm missing something obvious but wouldn't the draw from the boost converter damage the IC or you're saying the MOSFET would be what takes the brunt of that? Sorry i'm still a noob when it comes to understanding this stuff  :palm:
 

Offline ledtester

  • Frequent Contributor
  • **
  • Posts: 961
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #24 on: September 17, 2020, 05:52:35 am »
Yes - the flip-flop controls the MOSFET, but the current from your application circuit only flows through the MOSFET.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf