Maker Pro
Maker Pro

8 switches

i'm creating a basic device,

i have 8 basic open switches.

if i close one switch, i want the main circuit to be complete, however
if more than one are closed, i want the circuit to remain open.

i'm new to electronics and i was considering 8 seperate relays but i'm
assuming this would require 8 seperate switch circuits with 8 seperate
batteries, however each relay would close the same main circuit.

can someone advise on a better design ?
 
J

Jonathan Kirwan

Jan 1, 1970
0
i'm creating a basic device,

i have 8 basic open switches.

if i close one switch, i want the main circuit to be complete, however
if more than one are closed, i want the circuit to remain open.

i'm new to electronics and i was considering 8 seperate relays but i'm
assuming this would require 8 seperate switch circuits with 8 seperate
batteries, however each relay would close the same main circuit.

can someone advise on a better design ?

Why are you circumspect about your intended purpose? What is the
purpose? Is this a question from a book or test? Or is this for a
game of some kind?

Jon
 
well i can see how my post could be seen as annoying, im designin a
device that according to my research has not been created yet and i'd
like to design and test it before revealing its purpose.

it's not a question from a book or test. however the design could be
seen as an educational tool. i'll be creating a webpage if the design
is successful and beneficial to students, i can see it being very
beneficial and naturally forcing students to use good form and
technique.

it won't take long to construct but the materials used must be very
light to keep the instruction realistic and non-fatigueing, and this
will be expensive as custom made machined parts will be necessary. can
you guess what it is ?

i'll post and graph student's progress and results including my own
when this project is complete. hopefully the prototype will immediately
eliminate bad habits. any help on the electronics side would be
appreciated. im thinking relays or some kind of boolean logic chip :)
 
J

Jonathan Kirwan

Jan 1, 1970
0
well i can see how my post could be seen as annoying, im designin a
device that according to my research has not been created yet and i'd
like to design and test it before revealing its purpose.

it's not a question from a book or test. however the design could be
seen as an educational tool. i'll be creating a webpage if the design
is successful and beneficial to students, i can see it being very
beneficial and naturally forcing students to use good form and
technique.

it won't take long to construct but the materials used must be very
light to keep the instruction realistic and non-fatigueing, and this
will be expensive as custom made machined parts will be necessary. can
you guess what it is ?

i'll post and graph student's progress and results including my own
when this project is complete. hopefully the prototype will immediately
eliminate bad habits. any help on the electronics side would be
appreciated. im thinking relays or some kind of boolean logic chip :)

It's difficult for me to suggest an approach. I've no idea if relays
are required, at all, from the description. Maybe, or maybe not. What
is being driven? How must the resulting switch function be attached?
What are the voltage levels that the switch function must handle? How
precisely must be all of the timing of observing the input switches
and developing the control output? Must the output be held for some
duration even if a second switch is then operated? I don't know what
is acceptable and what isn't to you. Just way, way too vague.

Sometimes, this is helped a great deal by knowing the application. If
it is something within our reasoning and experience, we can fill in a
lot of the gaps by common sense and don't have to beg for information.
But perhaps, if you won't talk about it directly, we can play a little
game and find out indirectly what you'd consider and not consider by
just shooting in the dark, blindly tossing darts so to speak, until
you clue us all in a tiny bit at a time. A kind of 20 questions?

I'm good for one go at it.

For me, the simple approach would be to use a 16-pin PIC, scan the
input sources and debounce them in software, test them as per your
spec, and drive _something_ from one of the pins on the basis of that
result. But then, I program such things a lot.

There's my tossed dart. You tell me where it hit.

Jon
 
i feel bad not writing a more descriptive requirement .. thanks for
your input john, ill get back to this post in a few days when i have
time and can provide more details
 
T

Tom Biasi

Jan 1, 1970
0
i'm creating a basic device,

i have 8 basic open switches.

if i close one switch, i want the main circuit to be complete, however
if more than one are closed, i want the circuit to remain open.

i'm new to electronics and i was considering 8 seperate relays but i'm
assuming this would require 8 seperate switch circuits with 8 seperate
batteries, however each relay would close the same main circuit.

can someone advise on a better design ?
Start out by making a truth table of what you want.
 
S

Si Ballenger

Jan 1, 1970
0
i'm creating a basic device,

i have 8 basic open switches.

if i close one switch, i want the main circuit to be complete, however
if more than one are closed, i want the circuit to remain open.

i'm new to electronics and i was considering 8 seperate relays but i'm
assuming this would require 8 seperate switch circuits with 8 seperate
batteries, however each relay would close the same main circuit.

