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

0 Members and 1 Guest are viewing this topic.

Offline KuusouTopic starter

  • Contributor
  • Posts: 39
  • 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

  • Super Contributor
  • ***
  • Posts: 3036
  • 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 KuusouTopic starter

  • Contributor
  • Posts: 39
  • 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
 

Online strawberry

  • Super Contributor
  • ***
  • Posts: 1171
  • 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: 19527
  • 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: 48
  • 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: 19527
  • 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

  • Super Contributor
  • ***
  • Posts: 3036
  • 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

  • Super Contributor
  • ***
  • Posts: 3036
  • 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: 19527
  • 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 KuusouTopic starter

  • Contributor
  • Posts: 39
  • 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 KuusouTopic starter

  • Contributor
  • Posts: 39
  • 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 KuusouTopic starter

  • Contributor
  • Posts: 39
  • 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

  • Super Contributor
  • ***
  • Posts: 3036
  • 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 KuusouTopic starter

  • Contributor
  • Posts: 39
  • 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

  • Super Contributor
  • ***
  • Posts: 3036
  • 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 KuusouTopic starter

  • Contributor
  • Posts: 39
  • 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

  • Super Contributor
  • ***
  • Posts: 3036
  • 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 KuusouTopic starter

  • Contributor
  • Posts: 39
  • 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

  • Super Contributor
  • ***
  • Posts: 3036
  • 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 KuusouTopic starter

  • Contributor
  • Posts: 39
  • 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 KuusouTopic starter

  • Contributor
  • Posts: 39
  • 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

  • Super Contributor
  • ***
  • Posts: 3036
  • 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 KuusouTopic starter

  • Contributor
  • Posts: 39
  • 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

  • Super Contributor
  • ***
  • Posts: 3036
  • 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.
 

Offline KuusouTopic starter

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

I guess i'm just confused because the MOSFET controls the voltage and current flow between the source and drain. Ok but in this schematic the source is just connected to ground, shouldn't it be connected to the 3.3V of the battery?
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3036
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #26 on: September 17, 2020, 06:22:36 am »
Here is a crude schematic:



The return for the boost converter needs to be connected to GND. If it was connected to 3.3V there wouldn't be any voltage potential for it to work with.
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3036
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #27 on: September 17, 2020, 07:04:42 am »
I think it would be really helpful to prototype this up on a breadboard and experiment with it.

Get some DIP package versions of these gates so they are easy to use on a breadboard, like:

