Very basic question - latching circuit for momentary switch

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, this is one of those incredibly basic questions that I am embarrassed to ask... I'm looking for a self latching circuit that can operate with a normally open switch and hopefully pull a 5 volt line low. I can trigger it with either pulling the trigger to ground, or supplying 5 volts to the trigger as there is nothing preventing me from wiring the switch any way that is needed. I'm also looking to do this with the smallest parts count, hopefully a single chip to do everything as opposed a few resistors and a few transistors.

The output of pulling a 5 volt line low is pulling an I/O pin low so current shouldn't be an issue.

Operation is:
push switch, pull data line low

push switch again and data line goes back to high or floating

Can anyone recommend a chip to do this?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

From what I understand you're trying to simply toggle the data line using a push button.

A JK flip flop would work perfectly for this. If you tie both J and K high and connect your button to the clock line, the JK output will flip every clock cycle, or every time you push your button. You might have a problem with mechanical bouncing triggering it multiple times however.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
The output of pulling a 5 volt line low is pulling an I/O pin low

So, it sounds like the circuit already has a micro...

No spare pins?

If you had a pin to spare then the easiest solution is just to do the toggle in software. Debounce the switch and toggle the Switch State every time it is pushed.

This would take no extra chips or transistors. Whether you put any R's or C's in for ESD protection is up to you, but that actually applies no matter how you connect the switch.

There are quite a few Threads about the "I need one more pin dilemma". If Search doesn't turn up anything useful then raise the question and you will get lots of suggestions.

Option #2, of course, is to select a larger uC with more pins. Total chip count is not increased. No transistors needed, etc.

Option #3 is to use a Tiny as a front end processor for the switch. Let the Tiny read the switch, debounce it, toggle it's State variable, and control the I/O line it feeds. You can probably find a Tiny with a smaller pin count than a JK flip-flop, although I haven't looked for a FF in years...

Option #4: Use a Flip Flop.

BTW, someone could probbly do this with a 555, but lets not start that discussion yet again.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The_village_idiot wrote:
I'm looking for a self latching circuit that can operate with a normally open switch and hopefully pull a 5 volt line low.
Is there any reason not to use a latching mechanical switch? Like this ... first press = closes; next press = opens.

http://www.altronics.com.au/inde...

Cheers,

Ross

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
BTW, someone could probbly do this with a 555, but lets not start that discussion yet again.

:)
And there are some dedicated circuits with ESD and debouncing in one package.

No RSTDISBL, no fun!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi

Quote:
Option #4: Use a Flip Flop.

you could also make a simple flip flop using 2 transistors.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

amoghas wrote:

you could also make a simple flip flop using 2 transistors.

please elaborate...

Even a D flip flop needs 4 nand gates + inverter which totals 18 transistors.

A JK flip flop is more than twice that.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can't fit a latching switch on the circuit board with the other low profile tactile switches or that would be my first choice because it would be easy. This is also on a device that I did not and can not program so I can't just write the function into the software or again it would be easy. This will be a shift key on a keyboard encoder, I need to latch it to hold the encoder in the second level of outputs. Eventually I need to do the work to learn how to make this encoder for myself and then things will operate differently.

An 8 pin soic single channel device would be best, but that part you linked could work since they have a soic and I can slap one of the pdip in a bread board and play with it to make sure I understand what I am doing.

Now that you guys have confirmed the info I found on the web, I should be able to get this done unless someone has a favorite 8 pin chip they want to recommend.

Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

GordonFreeman wrote:
amoghas wrote:

you could also make a simple flip flop using 2 transistors.

please elaborate...

Even a D flip flop needs 4 nand gates + inverter which totals 18 transistors.

A JK flip flop is more than twice that.

From: http://pcbheaven.com/wikipages/Transistor_Circuits/

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Since you can wire the pushbutton any way you like, how about two inverters such as 74HC1G14 or 74HC1G04 (small enough for you in single package?) and some passives (perhaps two resistors and one capacitor).

Give the inverters weak (100k?) positive feedback from input to output, so it acts like memory. Then charge the capacitor with negative feedback (1k?), so capacitor always contains opposite of what is the next state. Then when button is pushed, it overrides the positive feedback with negative, so it changes state. Now I saw circuit somewhere but I can't remember actual component values or point you a link to it, so you need to fiddle around with the values.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jayjay1974 wrote:
GordonFreeman wrote:
amoghas wrote:

you could also make a simple flip flop using 2 transistors.

please elaborate...

Even a D flip flop needs 4 nand gates + inverter which totals 18 transistors.

A JK flip flop is more than twice that.

From: http://pcbheaven.com/wikipages/Transistor_Circuits/

I stand corrected. :D

I guess I was considering a simple latch to not be a flip flop but Wikipedia says otherwise.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As it stands, that circuit, while it may well qualify for the title flip-flop, does not fill the requirement of "push once for on, again for off".

Four legs good, two legs bad, three legs stable.