can someone advise on a better design ?

Well, you probably could use 9 relays, one being the master
normally closed relay for the master circuit, and the other eight
normally open operated by the switches. Connect the eight NO
relay conatacts to a power supply and a resistor, and parallel
the outputs to coil of the master relay. Size the resistors such
that current thorugh only one isn't enough to operate the master
relay, but current through two or more in parallel is sufficient
to operate the master coil, opening the master circuit.
 
J

John Popelish

Jan 1, 1970
0
i'm creating a basic device,

i have 8 basic open switches.

if i close one switch, i want the main circuit to be complete, however
if more than one are closed, i want the circuit to remain open.

i'm new to electronics and i was considering 8 seperate relays but i'm
assuming this would require 8 seperate switch circuits with 8 seperate
batteries, however each relay would close the same main circuit.

can someone advise on a better design ?
How about an analog approach. Tie each switch to a positive supply,
and put an equal resistor in series with each. Parallel all resistor
switch pairs and connect to zero volts through a 9th resistor equal to
about 70% of one of the other 8. Something like 8 of 10k resistors
and 1 of 6.8k. Then use a window comparator to sense the voltage
across the 9th (lower value) resistor is higher than what you get with
one switch closed, but less than what you get with 2 or more switches
closed. The reference voltages for this comparator could be a divider
made of 3 resistors across the same supply that powers the switches
with series resistors. Something like supply to 10k to 3k to 2k to ground.

A good dual comparator for this job might be an LM393.
http://www.fairchildsemi.com/ds/LM/LM393.pdf

Then you can energize a relay or whatever with the window comparator
output.

Total parts count 12 resistors and a dual comparator, and what ever
you need to drive the relay.
 
J

John Fields

Jan 1, 1970
0
i'm creating a basic device,

i have 8 basic open switches.

if i close one switch, i want the main circuit to be complete, however
if more than one are closed, i want the circuit to remain open.

i'm new to electronics and i was considering 8 seperate relays but i'm
assuming this would require 8 seperate switch circuits with 8 seperate
batteries, however each relay would close the same main circuit.

can someone advise on a better design ?

Sure! :



Vcc Vcc
| |
| [4K7]
[0.499K] |
| +----[1M]-+
| | | 74HC86
+---+---|+\ | +-----+
| | >--+-------+--|A1 |
| +-|-/ | | Y1|--+
[2.49K] | Vcc +--|--|B1 | |
| | | | | | | |
| | [4K7] | +--|A2 | |
| | | | | | Y2|--+
Vcc | +-|---[1M]-+ +--|--|B2 | |
| | | | | | | | | |
[1000] +---+-|-|+\ | | +--|A3 | |
| | | | >---+---+ | | Y3|--+
+-----//----+------|-----+-|-/ +--|--|B3 | |
| | | LM393 | | | | |
[1000] [1000] | | +--|A4 | |
| | [2.00K] | | Y4|--+
D Q1 D Q8 | +---- |B4 | |
IN1>---G 2N7000 +--G 2N7000| +-----+ |
S | S | |
| | | | +-----------------------------+
| | | | |
GND>----+-------|---+------+ |
| | VCC VCC
IN2>---TO Q2-G | | | |
| | [1N4001] COIL- -|
IN3>---TO Q3-G | [100R] | | O->| <--O-NO
| | +--------+ | |
IN4>---TO Q4-G | | | | O K1
| | C | |
IN5>---TO Q5-G | +-----B | +-----COM
| E |
IN6>---TO Q6-G | | +--------NC
| GND
IN7>---TO Q7-G |
|
IN8>------------+


Typical for all inputs, a SPST NO switch closing to Vcc:

Vcc--O--> |
|
O
|
+--->to Qn gate
|
[10K]
|
gnd



With no switch or with more than one swith closed, the circuit
between the common and the normally closed contacts of K1 will be
open. With any single switch closed, the relay will make the
contact between COM and NO.

Need a circuit description?
 
these are all awesome ideas ! thanks everyone ..

which one these designs would be

1) most compact
2) the lightest
3) the cheapest to manufacture in small (50) quantities ?
 
B

BobG

Jan 1, 1970
0
can someone advise on a better design ?
====================================
separate has 'a rat' in it
 
J

John Popelish

Jan 1, 1970
0
these are all awesome ideas ! thanks everyone ..

which one these designs would be

1) most compact
2) the lightest
3) the cheapest to manufacture in small (50) quantities ?
Mine.
 
R

Randy Day

Jan 1, 1970
0
John said:

John's is an excellent suggestion. You
can't get much smaller than 1
easy-to-find IC and 12 resistors.

That doesn't include the output transistor
and the relay/diode, of course.

Matt: The other neat thing about John's
suggestion is that, if you decide you need
more than 8 switches, all you have to add
is one resistor for each new switch.
 
J

John Fields

Jan 1, 1970
0

---
Looking over John Popelish's response(s), I see that the MOSFET
switches I was using are unnecessary and the circuit can look like
this:


+5V
|
[1000]
|
+----+---+-------+-------+-------+-------+-------+-------+-->Eo
| | | | | | | | |
[1000] | [1000] [1000] [1000] [1000] [1000] [1000] [1000]
| | | | | | | | |
O| | O| O| O| O| O| O| O|
O| | O| O| O| O| O| O| O|
|S1 | |S2 |S3 |S4 |S5 |S6 |S7 |S8
+----|---+-------+-------+-------+-------+-------+-------+
| |
GND |
|
|
+--+
|
Vcc | Vcc
| | |
| | [4K7]
[0.499K] | |
| +-|--[1M]-+
| | | | 74HC86
+---+-|-|+\ | +-----+
| | | >--+-------+--|A1 |
| +-|-/ | | Y1|--+
[2.49K] | Vcc +--|--|B1 | |
| | | | | | | |
| | [4K7] | +--|A2 | |
| | | | | | Y2|--+
| +-|---[1M]-+ +--|--|B2 | |
| | | | | | | | |
+---+-|-|+\ | | +--|A3 | |
| | | >---+---+ | | Y3|--+
| +-|-/ +--|--|B3 | |
| LM393 | | | | |
| | +--|A4 | |
[2.00K] | | Y4|--+
| +---- |B4 | |
GND +-----+ |
|
+---------------------+
|
|
| +V +V
| [1N4001] [COIL]- -|
[100R] | | O-> |<--O-NO
| +--------+ | |
| | | O K1
| C | |
+------B | +-----COM
E |
| +---------NC
GND


With a Vcc of 5V, the values chosen for the reference divider will
allow one millampere to flow thrugh it and its output voltages will
be:


5V
|
[499R]
|
+-----4.5V
|
[2.49K]
|
+-----2.0V
|
[2.00K]
|
GND



With none of the switches pressed, Eo will be at 5V, and since the
inputs to the non-inverting inputs of the comparators (from the
reference divider) will be at 4.5V, the outputs of both comparators
will be low.


With any single switch pressed, the switch divider will look like
this:


5V E1
|
[1000]R1
|
+---->Eo
|
[1000]R2
|
GND

and Eo will be:


E1 R2 5V * 1000R
Eo = --------- = --------------- = 2.5V
R1 + R2 1000R + 1000R


Now, since that voltage will be on the inverting input of the
comparator with 4.5V on its non-inverting input, (and will be less
positive than 4.5V) that comparator's output will go high.

However, since the other comparator's non-inverting input is at
2.0V, its output will stay low


Next, if we push two buttons, the switch divider will look like
this:

+5V
|R1
[1000]
|
+-------+---->Eo
|R2 |R3
[1000] [1000]
| |
+-------+
|
GND

and because R2 and R3 are in parallel, their total resistance will
be:


R2R3 1000R * 1000R
Rt = ------- = --------------- = 500 ohms
R2+R3 1000R + 1000R


So, the divider now looks like this:


+5V E1
|R1
[1000]
|
+----->Eo
|R2
[500]
|
GND

and Eo becomes:


E1R2 5v * 500R
Eo = ------- = -------------- ~ 1.67V
R1+R2 1000R + 500R


Now, since 1.67V is lower than the reference voltages on either of
the non-inverting inputs of the comparators, both of their outputs
will go high.

If we make a truth table for all possible combinations of switch
activations it will look like this, where 'n' is the number of
switches pressed and 'OUT1' and 'OUT2' are the logical output states
of the comparators:

n OUT1 OUT2
-----|------|------
0 0 0
1 1 0
2 1 1
3 1 1
4 1 1
5 1 1
6 1 1
7 1 1
8 1 1

Now, since the OP only wants an output when one buton is pressed,
and the only time the outputs of the comparators are different is
when one button is pressed, we can use an EXCLUSIVE OR to decode
that state. Additionally, since a 74HC86 contains four EXORs, we
can run them in parallel and use them to drive a moderate-current
bipolar relay driver. (Or anything else, with proper modifications)
 
J

John Fields

Jan 1, 1970
0

---
Looking over John Popelish's response(s), I see that the MOSFET
switches I was using are unnecessary and the circuit can look like
this:


+5V
|
[1000]
|
+----+---+-------+-------+-------+-------+-------+-------+-->Eo
| | | | | | | | |
[1000] | [1000] [1000] [1000] [1000] [1000] [1000] [1000]
| | | | | | | | |
O| | O| O| O| O| O| O| O|
O| | O| O| O| O| O| O| O|
|S1 | |S2 |S3 |S4 |S5 |S6 |S7 |S8
+----|---+-------+-------+-------+-------+-------+-------+
| |
GND |
|
|
+--+
|
Vcc | Vcc
| | |
| | [4K7]
[0.499K] | |
| +-|--[1M]-+
| | | | 74HC86
+---+-|-|+\ | +-----+
| | | >--+-------+--|A1 |
| +-|-/ | | Y1|--+
[2.49K] | Vcc +--|--|B1 | |
| | | | | | | |
| | [4K7] | +--|A2 | |
| | | | | | Y2|--+
| +-|---[1M]-+ +--|--|B2 | |
| | | | | | | | |
+---+-|-|+\ | | +--|A3 | |
| | | >---+---+ | | Y3|--+
| +-|-/ +--|--|B3 | |
| LM393 | | | | |
| | +--|A4 | |
[2.00K] | | Y4|--+
| +---- |B4 | |
GND +-----+ |
|
+---------------------+
|
|
| +V +V
| [1N4001] [COIL]- -|
[100R] | | O-> |<--O-NO
| +--------+ | |
| | | O K1
| C | |
+------B | +-----COM
E |
| +---------NC
GND


With a Vcc of 5V, the values chosen for the reference divider will
allow one millampere to flow thrugh it and its output voltages will
be:


5V
|
[499R]
|
+-----4.5V
|
[2.49K]
|
+-----2.0V
|
[2.00K]
|
GND



With none of the switches pressed, Eo will be at 5V, and since the
inputs to the non-inverting inputs of the comparators (from the
reference divider) will be at 4.5V, the outputs of both comparators
will be low.


With any single switch pressed, the switch divider will look like
this:


5V E1
|
[1000]R1
|
+---->Eo
|
[1000]R2
|
GND

and Eo will be:


E1 R2 5V * 1000R
Eo = --------- = --------------- = 2.5V
R1 + R2 1000R + 1000R


Now, since that voltage will be on the inverting input of the
comparator with 4.5V on its non-inverting input, (and will be less
positive than 4.5V) that comparator's output will go high.

However, since the other comparator's non-inverting input is at
2.0V, its output will stay low


Next, if we push two buttons, the switch divider will look like
this:

+5V
|R1
[1000]
|
+-------+---->Eo
|R2 |R3
[1000] [1000]
| |
+-------+
|
GND

and because R2 and R3 are in parallel, their total resistance will
be:


R2R3 1000R * 1000R
Rt = ------- = --------------- = 500 ohms
R2+R3 1000R + 1000R


So, the divider now looks like this:


+5V E1
|R1
[1000]
|
+----->Eo
|R2
[500]
|
GND

and Eo becomes:


E1R2 5v * 500R
Eo = ------- = -------------- ~ 1.67V
R1+R2 1000R + 500R


Now, since 1.67V is lower than the reference voltages on either of
the non-inverting inputs of the comparators, both of their outputs
will go high.

If we make a truth table for all possible combinations of switch
activations it will look like this, where 'n' is the number of
switches pressed and 'OUT1' and 'OUT2' are the logical output states
of the comparators:

n OUT1 OUT2
-----|------|------
0 0 0
1 1 0
2 1 1
3 1 1
4 1 1
5 1 1
6 1 1
7 1 1
8 1 1

Now, since the OP only wants an output when one buton is pressed,
and the only time the outputs of the comparators are different is
when one button is pressed, we can use an EXCLUSIVE OR to decode
that state. Additionally, since a 74HC86 contains four EXORs, we
can run them in parallel and use them to drive a moderate-current
bipolar relay driver. (Or anything else, with proper modifications)


---

Changing some polarities and wire-ORing the outputs gets rid of the
EXOR, and the relay contact designations were wrong, but are fixed
below:

+5V
|
[1000]
|
+----+---+-------+-------+-------+-------+-------+-------+-->Eo
| | | | | | | | |
[1000] | [1000] [1000] [1000] [1000] [1000] [1000] [1000]
| | | | | | | | |
O| | O| O| O| O| O| O| O|
O| | O| O| O| O| O| O| O|
|S1 | |S2 |S3 |S4 |S5 |S6 |S7 |S8
+----|---+-------+-------+-------+-------+-------+-------+
| |
GND |
|
|
+--+
|
|
|
VCC |
| | VCC
[510R] | |
| | [1K]
+-----|-|+\ | +V +V
| | | >--+ |K |
| +-|-/ | [1N4001] [COIL]- -|
| | | | | O-> |<--O----->NC
[2.4K] | | +--------+ | |
| | | | | O K1
| +-|+\ | D | |
| | >--+-----G | +--------->COM
+-------|-/ S |
| LM393 | +------------->NO
[2K] GND
|
GND
 
John said:
Changing some polarities and wire-ORing the outputs gets rid of the
EXOR, and the relay contact designations were wrong, but are fixed
below:

+5V
|
[1000]
|
+----+---+-------+-------+-------+-------+-------+-------+-->Eo
| | | | | | | | |
[1000] | [1000] [1000] [1000] [1000] [1000] [1000] [1000]
| | | | | | | | |
O| | O| O| O| O| O| O| O|
O| | O| O| O| O| O| O| O|
|S1 | |S2 |S3 |S4 |S5 |S6 |S7 |S8
+----|---+-------+-------+-------+-------+-------+-------+
| |
GND |
|
|
+--+
|
|
|
VCC |
| | VCC
[510R] | |
| | [1K]
+-----|-|+\ | +V +V
| | | >--+ |K |
| +-|-/ | [1N4001] [COIL]- -|
| | | | | O-> |<--O----->NC
[2.4K] | | +--------+ | |
| | | | | O K1
| +-|+\ | D | |
| | >--+-----G | +--------->COM
+-------|-/ S |
| LM393 | +------------->NO
[2K] GND
|
GND

I thank you for converting my rambling description to a schematic. I
didn't have time to do it, myself, last night.

I think I like it with the switches pulling up, better, because it puts
both sensing levels within the common mode range for lower power supply
voltages (all the way down to 3). And if you use a PNP relay driver,
it can be driven in series with the common pull up resistor on the
outputs, so a normally open contact can be used, or the active high
collector might be the actual output, itself. Can't say for sure,
because we don't know what the intended load is.
 
I think I like it with the switches pulling up, better, because it puts
both sensing levels within the common mode range for lower power supply
voltages (all the way down to 3). And if you use a PNP relay driver,
it can be driven in series with the common pull up resistor on the
outputs, so a normally open contact can be used, or the active high
collector might be the actual output, itself. Can't say for sure,
because we don't know what the intended load is.

Forget that part about the PNP driver eliminating the NC contact. The
signal in in the "window" when neiither comparator is pulling down, so
an NPN or N channel driver will be on in th window.
 
John Fields wrote:
(snip)
+5V
|R1
[1000]
|
+-------+---->Eo
|R2 |R3
[1000] [1000]
| |
+-------+
|
GND
(snip)

I think you will get the largest possible voltage difference between 1
switch closed and 2 switches closed if R1=1/(sqrt(2))*R2. That is why
I recommended 10k at each switch and 6.8K as the common series
resistor. I chose higher values than you did, because I was imagining
(for no particular reason) the whole thing running from a 9 volt
battery.
 
R

Rich Grise

Jan 1, 1970
0
well i can see how my post could be seen as annoying, im designin a
device that according to my research has not been created yet and i'd
like to design and test it before revealing its purpose.

You don't have to reveal the end purpose of a design, just to
tell us what's expected to be switched. You want a one-and-only-
one gate. I seem to remember this from the Don Lancaster TTL
cookbook.

<wheels turn, smoke comes from ears>

Ew. A one-and-only-one gate. All inputs low, output = low. One
input high, all others low = output high. Two or more inputs
high, output = low.

Sounds like a _really_ exclusive-or gate! ;-P

I think I'll use that as an exercise on these new tools that
this latest client turned me on to. ;-) With a micro, it's
trivial - count bits. With combinatorial logic - heck, in
Verilog or VHDL it's the equivalent of a "switch" statement.

Oh My God. We've come full-circle.

Thanks!
Rich
 
R

Rich Grise

Jan 1, 1970
0
Well, you probably could use 9 relays, one being the master
normally closed relay for the master circuit, and the other eight
normally open operated by the switches. Connect the eight NO
relay conatacts to a power supply and a resistor, and parallel
the outputs to coil of the master relay. Size the resistors such
that current thorugh only one isn't enough to operate the master
relay, but current through two or more in parallel is sufficient
to operate the master coil, opening the master circuit.

You've just designed a Rube Goldberg doorbell. ;-P

Cheers!
Rich
 
Top