74HC74 for the D flip-flop (you'll get two in this package)
74HC14 for the Schmitt triggers

I couldn't find any DIP package Schmitt trigger buffers, but you can make one by connecting two Schmitt trigger inverters (i.e. the 74HC14 chip) in series.

Then you can play with the R and C values, try different MOSFETs, etc.
 

Offline KuusouTopic starter

  • Contributor
  • Posts: 39
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #28 on: September 17, 2020, 08:05:12 am »
Here is a crude schematic:

(Attachment Link)

The return for the boost converter needs to be connected to GND. If it was connected to 3.3V there wouldn't be any voltage potential for it to work with.

Ok so your schematic makes sense to me, I've obviously got this setup wrong. I'm not sure how to connect the 3.3V from the battery to the boost converter correctly. Below is my current schematic. How should I connect the 3.3V to the boost converter as in your example schematic.




 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3036
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #29 on: September 17, 2020, 10:19:31 am »
Your boost converter has an enable pin -- just connect it to the Q output of the flip-flop and forget the MOSFET.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19527
  • Country: gb
  • 0999
Re: Press and Hold Latching Circuit Questions
« Reply #30 on: September 17, 2020, 12:54:39 pm »
Just a couple quick notes:
Yes, connecting an RC circuit to the reset pin will ensure it always starts with the output off.  The reset pin needs to be pulled up via a resistor, with the capacitor going to 0V and it should have a considerably longer time constant, than R"*C2.

The circuit I posted will only reliably work with a flip-flop with Schmitt trigger inputs.

It's odd. The Texa Instruments data sheet for the SN74LVC1G74 says nothing about Schmitt trigger inputs, but nexperia's data sheet says it has them:
https://datasheet.lcsc.com/szlcsc/1806150327_Texas-Instruments-SN74LVC1G74DCUR_C70285.pdf
https://assets.nexperia.com/documents/data-sheet/74LVC1G74.pdf

The Philips datasheet for the 74HC(T)74, which is also available in through hole, says it has Schmitt trigger inputs.
http://i2c2p.twibright.com/datasheet/74HC_HCT74_3.pdf

The 74HCS74 is another example of a D flip-flop, with Schmitt trigger inputs.
https://www.ti.com/lit/ds/symlink/sn74hcs74-q1.pdf
 

Offline KuusouTopic starter

  • Contributor
  • Posts: 39
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #31 on: September 17, 2020, 03:36:55 pm »
Your boost converter has an enable pin -- just connect it to the Q output of the flip-flop and forget the MOSFET.

Ok but I don't understand how the 3.3V is suppose to connect to the boost converter. If the Q output of the flip-flop is just directly connected to the boost converter how is it going to draw up to 1.5 amps of current??? Wouldn't it have to go through that IC?  :-//


how does this work like in your example, where does that connection line go???
« Last Edit: September 17, 2020, 03:41:52 pm by Kuusou »
 

Offline KuusouTopic starter

  • Contributor
  • Posts: 39
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #32 on: September 17, 2020, 03:39:13 pm »
Just a couple quick notes:
Yes, connecting an RC circuit to the reset pin will ensure it always starts with the output off.  The reset pin needs to be pulled up via a resistor, with the capacitor going to 0V and it should have a considerably longer time constant, than R"*C2.

The circuit I posted will only reliably work with a flip-flop with Schmitt trigger inputs.

It's odd. The Texa Instruments data sheet for the SN74LVC1G74 says nothing about Schmitt trigger inputs, but nexperia's data sheet says it has them:
https://datasheet.lcsc.com/szlcsc/1806150327_Texas-Instruments-SN74LVC1G74DCUR_C70285.pdf
https://assets.nexperia.com/documents/data-sheet/74LVC1G74.pdf

The Philips datasheet for the 74HC(T)74, which is also available in through hole, says it has Schmitt trigger inputs.
http://i2c2p.twibright.com/datasheet/74HC_HCT74_3.pdf

The 74HCS74 is another example of a D flip-flop, with Schmitt trigger inputs.
https://www.ti.com/lit/ds/symlink/sn74hcs74-q1.pdf

Ok so this IC won't work. I'm only able to use JLCPCB components so I'm limited in that respect. I've found https://lcsc.com/product-detail/74-Series_Nexperia_74AHC74PW-118_74AHC74PW-118_C71900.html/?href=jlc-SMT, its a dual flip flop but should do the same job.

So how much longer should the time constant be? Longer than 100 milliseconds, longer than 2 seconds???  :-//
 

Offline S. Petrukhin

  • Super Contributor
  • ***
  • Posts: 1146
  • Country: ru
Re: Press and Hold Latching Circuit Questions
« Reply #33 on: September 19, 2020, 02:12:17 pm »
The most reliable way is to use a switch or a button with a lock. :)

But there is another good way: the button simply supplies power to the circuit, the MCU turns on and picks up the button using a simple MOSFET key. This way the processor will be able to turn itself off. If you need to turn off the same button, then it should be applied to the input of the processor so that it can detect pressing during operation and turn off the power. When connecting the battery directly to the MCU, it is more convenient to use deep sleep/stop and the wake button.

And there is also a specialized simple chip: https://lcsc.com/product-detail/Interface-Specialized_Maxim-Integrated-MAX16054AZT-T_C79401.html it is very comfortable, small and fulfills all your wishes.   :popcorn:
And sorry for my English.
 
The following users thanked this post: Kuusou

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19527
  • Country: gb
  • 0999
Re: Press and Hold Latching Circuit Questions
« Reply #34 on: September 20, 2020, 08:34:37 am »
Just a couple quick notes:
Yes, connecting an RC circuit to the reset pin will ensure it always starts with the output off.  The reset pin needs to be pulled up via a resistor, with the capacitor going to 0V and it should have a considerably longer time constant, than R"*C2.

The circuit I posted will only reliably work with a flip-flop with Schmitt trigger inputs.

It's odd. The Texa Instruments data sheet for the SN74LVC1G74 says nothing about Schmitt trigger inputs, but nexperia's data sheet says it has them:
https://datasheet.lcsc.com/szlcsc/1806150327_Texas-Instruments-SN74LVC1G74DCUR_C70285.pdf
https://assets.nexperia.com/documents/data-sheet/74LVC1G74.pdf

