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

0 Members and 1 Guest are viewing this topic.

Offline Kuusou

  • Contributor
  • Posts: 32
  • 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: 1010
  • Country: us
Re: Press and Hold Latching Circuit Questions
« Reply #26 on: September 17, 2020, 06:22:36 am »
Here is a crude schematic:

[attachimg=1]

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: 1010
  • 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 Kuusou

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

[attachimg=1]

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: 1010
  • 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: 14693
  • 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 Kuusou

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

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

  • Frequent Contributor
  • **
  • Posts: 413
  • 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: 14693
  • 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.
 

Offline jfiresto

  • Frequent Contributor
  • **
  • Posts: 477
  • 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.
 

Online Zero999

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

  • Frequent Contributor
  • **
  • Posts: 413
  • Country: ru
And sorry for my English.
 

Offline jfiresto

  • Frequent Contributor
  • **
  • Posts: 477
  • 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.
 

Offline jfiresto

  • Frequent Contributor
  • **
  • Posts: 477
  • 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.
 

Online Zero999

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

Offline jfiresto

  • Frequent Contributor
  • **
  • Posts: 477
  • 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 »
 

Offline S. Petrukhin

  • Frequent Contributor
  • **
  • Posts: 413
  • 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.
 

Offline jfiresto

  • Frequent Contributor
  • **
  • Posts: 477
  • 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.
 

Offline S. Petrukhin

  • Frequent Contributor
  • **
  • Posts: 413
  • 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.
 

Offline jfiresto

  • Frequent Contributor
  • **
  • Posts: 477
  • 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.
 

Offline Kuusou

  • Contributor
  • Posts: 32
  • 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: 14693
  • 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 Kuusou

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

Online julian1

  • Frequent Contributor
  • **
  • Posts: 345
  • 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf