Help designing a latching electronic switch

--
If you can use a single-pole double-throw momentary switch, then
debouncing is easy and the circuit can be put together with a 4013, a
transistor and a handful of passive components.  If you have to use a
SPST switch, then it\'ll have to be debounced differently.  Which way
do you want to go?
Reply to
John Fields
Loading thread data ...

hen

If

a

Hi, Mark. Novice and newbie questions always welcome here.

If you've got half of a CMOS inverter IC (4000-series would include

4049, 4069, 40106, 74C-series include 74C04, 74C14, &c) or three gates you can set up as inverters (NAND, NOR, &c), this circuit might fill the bill (view in fixed font or Notepad):

~ Logic Toggle Pushbutton With Power-On Reset ~ VCC VCC ~ + + ~ | | ~ 1N4002| | ~ VCC - C| ~ + ___ ^ C| RY1 ~ | .----------|___|--------. | C| ~=2E33uF | | 22K | | | ~ --- | | '---o ~ --- 1N4002| | | ~ | |\\ | |\\ |\\ | ___ |/ ~ o--| >O--|O---o----| >O--o--|___|-o-| Q1 ~ | |/ | |/ | |/ 22K | |>

~ .-. | .-. .-. | ~ 10K | | | 220K| | | | | ~ | | | | | 22K| | | ~ '-' | T '-' '-' | ~ | | --- | || | | ~ | '--o o-------o----||----. =3D=3D=3D =3D=3D=3D ~ =3D=3D=3D || | GND GND ~ GND SW1 .022uF | ~ | | =3D=3D=3D GND created by Andy=B4s ASCII-Circuit v1.24.140803 Beta

formatting link

Make sure you use a darlington NPN transistor (like the TIP120) to switch the relay. This keeps the load on the last inverter down to around 1mA or so, which any CMOS inverter can handle at 12V. This should be good for any relay coil that draws less than half an amp.

The first inverter with the diode is set up as MML (Mickey Mouse Logic). It's only active at turn-on, and forces the input of the second inverter to be low right after turn-on. That means the third inverter will be low, and your transistor will be off. After a period set by the R and C (something on the order of 3ms) the output of the first inverter will be high, and the diode will effectively remove it from the circuit.

This stuff was borrowed piecemeal from Don Lancaster's CMOS Cookbook, which is a good intro to digital electronics for newbies. It's available at Amazon, libraries, and Mr. Lancaster's website:

formatting link

Good luck Chris

Reply to
Chris

Hi there

I am a novice at electronics so please bear with me!

I need to design a latching electronic switch with a momentary push switch as a trigger. When the trigger is pushed, the switch will latch closed. When the trigger is pushed again the switch will toggle back to the open position. The switch needs to be able to break/supply power a 12v relay. If the circuit loses and regains power the switch should default back to the open position.

For reasons I won't go in to at this stage it is not possible just to use a latching switch to supply the power to the relay.

Hopefully someone can help me if this design is possible!

Thanks Mark

Reply to
Mark Ashley

--
OK, that can be easily enough accomplished, depending on what you\'ve
got the eight momentary switches hooked to.  Hopefully, you\'re
switching either Vcc or ground on _all_ of them and we can use
something like an 8-input AND or NAND to decode the all-buttons-down
state and toggle the latch. Can you post a schematic of what you\'ve
got or describe the circuit in a little more detail?
Reply to
John Fields

Hi John

I can't use SPDT switches easily as the switches are specific (arcade machine buttons to be precise). The only way I could make them SPDT would be to attach a relay to each one, but wouldn't that increase the risk of bouncing?

Perhaps if I explain exactly what I want to do it will be a little clearer. I have built an arcade machine with 8 momentary SPST switches. These, as well as a joystick, connect to an xbox pad so I can use it to play xbox games. Currently I have a SPST toggle switch which energises a 4 pole relay. When energised this physically disconnects the arcade controls and connects a normal xbox pad. I want to remove the toggle switch and replace it with a circuit which will toggle between the arcade controls and the xbox pad only when I press all of the buttons on the arcade controls at the same time.

Mark

Reply to
Mark Ashley

Thanks for this Chris. I will have a look for some information on the IC you have used in this circuit so I can find which pins I need to connect to. Unless you fancy saving me some legwork... ;)

Mark

Hi, Mark. Novice and newbie questions always welcome here.

If you've got half of a CMOS inverter IC (4000-series would include

4049, 4069, 40106, 74C-series include 74C04, 74C14, &c) or three gates you can set up as inverters (NAND, NOR, &c), this circuit might fill the bill (view in fixed font or Notepad):

~ Logic Toggle Pushbutton With Power-On Reset ~ VCC VCC ~ + + ~ | | ~ 1N4002| | ~ VCC - C| ~ + ___ ^ C| RY1 ~ | .----------|___|--------. | C| ~.33uF | | 22K | | | ~ --- | | '---o ~ --- 1N4002| | | ~ | |\\ | |\\ |\\ | ___ |/ ~ o--| >O--|O---o----| >O--o--|___|-o-| Q1 ~ | |/ | |/ | |/ 22K | |>

~ .-. | .-. .-. | ~ 10K | | | 220K| | | | | ~ | | | | | 22K| | | ~ '-' | T '-' '-' | ~ | | --- | || | | ~ | '--o o-------o----||----. === === ~ === || | GND GND ~ GND SW1 .022uF | ~ | | === GND created by Andy´s ASCII-Circuit v1.24.140803 Beta

formatting link

Make sure you use a darlington NPN transistor (like the TIP120) to switch the relay. This keeps the load on the last inverter down to around 1mA or so, which any CMOS inverter can handle at 12V. This should be good for any relay coil that draws less than half an amp.

The first inverter with the diode is set up as MML (Mickey Mouse Logic). It's only active at turn-on, and forces the input of the second inverter to be low right after turn-on. That means the third inverter will be low, and your transistor will be off. After a period set by the R and C (something on the order of 3ms) the output of the first inverter will be high, and the diode will effectively remove it from the circuit.

This stuff was borrowed piecemeal from Don Lancaster's CMOS Cookbook, which is a good intro to digital electronics for newbies. It's available at Amazon, libraries, and Mr. Lancaster's website:

formatting link

Good luck Chris

Reply to
Mark Ashley