The Philips datasheet for the 74HC(T)74, which is also available in through hole, says it has Schmitt trigger inputs.
http://i2c2p.twibright.com/datasheet/74HC_HCT74_3.pdf

The 74HCS74 is another example of a D flip-flop, with Schmitt trigger inputs.
https://www.ti.com/lit/ds/symlink/sn74hcs74-q1.pdf

Ok so this IC won't work. I'm only able to use JLCPCB components so I'm limited in that respect. I've found https://lcsc.com/product-detail/74-Series_Nexperia_74AHC74PW-118_74AHC74PW-118_C71900.html/?href=jlc-SMT, its a dual flip flop but should do the same job.
That IC should be fine.

Quote from: datasheet
Schmitt-trigger action in the clock input makes the circuit highly tolerant to slower clock rise and fall times.

Quote
So how much longer should the time constant be? Longer than 100 milliseconds, longer than 2 seconds???  :-//
It needs to be longer than 100k*470nF, to ensure it ignores the pulse from the capacitor at the input charging up.
 

Online jfiresto

  • Frequent Contributor
  • **
  • Posts: 820
  • Country: de
Re: Press and Hold Latching Circuit Questions
« Reply #35 on: September 20, 2020, 09:54:05 am »
...I've found https://lcsc.com/product-detail/74-Series_Nexperia_74AHC74PW-118_74AHC74PW-118_C71900.html/?href=jlc-SMT, its a dual flip flop but should do the same job.
That IC should be fine.

Quote from: datasheet
Schmitt-trigger action in the clock input makes the circuit highly tolerant to slower clock rise and fall times.

You might double-check the data sheet. A "slower" clock input might still need an order 1 µs rise and fall time to satisfy the internal, M/S clocked logic block.
-John
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19527
  • Country: gb
  • 0999
Re: Press and Hold Latching Circuit Questions
« Reply #36 on: September 20, 2020, 10:50:30 am »
...I've found https://lcsc.com/product-detail/74-Series_Nexperia_74AHC74PW-118_74AHC74PW-118_C71900.html/?href=jlc-SMT, its a dual flip flop but should do the same job.
That IC should be fine.

Quote from: datasheet
Schmitt-trigger action in the clock input makes the circuit highly tolerant to slower clock rise and fall times.

You might double-check the data sheet. A "slower" clock input might still need an order 1 µs rise and fall time to satisfy the internal, M/S clocked logic block.
Why? The Schematic shows a Schmitt trigger on the clock input pin. See page 3, figure 4. A slow rising/falling clock would be internally converted to a fast/rising falling complementary clock.
 

Offline S. Petrukhin

  • Super Contributor
  • ***
  • Posts: 1146
  • Country: ru
And sorry for my English.
 

Online jfiresto

  • Frequent Contributor
  • **
  • Posts: 820
  • Country: de
Re: Press and Hold Latching Circuit Questions
« Reply #38 on: September 20, 2020, 11:57:22 am »
I was studying the MAX16054 on/off (and MAX6816-MAX6818 momentary) datasheets a few days ago to get a feel for a longest, tolerable switch debouncing delay. I would think 80 ms after the last switch transition might start to be noticeable.
-John
 

Online jfiresto

  • Frequent Contributor
  • **
  • Posts: 820
  • Country: de
Re: Press and Hold Latching Circuit Questions
« Reply #39 on: September 20, 2020, 12:01:23 pm »
...I've found https://lcsc.com/product-detail/74-Series_Nexperia_74AHC74PW-118_74AHC74PW-118_C71900.html/?href=jlc-SMT, its a dual flip flop but should do the same job.
That IC should be fine.

Quote from: datasheet
Schmitt-trigger action in the clock input makes the circuit highly tolerant to slower clock rise and fall times.

You might double-check the data sheet. A "slower" clock input might still need an order 1 µs rise and fall time to satisfy the internal, M/S clocked logic block.
Why? The Schematic shows a Schmitt trigger on the clock input pin. See page 3, figure 4. A slow rising/falling clock would be internally converted to a fast/rising falling complementary clock.
Because I do not see the word "unlimited", and when I design, I think Murphy was an optimist.
-John
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19527
  • Country: gb
  • 0999
Re: Press and Hold Latching Circuit Questions
« Reply #40 on: September 20, 2020, 02:35:58 pm »
...I've found https://lcsc.com/product-detail/74-Series_Nexperia_74AHC74PW-118_74AHC74PW-118_C71900.html/?href=jlc-SMT, its a dual flip flop but should do the same job.
That IC should be fine.

Quote from: datasheet
Schmitt-trigger action in the clock input makes the circuit highly tolerant to slower clock rise and fall times.

You might double-check the data sheet. A "slower" clock input might still need an order 1 µs rise and fall time to satisfy the internal, M/S clocked logic block.
Why? The Schematic shows a Schmitt trigger on the clock input pin. See page 3, figure 4. A slow rising/falling clock would be internally converted to a fast/rising falling complementary clock.
Because I do not see the word "unlimited", and when I design, I think Murphy was an optimist.
That's why I initially recommended the 74HCS74, which is available from Digikey and other suppliers.
https://www.digikey.com/product-detail/en/texas-instruments/SN74HCS74DR/296-SN74HCS74DRCT-ND/12352516

Presumably the original poster can't buy from DK? If so, I'd buy some of the NXP parts and test them. If the data sheet is correct, then they should work with unlimited rise and fall times of the input clock pulse.
 

Online jfiresto

  • Frequent Contributor
  • **
  • Posts: 820
  • Country: de
Re: Press and Hold Latching Circuit Questions
« Reply #41 on: September 20, 2020, 03:09:52 pm »
...I've found https://lcsc.com/product-detail/74-Series_Nexperia_74AHC74PW-118_74AHC74PW-118_C71900.html/?href=jlc-SMT, its a dual flip flop but should do the same job.
That IC should be fine.

Quote from: datasheet
Schmitt-trigger action in the clock input makes the circuit highly tolerant to slower clock rise and fall times.

You might double-check the data sheet. A "slower" clock input might still need an order 1 µs rise and fall time to satisfy the internal, M/S clocked logic block.
Why? The Schematic shows a Schmitt trigger on the clock input pin. See page 3, figure 4. A slow rising/falling clock would be internally converted to a fast/rising falling complementary clock.
Because I do not see the word "unlimited", and when I design, I think Murphy was an optimist.
That's why I initially recommended the 74HCS74, which is available from Digikey and other suppliers.
...
That one looks good, but is it special? I can find it in stock at Digikey and Mouser, but that is about it. None of the half dozen European distributors I use carry it.

EDIT: Ahhh, it is part of a new logic family, since May 2019, with unrestricted Schmitt trigger inputs. That could explain why many do not (yet?) carry it.
« Last Edit: September 20, 2020, 03:25:40 pm by jfiresto »
-John
 

Offline S. Petrukhin

  • Super Contributor
  • ***
  • Posts: 1146
  • Country: ru
Re: Press and Hold Latching Circuit Questions
« Reply #42 on: September 20, 2020, 03:20:17 pm »
I was studying the MAX16054 on/off (and MAX6816-MAX6818 momentary) datasheets a few days ago to get a feel for a longest, tolerable switch debouncing delay. I would think 80 ms after the last switch transition might start to be noticeable.

Do you think there is a need to press the power button faster than 10 times per second? Or the 50 mS power-on delay will  be visible?  :-//
And sorry for my English.
 

Online jfiresto

  • Frequent Contributor
  • **
  • Posts: 820
  • Country: de
Re: Press and Hold Latching Circuit Questions
« Reply #43 on: September 20, 2020, 03:27:28 pm »
Probably not for this application, but in my case, the 80 ms adds to a camera's shutter delay.
-John
 

Offline S. Petrukhin

  • Super Contributor
  • ***
  • Posts: 1146
  • Country: ru
Re: Press and Hold Latching Circuit Questions
« Reply #44 on: September 20, 2020, 03:51:49 pm »
Probably not for this application, but in my case, the 80 ms adds to a camera's shutter delay.

So you use an RC circuit with a sufficiently large resistance, it will give a delay also.
If time is critical for you, use the switch contacts button with RS-trigger (latch).
Debounsing always requires a time delay.
If you can react to the first front to turn it on instantly, you will have to be deaf for a while to turn it off.
And sorry for my English.
 

Online jfiresto

  • Frequent Contributor
  • **
  • Posts: 820
  • Country: de
Re: Press and Hold Latching Circuit Questions
« Reply #45 on: September 20, 2020, 05:19:43 pm »
Probably not for this application, but in my case, the 80 ms adds to a camera's shutter delay.
So you use an RC circuit with a sufficiently large resistance, it will give a delay also.
If time is critical for you, use the switch contacts button with RS-trigger (latch).
Debouncing always requires a time delay.
If you can react to the first front to turn it on instantly, you will have to be deaf for a while to turn it off.