John - how does this look? (open in Andy's ASCII-Circuit or notepad). Would this layout affect the normal functioning of the switches?

GND 1 2 3 4 5 6 7 8 | | | | | | | | | | _/ | | | | | | | | |-o/ o-o-)-)-)-)-)-)-)------o | | | | | | | | | | _/ | | | | | | | | o-o/ o---o-)-)-)-)-)-)--\\ | __ | | | | | | | \\ o-| \\ __ | _/ | | | | | | \\ | )--| \\ __ o-o/ o-----o-)-)-)-)-)-\\ \\o-|__/ | )--| \\ __ | | | | | | \\-----------|__/ | )--| \\ | _/ | | | | | /---------------|__/ | )-o o-o/ o-------o-)-)-)-)-----/ o--------------------|__/ | | | | | | | | | _/ | | | | | o-----------------------o o-o/ o---------o-)-)-)--------o | __ | | | | o-| \\ __ | _/ | | | | )--| \\ __ o-o/ o-----------o-)-)-----------o-|__/ | )--| \\ | | | o-|__/ | )---- | _/ | | | o-|__/ o-o/ o-------------o-)------------------o | | | | | _/ | | o-o/ o---------------o-------------------------o (created by AACircuit v1.28.6 beta 04/19/05

formatting link

Reply to
spam

One of the legs of each momentary switch is connected to a common ground, which comes from a single point on the xbox pad, then daisy chains to each switch. This includes the four switches for the joystick I think. The other side of each switch then goes to its own point on the pad. I haven't measured what is going across the switch when it is closed, but I can do this if necessary.

Is that enough information? I can post more or a schematic if you need me to.

I really appreciate all your help!

Thanks Mark

Reply to
Mark Ashley

One of the legs of each momentary switch is connected to a common ground, which comes from a single point on the xbox pad, then daisy chains to each switch. This includes the four switches for the joystick I think. The other side of each switch then goes to its own point on the pad. I haven't measured what is going across the switch when it is closed, but I can do this if necessary.

Is that enough information? I can post more or a schematic if you need me to.

I really appreciate all your help!

Thanks Mark

Reply to
Mark Ashley

--
That would be a good idea.  I think the switches are wired like this:


Vcc>--+----- - - ----+
      |              |        
     [R]            [R]      
      |              |        
      +--+           +--+     
      |  |           |  |
    | O  |         | O  |
    |    |         |    |
    | O  |         | O  |
      |  |           |  |
      |  |           |  |
GND>--+--|-- - - ----+  |
         |              |
       OUT1            OUT8

so that each output would be at Vcc until a switch was pressed, and
then it would go to ground for as long as the switch was pressed.  If
you could verify that by measuring the output voltages with the
switches open and pressed that would be fine.  Also, if you could
determine the values of the resistors and post that information that
would be helpful.  

>Is that enough information? I can post more or a schematic if you need me 
>to.

A schematic would be ideal.
Reply to
John Fields

--- Probably not, but you've left the input bubble off of the last gate in the top group, plus the implementatuion would take a NOR, an AND and a NAND. What I had in mind was more like this:

Vcc | +----+----+----+----+----+----+----+ | | | | | | | | [R1] [R2] [R3] [R4] [R5] [R6] [R7] [R8] S1___ | | | | | | | | +--O O--+----|----|----|----|----|----|----|--A |S2___ | | | | | | | | OR Y--A +--O O-------+----|----|----|----|----|----|--B OR Y--A ___ |S3___ | | | | | | | | B OR Y-->OUT TO +--O O------------+----|----|----|----|----|--A | B TOGGLE |S4___ | | | | | | | | OR Y--+ | +--O O-----------------+----|----|----|----|--B | |S5___ | | | | | | | | | +--O O----------------------+----|----|----|--A | |S6___ | | | | | | | | OR Y--A | +--O O---------------------------+----|----|--B OR Y--+ |S7___ | | | | | | | | B SPARE +--O O--------------------------------+----|--A | +--A |S8___ | | | | | | | | OR Y--+ | OR Y +--O O-------------------------------------+--B +--B | | | | | | | | | | GND OUT1 OUT2 OUT3 OUT4 OUT5 OUT6 OUT7 OUT8 GND

which uses two quad 2 input NORs; HC32's or CD4071's.

It could also be implemented with a single chip, a dual 4 input OR (CD4072) and a couple of diodes, like this:

FROM S1>---A FROM S2>---B ___ Y---[CR1>]--+--->OUT FROM S3>---C | | FROM S4>---D | | | FROM S5>---A | | FROM S6>---B | Y---[CR2>]--+ FROM S7>---C | [10K] FROM S8>---D | GND

It might even be possible to do it with all diodes and resistors, depending on what Mark's circuit looks like.

-- John Fields Professional Circuit Designer

Reply to
John Fields

--
Unless... Are those all supposed to be ORs and the "o"\'s are
connections?  If so, then your approach and mine are basically the
same.
Reply to
John Fields

Chris, I think he wants to press 8 buttons to activate the toggle. But, for a simple relay toggle using only one transistor, 4 resistors and one capacitor, there is an example on my page titled

"Single Transistor Relay Toggle Circuit"

formatting link

-Bill

Reply to
wrongaddress

Those gates in Chris's circuit could be in a variety of ICs, and so the pins will vary accordingly. For example, here's the circuit redrawn for a CMOS 4011 Quad NAND:

formatting link

Note that the circuit uses only 3 of the 4 ('Quad') gates. The two input pins of the unused gate are therefore shown wired to ground.

--
Terry Pinnell
Hobbyist, West Sussex, UK
Reply to
Terry Pinnell

er

Hi, Mark. Try this (view in fixed font or Notepad):

` (X =3D X-Box pullup resistor) ` T ` --- ` .---o o---X---------. ` | | ` | T | ` | --- | ` o---o o---X--------.| VCC ` | || 4078 + ` | T || 8-input | ` | --- |'-o| OR(Pin 1)/ .-. VCC VCC ` o---o o---X-------.| | NOR(Pin 13) | | + + ` | |'--o| | | | | ` | T | | 220K'-' .--o---o--. ` | --- '---o|__ | | | ` o---o o---X------. -|>=3D| 1 | | | ` | '----o|1 |------------|----o | ` | T -|__| | | o---->A ` | --- .----o| | | 555 | ` o---o o---X------' | o--o-o | ` | .---o| +| | | | ` | T | | 10uF --- '-o | ` | --- |.--o| --- | | ` o---o o---X-------'| | | '--o---o--' ` | |.-o| | | | ` | T || =3D=3D=3D =3D=3D=3D =3D=3D=3D ` | --- || GND GND GND ` o---o o---X--------'| ` | | ` | T | ` | --- | ` o---o o---X---------' ` | ` =3D=3D=3D ` GND ` `

` VCC VCC ` + + ` | | ` | | ` .-----------------------. - C| ` | | ^ C| ` | | | C| ` | .--------. | | | ` | | | | | | ` | | =3D=3D=3D | '---o ` | .-----o------.GND | | ` | | S | | ___ |/ ` '----oD Q o--------|___|- -| TIP120 ` | | | 10K | |>

` | 1/2 4013 | | .-. | ` | | | | | | ` A>---------o CLK | | 10K| | | ` VCC | | | '-' | ` + | | | | | ` | | | | | | ` .-. | Q'o-----' =3D=3D=3D =3D=3D=3D ` 10K | | | | GND GND ` | | | R | ` '-' '-----o------' ` | | ` o-----------' ` | ` .1uF --- ` --- ` | ` =3D=3D=3D ` GND created by Andy=B4s ASCII-Circuit v1.24.140803 Beta

formatting link

GND when they are pressed, and show a logic level high when they're not pressed. First, you need to get a power supply voltage which is the same voltage as the power supply of the logic circuit you're interfacing (+/- 0.2V). Once you've done that, get a 4078 (8-input OR/NOR), a 555, and a 4013 to do your job, along with the handful of components shown.

Not so elegant, but it should do the job. The CD4078 has 8 inputs and two outputs -- OR (pin 1) and NOR (pin 13). The OR will only go low when all 8 inputs are low (what you want). That signal then triggers a

555, which is on for about 2 seconds (giving you your debounce) and clocking a 4013 set up as a toggle F-F. The R/C at the reset input ensures that the circuit will power up with the transistor off.

You should be able to put all this on a small perfboard, and you'll be good to go with the Pretendo relay switch.

Good luck Chris

Reply to
Chris

And I meant to add that the 4011's supply and ground pins (not usually shown explicitly on schematics) are 14 and 7 respectively.

--
Terry Pinnell
Hobbyist, West Sussex, UK
Reply to
Terry Pinnell

Hi John

Just to clear up any confusion - snipped-for-privacy@pinkdoggy.net is me, posting from google :)

No the gates in my circuit diagram are supposed to be AND gates, and the Os were connections. I have downloaded a trial copy of CircuitMaker and tested your circuit design (the one with the NOR gates) and have had limited success. Would you mind if I email you screenshots of the circuit so I can more easily explain?

Thanks Mark

Reply to
Mark Ashley

=3D

The drawing wasn't too clear on something -- It's important that the CMOS IC be at the same voltage as the X-Box. That will probably mean using a 7805 if the X-box has a 5V supply, and an LM317 if it's an oddball voltage. You can use either of these as a post-regulator after your +12V for the relay.

.-------------------> To Relay | ____ 12V | | | o--o---|7805|---o------> To Logic +| |____| |+ --- | --- 10uF --- | ---10uF | | | =3D=3D=3D =3D=3D=3D =3D=3D=3D GND GND GND created by Andy=B4s ASCII-Circuit v1.24.140803 Beta

formatting link

Either that or jsut decide to get a 4PDT telecom relay with a 5V coil voltage.

If you can, find out the power supply voltage and get back to us. You might get some more help or another, better idea.

Good luck Chris

Reply to
Chris

--
I used ORs, since for the circuit to work properly the gates must be
ORs since what\'s being detected is the all-zeroes state. If you use
ANDs, then any switch pressed will cause the output to go low, which
will effect the toggle.

It would be better if you posted them to
alt.binaries.schematics.electronic.  That way, everyone who\'s
following the thread can stay connected.
Reply to
John Fields

I don't understand that. I thought an OR gate would output when *any* of the inputs were true. I have copied and pasted this truth table for an OR gate:

Input A Input B Output Q

0 0 0 0 1 1 1 0 1 1 1 1

Also, I though an AND gate would only output if *all* of the inputs were true, as below:

Input A Input B Output Q

0 0 0 0 1 0 1 0 0 1 1 1

I am sure that you are correct in what you say, but I would like to understand it better rather than just taking your word for it :)

I have posted them there, under the same heading as this thread.

Thanks again Mark

Reply to
Mark Ashley

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.