I did as you suggest and first used an SPDT multimec NCNO push button to drive an S-R latch. After a bit of button pushing, confirmed with historical research, I changed to a lighter, 2 Newton SPST switch, an RC filter and a schmitt trigger block with a typical 20 ms and worst case 60 ms filter delay. These delays should be much shorter than waiting 20–80 ms after the final switch transition, as the above Maxim parts do, since any previous bounces will have already pushed the schmitt trigger partway toward the final input threshold. I mention this as something for the OP to ponder – if he is in to that.
-John
 

Offline KuusouTopic starter

  • Contributor
  • Posts: 39
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #46 on: September 25, 2020, 11:34:38 pm »
Thanks for all the help guys, and sorry for the delayed response, I've been busy with work.

Guys, don't waste your time. Explore the MAX16054.
https://lcsc.com/product-detail/Interface-Specialized_Maxim-Integrated-MAX16054AZT-T_C79401.html

My issue with this IC is it's extremely expensive for what it does, in fact its more expensive than the Atmega328P, because of that I'd rather not go this route.

Below is my current set up, I've found a cheap Schmitt trigger IC from JLCPCB https://lcsc.com/product-detail/Logic-ICs_ON-Semicon_NC7S14M5X_ON-Semicon-ON-NC7S14M5X_C7416.html/?href=jlc-SMT

I believe would allow me to use https://lcsc.com/product-detail/74-Series_TI_SN74LVC1G74DCUR_SN74LVC1G74DCUR_C70285.html/?href=jlc-SMT both of these components together only cost about $0.45.



My main concern is whether or not I've got the schematic set up properly. Would using the schmitt trigger IC allow me to use the SN74LVC1G74DCUR? It was suggested to forgo the MOSFET all together since the boost converter IC (FPS291LR-G1) has an enable pin. I also had the Vcc line for the boost converter set up incorrectly in my previous schematics I believe. Can someone confirm that it is correct to run a separate 3.3V line to the Vcc line of the boost converter IC and then use the SN74LVC1G74DCUR turn on and off the enable pin of the boost converter IC? Or is this just going to switch the power from 3V to 5V and still have power running to the rest of the board?


 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19527
  • Country: gb
  • 0999
Re: Press and Hold Latching Circuit Questions
« Reply #47 on: September 26, 2020, 04:02:49 pm »
I don't see why that wouldn't work.

My advice would be to build it on a bread board or strip board first. Use DIL adaptor boards for the SMT components, or glue them to the board and connect the pins with solderable enamelled copper wire.
 
The following users thanked this post: Kuusou

Offline KuusouTopic starter

  • Contributor
  • Posts: 39
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #48 on: September 26, 2020, 07:44:04 pm »
I don't see why that wouldn't work.

My advice would be to build it on a bread board or strip board first. Use DIL adaptor boards for the SMT components, or glue them to the board and connect the pins with solderable enamelled copper wire.

Well apparently on another forum they're saying that all this does is switch the power from 3.3V to 5V. They're saying that the boost converter output pin will be reading 3.3V. I'm unsure how to completely switch off power from the converter until the button is pressed  |O
 

Offline julian1

  • Frequent Contributor
  • **
  • Posts: 735
  • Country: au
Re: Press and Hold Latching Circuit Questions
« Reply #49 on: September 26, 2020, 08:27:22 pm »


Well apparently on another forum they're saying that all this does is switch the power from 3.3V to 5V. They're saying that the boost converter output pin will be reading 3.3V. I'm unsure how to completely switch off power from the converter until the button is pressed  |O

Yes, that's correct. You can see that DC voltage from 3.3V will flow through the inductor, through the schottky diode to the output 5.5V labelled line.

So you would need to add your power mosfet following the Boost converter to switch the output on/off.

Your control circuitry would then optionally enable/disable the boost converter, as well as the output mosfet.

The impression of the initial post is to control power safely. If that is the case, then mechanical switches with latched behavior and/or mechanical relays might be better. They behave more robustly for the state/transitions during power up/down and for failure scenarios.
 

Offline KuusouTopic starter

  • Contributor
  • Posts: 39
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #50 on: September 26, 2020, 09:59:25 pm »


Well apparently on another forum they're saying that all this does is switch the power from 3.3V to 5V. They're saying that the boost converter output pin will be reading 3.3V. I'm unsure how to completely switch off power from the converter until the button is pressed  |O

Yes, that's correct. You can see that DC voltage from 3.3V will flow through the inductor, through the schottky diode to the output 5.5V labelled line.

So you would need to add your power mosfet following the Boost converter to switch the output on/off.

Your control circuitry would then optionally enable/disable the boost converter, as well as the output mosfet.

The impression of the initial post is to control power safely. If that is the case, then mechanical switches with latched behavior and/or mechanical relays might be better. They behave more robustly for the state/transitions during power up/down and for failure scenarios.

I've used mechanical switches in previous iterations of this project, the problem is that they're easily switched on during transport/shipping and will completely drain the battery as a result. That's the main reason I'm switching to a soft latching switch that requires a long press to turn on. A mechanical switch would definitely make my design simpler but in this particular case its just not a viable option.
 

Offline KuusouTopic starter

  • Contributor
  • Posts: 39
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #51 on: September 26, 2020, 10:00:08 pm »
I think I've figured out how to cut off power to the entire boost converter circuit using the schematic below.



I'm using a BJT which has its base connected to the Q pin of the flip flop. Which is has its collector attached to the gate of a P-Channel MOSFET which acts as a switch for the main power going into the boost converter circuit. Please let me know if you believe this will work, any feedback is very much appreciated.
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2007
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #52 on: September 27, 2020, 01:48:59 am »
I believe you can just drive the mosfet gate directly from the /Q output of the flipflop, and do away with the NPN transistor.  The NPN inverts the Q output, but /Q is always the opposite of the Q output too, so you get an inverted Q either way.

If you use the NPN, you'll need a base resistor for it, and a pullup resistor on the mosfet gate.  But if you just drive the gate directly from /Q, I don't think you'll need either resistor.
« Last Edit: September 27, 2020, 01:58:23 am by Peabody »
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3036
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #53 on: September 27, 2020, 02:40:13 am »
In your circuit with the NPN you're missing a base resistor. But as Peabody said I would try using the /Q output to drive the P-channel MOSFET.

Quote
I've used mechanical switches in previous iterations of this project, the problem is that they're easily switched on during transport/shipping and will completely drain the battery as a result.

What about a slide switch with a shorter "knob" like this:

https://www.digikey.com/product-detail/en/c-k/S202131SS03Q/CKN11024-ND/3754439

Or go for an even flatter switch like the 110/220 selector you see on ATX power supplies.

Or even the the ol' battery protection pull tab:

https://www.fierceelectronics.com/components/pull-tabs-insulate-batteries-during-shipping-and-storage


 

Offline KuusouTopic starter

  • Contributor
  • Posts: 39
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #54 on: September 27, 2020, 02:50:52 am »
In your circuit with the NPN you're missing a base resistor. But as Peabody said I would try using the /Q output to drive the P-channel MOSFET.

Quote
I've used mechanical switches in previous iterations of this project, the problem is that they're easily switched on during transport/shipping and will completely drain the battery as a result.

What about a slide switch with a shorter "knob" like this:

https://www.digikey.com/product-detail/en/c-k/S202131SS03Q/CKN11024-ND/3754439

Or go for an even flatter switch like the 110/220 selector you see on ATX power supplies.

Or even the the ol' battery protection pull tab:

https://www.fierceelectronics.com/components/pull-tabs-insulate-batteries-during-shipping-and-storage

That's wayyyyy too expensive. Also this goes into a case and its rather small. All the switches I've looked at are way too large to fit. Also a pull tab wouldn't work because its ran off a lipo and even after shipping/transport I don't want someone to put the project in their bag and have it turned on. Switches just won't work this project in particular, plus at this point i'm determined to make this work hahaha
« Last Edit: September 27, 2020, 03:29:57 am by Kuusou »
 

Offline KuusouTopic starter

  • Contributor
  • Posts: 39
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #55 on: September 27, 2020, 03:08:59 am »
I believe you can just drive the mosfet gate directly from the /Q output of the flipflop, and do away with the NPN transistor.  The NPN inverts the Q output, but /Q is always the opposite of the Q output too, so you get an inverted Q either way.

If you use the NPN, you'll need a base resistor for it, and a pullup resistor on the mosfet gate.  But if you just drive the gate directly from /Q, I don't think you'll need either resistor.

Thanks for your response. I was trying to follow this circuit layout


and I just realized I forgot to add the resistors in my layout!. I'm confused as to why /Q works but Q doesn't? I'm sorry for being a noob with this stuff, I was hoping you could try to explain? My understanding is that the pulse sent to the flip flop becomes inverted by attaching /Q to the data input pin. So the pulse leading edge hits the IC, it says turn on but because /Q is inverted and is attached to the data pin it stays off until the low end of the pulse hits which is not until the end of a 2 second delay due to the rc timer circuit and hence I get my long press to turn on the power. If I use /Q to drive the gate instead of Q wouldn't that completely ignore the delayed start I'm looking for?

Looking at this more closely I think I'm seeing another issue. The flip flop doesn't remember states, I want to make sure that the board isn't powered on when plugged into power to charge the battery. I've got an RC circuit on the CLR pin (R6 & C6) I'm just insure of whether this circuit is pulling the pin low or high. I believe its pulling it low but I want to be sure.

Assuming that using /Q would remove the delayed start then would this solution would still work correct?
« Last Edit: September 27, 2020, 06:28:11 am by Kuusou »
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19527
  • Country: gb
  • 0999
Re: Press and Hold Latching Circuit Questions
« Reply #56 on: September 27, 2020, 09:45:18 am »


Well apparently on another forum they're saying that all this does is switch the power from 3.3V to 5V. They're saying that the boost converter output pin will be reading 3.3V. I'm unsure how to completely switch off power from the converter until the button is pressed  |O

Yes, that's correct. You can see that DC voltage from 3.3V will flow through the inductor, through the schottky diode to the output 5.5V labelled line.

So you would need to add your power mosfet following the Boost converter to switch the output on/off.

Your control circuitry would then optionally enable/disable the boost converter, as well as the output mosfet.

The impression of the initial post is to control power safely. If that is the case, then mechanical switches with latched behavior and/or mechanical relays might be better. They behave more robustly for the state/transitions during power up/down and for failure scenarios.
Sorry, I missed that. Yes, when the IC is disabled, its output transistor will be off, so the input voltage will flow through the diode to the output.

https://en.wikipedia.org/wiki/Boost_converter
I think I've figured out how to cut off power to the entire boost converter circuit using the schematic below.



I'm using a BJT which has its base connected to the Q pin of the flip flop. Which is has its collector attached to the gate of a P-Channel MOSFET which acts as a switch for the main power going into the boost converter circuit. Please let me know if you believe this will work, any feedback is very much appreciated.
Why not put the MOSFET on the output of the boost converter, after the diode, but before the divider? The current on the output will be lower than the input, which should give lower losses.

 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2007
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #57 on: September 27, 2020, 02:34:43 pm »
I'm confused as to why /Q works but Q doesn't? I'm sorry for being a noob with this stuff, I was hoping you could try to explain? My understanding is that the pulse sent to the flip flop becomes inverted by attaching /Q to the data input pin. So the pulse leading edge hits the IC, it says turn on but because /Q is inverted and is attached to the data pin it stays off until the low end of the pulse hits which is not until the end of a 2 second delay due to the rc timer circuit and hence I get my long press to turn on the power. If I use /Q to drive the gate instead of Q wouldn't that completely ignore the delayed start I'm looking for?

Looking at this more closely I think I'm seeing another issue. The flip flop doesn't remember states, I want to make sure that the board isn't powered on when plugged into power to charge the battery. I've got an RC circuit on the CLR pin (R6 & C6) I'm just insure of whether this circuit is pulling the pin low or high. I believe its pulling it low but I want to be sure.

You have the flipflop configured to come up with Q low.  You've done that with the R/C on /CLR.  But /Q is *always* just the inverted state of Q.  So the flipflop will come up with Q low, but also with /Q high.  High is the state needed on the mosfet gate to keep it turned off.  When the first long button press occurs, CLK will go high, and  the state of /Q (high) will be latched via the D pin to Q, which will bring Q high and /Q low, which will turn the mosfet on.  Both Q and /Q change state *immediately after* the rising edge of the CLK.  Nothing happens on the falling edge.  You get a falling edge when the button is released. Then the next long press produces another rising edge, which brings /Q high again, which turns off the mosfet.

Your NPN circuit is just an inverter for Q.  When Q goes high, the NPN brings the mosfet gate low, and vice versa.  But you already have something that always produces  an inverted version of Q, and that's /Q.  It should work exactly the same, but without the extra parts.

I think you would find it really helpful if you could breadboard stuff like this and test it out with through-hole versions of these chips.

Edit:  You could also drive the mosfet gate directly from Q, but you would need to move the R/C over to the /PREset pin so the  flipflop would come up with Q high.

« Last Edit: September 27, 2020, 02:54:00 pm by Peabody »
 
The following users thanked this post: Kuusou

Offline KuusouTopic starter

  • Contributor
  • Posts: 39
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #58 on: September 27, 2020, 07:39:51 pm »
I'm confused as to why /Q works but Q doesn't? I'm sorry for being a noob with this stuff, I was hoping you could try to explain? My understanding is that the pulse sent to the flip flop becomes inverted by attaching /Q to the data input pin. So the pulse leading edge hits the IC, it says turn on but because /Q is inverted and is attached to the data pin it stays off until the low end of the pulse hits which is not until the end of a 2 second delay due to the rc timer circuit and hence I get my long press to turn on the power. If I use /Q to drive the gate instead of Q wouldn't that completely ignore the delayed start I'm looking for?

Looking at this more closely I think I'm seeing another issue. The flip flop doesn't remember states, I want to make sure that the board isn't powered on when plugged into power to charge the battery. I've got an RC circuit on the CLR pin (R6 & C6) I'm just insure of whether this circuit is pulling the pin low or high. I believe its pulling it low but I want to be sure.

You have the flipflop configured to come up with Q low.  You've done that with the R/C on /CLR.  But /Q is *always* just the inverted state of Q.  So the flipflop will come up with Q low, but also with /Q high.  High is the state needed on the mosfet gate to keep it turned off.  When the first long button press occurs, CLK will go high, and  the state of /Q (high) will be latched via the D pin to Q, which will bring Q high and /Q low, which will turn the mosfet on.  Both Q and /Q change state *immediately after* the rising edge of the CLK.  Nothing happens on the falling edge.  You get a falling edge when the button is released. Then the next long press produces another rising edge, which brings /Q high again, which turns off the mosfet.

Your NPN circuit is just an inverter for Q.  When Q goes high, the NPN brings the mosfet gate low, and vice versa.  But you already have something that always produces  an inverted version of Q, and that's /Q.  It should work exactly the same, but without the extra parts.

I think you would find it really helpful if you could breadboard stuff like this and test it out with through-hole versions of these chips.

Edit:  You could also drive the mosfet gate directly from Q, but you would need to move the R/C over to the /PREset pin so the  flipflop would come up with Q high.

Ok now I'm really confused. This is a p-channel mosfet. My understanding is that you have to drive the gate high to turn it on and allow current to flow from the source to drain.  You're saying it has to have voltage applied to the gate to keep it off, which is incorrect as far as my understanding goes. Unless I'm confused and by high you mean no voltage applied and low means voltage applied? What am I missing here?
 

Online jfiresto

  • Frequent Contributor
  • **
  • Posts: 820
  • Country: de
Re: Press and Hold Latching Circuit Questions
« Reply #59 on: September 27, 2020, 08:10:29 pm »
A p-channel MOSFET works like a PNP transistor in that you pull the gate toward negative to turn it on.

If you want to learn more, download a copy of Don Lancaster's "CMOS Cookbook" from his website. He wrote it for people wanting to use the then, new and original 4000-series CMOS. Forty odd years later, it still holds up very well as a clear and practical text for learning digital design. You can answer your own question after reading and absorbing chapter one.
-John
 
The following users thanked this post: Kuusou

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2007
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #60 on: September 27, 2020, 08:59:19 pm »
 Well, both P-channel and N-channel mosfets are turned off if the gate and the source are at the same voltage.  An N-channel mosfet will turn on when the gate voltage goes above the source voltage.  A P-channel mosfet turns on when the gate voltage goes below the source voltage.  So an N-channel mosfet works like an NPN bipolar transistor, and a P-channel mosfet works like a PNP transistor.

So your circuit with the NPN would work (with the resistors added). If Q comes up low, the transistor would be off, and the gate pullup resistor (when added) would bring the mosfet gate up to the same voltage as the source, which turns off the mosfet.

Youtube is your friend.  I'll bet there are many videos there about how D flipflops and mosfets work.
 
The following users thanked this post: Kuusou


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf