# 12-volt matrix input->output?

J

#### John E.

Jan 1, 1970
0
I want to turn on 4 lamps in 6 combinations. These are controlled by 3
switches in 6 corresponding combinations of contact closings.

The truth table looks like this

Switches Lamps
A B C W X Y Z
----- -------
0 1 0 1 0 0 0
0 1 1 1 1 0 0
1 0 0 0 0 1 0
1 0 1 1 0 1 0
1 1 0 1 0 0 1
1 1 1 1 1 1 1

While it's straight 3-bit binary count input, how to I translate it to the
desired 4 output combinations? What's the best way to implement such an
input-to-output matrix?

Input from switches is 12 vdc and output requires 12 vdc, milliamp drive.

I'm ignorant in all things PIC, so prefer to have another solution.

Ideas?

J

#### Jan Panteltje

Jan 1, 1970
0
I want to turn on 4 lamps in 6 combinations. These are controlled by 3
switches in 6 corresponding combinations of contact closings.

The truth table looks like this

Switches Lamps
A B C W X Y Z
----- -------
0 1 0 1 0 0 0
0 1 1 1 1 0 0
1 0 0 0 0 1 0
1 0 1 1 0 1 0
1 1 0 1 0 0 1
1 1 1 1 1 1 1

While it's straight 3-bit binary count input, how to I translate it to the
desired 4 output combinations? What's the best way to implement such an
input-to-output matrix?

Input from switches is 12 vdc and output requires 12 vdc, milliamp drive.

I'm ignorant in all things PIC, so prefer to have another solution.

Ideas?

Program EPROM.
data outputs - resistor - transistor - lamp.
Allows for max 8 lamps.
And for the smallest EPROM > 1000 switches.

Can also be done with a 4051 (ABC input) 1 of 8 decoder,
and some diodes resistors and transistors too.
(You take a few diodes to the lamps drivers from 6 of the 8 outputs).

J

#### John E.

Jan 1, 1970
0
Thus spake Jan Panteltje:
Program EPROM.
data outputs - resistor - transistor - lamp.
Allows for max 8 lamps.
And for the smallest EPROM > 1000 switches.

Sounds very flexible, but again, I'm programming limited, so I think this
won't work for me.
Can also be done with a 4051 (ABC input) 1 of 8 decoder,
and some diodes resistors and transistors too.
(You take a few diodes to the lamps drivers from 6 of the 8 outputs).

I'm interested in single-chip OTS (off the shelf) solutions like this.

The data sheet says:
"The CD4051B is a single 8-Channel multiplexer having three binary control
inputs, A, B, and C, and an inhibit input. The three binary signals select 1
of 8 channels to be turned on, and connect one of the 8 inputs to the
output."

(ref: <http://www.tranzistoare.ro/datasheets/120/109150_DS.pdf>)

With my eyes, it looks like it's not what I'm looking for. It simply connects
one input to one output. In one possible configuration of this flexible chip,
the input is common (which, connected to 12v, would work for my purposes) and
depending on the 3-bit binary control, be connected to one of the 8 outputs,
which would not work for me, as I need 6 outputs working at once, some high,
some low). It is a multiplexer, which might work for LEDs, but I am driving
12vdc relay coils with the output of this circuit.

Or am I missing something... (my default presumption).

Thanks,

B

#### Bob n.

Jan 1, 1970
0
These are controlled by 3
switches in 6 corresponding combinations of contact closings.

If the current requirements were within CMOS or CMOS plus transistors,
you could use that to produce a regular 1 of 8 output, then diode-OR
to drive the lamps. But you didn't say the switches had to be single-
pole. If switch A is single-pole double-throw, switch B is double-
pole, double-throw, and switch C is 4-pole double-throw, that
combination also produces 1 of 8 output, that can handle any current
the switches can.

Since you don't need outputs 0 and 1, switch C need be only triple-
pole double throw.

W= 2 or 3 or 5 or 6 or 7
X= 3 or 7
Y=4 or 5 or 7
Z=6 or 7

Using 1 of 8 decoders and diode-OR, that would be 12 diodes. But
using the switches, the input poles of switch C are already (2 or 3)
(4 or 5) and (6 or 7). So using those connections, you only need 8
diodes to run the 4 lights.

What does this logic actually do?

J

#### Jan Panteltje

Jan 1, 1970
0
"The CD4051B is a single 8-Channel multiplexer having three binary control
inputs, A, B, and C, and an inhibit input. The three binary signals select 1
of 8 channels to be turned on, and connect one of the 8 inputs to the
output."

(ref: <http://www.tranzistoare.ro/datasheets/120/109150_DS.pdf>)

With my eyes, it looks like it's not what I'm looking for. It simply connects
one input to one output. In one possible configuration of this flexible chip,
the input is common (which, connected to 12v, would work for my purposes) and
depending on the 3-bit binary control, be connected to one of the 8 outputs,
which would not work for me, as I need 6 outputs working at once, some high,
some low). It is a multiplexer, which might work for LEDs, but I am driving
12vdc relay coils with the output of this circuit.

Or am I missing something... (my default presumption).

OK, but I'l do only part of the design:
Switches Lamps
A B C W X Y Z
----- -------
0 1 0 1 0 0 0
0 1 1 1 1 0 0
1 0 0 0 0 1 0
1 0 1 1 0 1 0
1 1 0 1 0 0 1
1 1 1 1 1 1 1

------------------------------------------------------------------------------------------
CD4051 diode LAMP
matrix
+12V in 1

2 ------------------ a diode k ----------> W'
|
3 -------------------a diode k -----
|
--a diode k ----------> X'

S1 puldown resistors A 4 -------------------a diode k-----------> Y'

S2 B 5

S3 C 6

So if '2' selected ,as in table above, W goes on.
If 3 is selected, both W and X go on.
If 4 is selected Y goes on.
All diodes 1n914
Can you do the diodes for 5 and 6?
Normally 4051 cannot drive a bulb, so we need some amplification.

+12V
|
bulb A
|
|----
A' --| | Power MOSFET
|----
|
///

J

#### John E.

Jan 1, 1970
0
Thus spake Jan Panteltje:
OK, but I'l do only part of the design:
Thanks!

So if '2' selected ,as in table above, W goes on.
If 3 is selected, both W and X go on.
If 4 is selected Y goes on.
All diodes 1n914

Ah, diode matrix! In the back of my mind (a crowded place, to be sure) such
an idea was lurking. Just couldn't bring it to mind.
Can you do the diodes for 5 and 6?

Uh, I think so (c:
Normally 4051 cannot drive a bulb, so we need some amplification.

I see no output current spec in the data sheet. Is this simply presumed to be
a low value? Not 10 mA? (I'm driving relays with the circuit.)

Thanks for making this reasonalby understandable by a good tech, but poor
designer.

J

#### Jan Panteltje

Jan 1, 1970
0
Thus spake Jan Panteltje:

Ah, diode matrix! In the back of my mind (a crowded place, to be sure) such
an idea was lurking. Just couldn't bring it to mind.

Uh, I think so (c:

I see no output current spec in the data sheet. Is this simply presumed to be
a low value? Not 10 mA? (I'm driving relays with the circuit.)

I remember Ron is < 150 Ohm or so... I think it will not drive a relay.
The MOSFETS are only 2 $or so, and will drive a relay if yu use a flyback diode. +12V | |---------- k | diode [ \ ] relay coil a | |---------- | |---- A' -----| | Power MOSFET | |---- resistor | 100k /// | | <- connect to output 7 of the CD4051 If you connect the thing as above, you save 4 diodes by connecting all resistors that hold the gates down to output 7 of the CD4051, so if output 7 goes high, then all MOSFETS are powered, and all lights go on. You need these resistors anyways. Thanks for making this reasonalby understandable by a good tech, but poor designer. You are welcome. J #### Joerg Jan 1, 1970 0 John said: I want to turn on 4 lamps in 6 combinations. These are controlled by 3 switches in 6 corresponding combinations of contact closings. The truth table looks like this Switches Lamps A B C W X Y Z ----- ------- 0 1 0 1 0 0 0 0 1 1 1 1 0 0 1 0 0 0 0 1 0 1 0 1 1 0 1 0 1 1 0 1 0 0 1 1 1 1 1 1 1 1 While it's straight 3-bit binary count input, how to I translate it to the desired 4 output combinations? What's the best way to implement such an input-to-output matrix? Input from switches is 12 vdc and output requires 12 vdc, milliamp drive. I'm ignorant in all things PIC, so prefer to have another solution. As others have suggested this can be done using a decoder and diode to wire up the desired lamp combination. Instead of analog muxes you can also use the CD4028 and use only the A, B and C inputs. Wire D to ground. http://focus.ti.com/lit/ds/symlink/cd4028b.pdf Digikey has it in stock even in the old DIP version, 52 cents a pop. If you need more than a milliamp or so you could use a driver from the ULN series. J #### jasen Jan 1, 1970 0 I want to turn on 4 lamps in 6 combinations. These are controlled by 3 switches in 6 corresponding combinations of contact closings. The truth table looks like this Switches Lamps A B C W X Y Z ----- ------- 0 1 0 1 0 0 0 0 1 1 1 1 0 0 1 0 0 0 0 1 0 1 0 1 1 0 1 0 1 1 0 1 0 0 1 1 1 1 1 1 1 1 W = C or B X = B and C Y = ( not B ) or (A and C) Z = A and B Input from switches is 12 vdc and output requires 12 vdc, milliamp drive. I'm ignorant in all things PIC, so prefer to have another solution. with those specifications the 4000 series CMOS logic family sound good, they're inexpensive and will run from 12V just fine. it's going to take three chips the easist way would be a 4071 (that has 4 or gates) a 4081 (that has 4 and gates) and a 4069 ( that has 6 not gates - a hex inverter) the three should come in under$2

get ones in DIP package unless you have a goos reason ot to.

it'll cost you more in circuitboard than chips

4071 datasheet
4069 datasheet
4081 datasheet

and it'll find you a PDF that explains how to use the chips.

Bye.
Jasen

J

#### John E.

Jan 1, 1970
0
Thus spake Jan Panteltje:
If you connect the thing as above, you save 4 diodes by connecting all
resistors
that hold the gates down to output 7 of the CD4051, so if output 7 goes high,
then all MOSFETS are powered, and all lights go on.
You need these resistors anyways.

Sort of using 4015 output pin 7 as a pull-down resistor for the MOSFET's
gates?

What MOSFET would you recommend? I might want to power 2 relays in parallel
with each of the 4 MOSFETs... Is this 60v N-channel one, with 1.2 ohm
on-resistance an appropriate choice? :

<http://www.jameco.com/Jameco/Products/ProdDS/256031FSC.pdf>

And it includes a diode (which will act as a flyback, yes?)

And about input conditioning: mechanical switch contacts will be "not clean",
probably causing problems with bouncing, noise, etc. Best way to clean up
these inputs?

Thanks,

J

#### John E.

Jan 1, 1970
0
Thus spake Joerg:
As others have suggested this can be done using a decoder and diode to
wire up the desired lamp combination. Instead of analog muxes you can
also use the CD4028 and use only the A, B and C inputs. Wire D to ground.

I've looked at the data sheet. Fewer pins to deal with (no inhibit, no
input/output control) -- looks more straightforward...

J

#### John E.

Jan 1, 1970
0
it's going to take three chips
....

Jasen,
I really appreciate the fresh approach of looking at the inputs as logical
inputs and using a Boolean solution, but I think I'll stick with the 1-chip
solution (and a few diodes and resistors and MOSFETs).

I've seen several of your creative suggestions in these groups. Maybe I'll be
able to utilize one next time...

Thanks,

J

#### John E.

Jan 1, 1970
0
Jan Panteltje diagrams:
+12V
|
|----------
k |
diode [ \ ] relay coil
a |
|----------
|
|----
A' -----| | Power MOSFET
| |----
resistor |
100k ///
|
| <- connect to output 7 of the CD4051

Just to clarify...

The 2, 3, 4, 5, and 6 outputs connect to the 4 MOSFET gates via diodes. The 7
output connects to each of the MOSFET gates via resistors (instead of
diodes). The resistors serve dual purpose of isolating (the term
"open-collector" comes to mind) the gates from the outputs, and act as
pull-down resistors also.

Thanks,

J

#### John E.

Jan 1, 1970
0
Thus spake Bob n.:
But you didn't say the switches had to be single-
pole.

The existing 3 input switches are simple on-off SPST.

G

#### Graham Holloway

Jan 1, 1970
0
John E. said:
I want to turn on 4 lamps in 6 combinations. These are controlled by 3
switches in 6 corresponding combinations of contact closings.

The truth table looks like this

Switches Lamps
A B C W X Y Z
----- -------
0 1 0 1 0 0 0
0 1 1 1 1 0 0
1 0 0 0 0 1 0
1 0 1 1 0 1 0
1 1 0 1 0 0 1
1 1 1 1 1 1 1

While it's straight 3-bit binary count input, how to I translate it to the
desired 4 output combinations? What's the best way to implement such an
input-to-output matrix?

Input from switches is 12 vdc and output requires 12 vdc, milliamp drive.

I'm ignorant in all things PIC, so prefer to have another solution.

Ideas?

What's wrong with relay logic, apart from the cost? No input or output
interface problems, (potentially) no PCB needed, no electronics!

Graham Holloway
(Electronics Designer)

T

#### Tony Williams

Jan 1, 1970
0
John E. said:
Switches Lamps
A B C W X Y Z
----- -------
0 1 0 1 0 0 0
0 1 1 1 1 0 0
1 0 0 0 0 1 0
1 0 1 1 0 1 0
1 1 0 1 0 0 1
1 1 1 1 1 1 1

If you are already using relays then I think this can
be done with 3-off 4-pole changeover relays.

.-------------------.
NC | NC | NC
/ | / | /
/ | / | /
12v---A1 | 12v---B1 '---C1
NO---' NO--------------NO---> W output

NC NC NC
/ / /
/ / /
A2 12v---B2 .-------C2
NO NO---' NO---> X output

.--------------.
NC NC---' NC |
/ / / |
/ / / |
12v---A3 .-------B3 .-------C3 |
NO---' NO---' NO--+> Y output

NC NC NC
/ / /
/ / /
12v---A4 .-------B4 C4
NO---' NO---. NO
'---------------> Z output

/|\ /|\ /|\
| | |
A-contacts B-contacts C-contacts

A-----. B-----. C-----.
| | |
___|___ ___|___ ___|___
| | | | | |
| CoilA | | CoilB | | CoilC |
|_______| |_______| |_______|
| | |
0v----+---------------+---------------+

J

#### Jan Panteltje

Jan 1, 1970
0
On a sunny day (Sat, 24 Feb 2007 20:33:47 GMT) it happened Jan Panteltje

+12V
|
|----------
k |
diode [ \ ] relay coil
a |
|----------
|
|----
A' -----| | Power MOSFET
| |----
resistor |
100k ///
|
|----< connect to output 7 of the CD4051
|
3300 Ohm pull down resistor.
|
///

If you connect the thing as above, you save 4 diodes by connecting all resistors
that hold the gates down to output 7 of the CD4051, so if output 7 goes high,
then all MOSFETS are powered, and all lights go on.
You need these resistors anyways.

Small correction, you then also need a 3300 Ohm resistor to ground from output 7
of the CD4051 (see modified diagram above).
This because the switch to output 7 is normally open, and _something_ should
pull the resistor network to ground if 7 is not selected.
With max 2 bulbs on, in the other cases then 7, the divider would be 50k / 3k3.
And the voltage it would see about 11.3 V.
That gives a max off voltage at the MOSFET gates of about 0.7 V.
The current would be (if on) 12 / 3300) = 3.6 mA.
The internal switch in the CD4051 is max 150 Ohm and would hardly dissipate
anything.
Or use a CD4028 BCD to decimal decoder, as Joerg suggested, as it has a true zero output.
I personally have a whole lot of 4051 / 4053 switches around, as they can make any logic,
modulators, decoders, what not...
So that was my natural choice...

J

#### John E.

Jan 1, 1970
0
Thus spake Jan Panteltje:
Or use a CD4028 BCD to decimal decoder, as Joerg suggested, as it has a true
zero output.

If I use CD4028, I will not need 3300 pull-down resistor? But the rest of the
circuit will remain the same?

Thanks,

J

#### Jan Panteltje

Jan 1, 1970
0
Thus spake Jan Panteltje:

Sort of using 4015 output pin 7 as a pull-down resistor for the MOSFET's
gates?

What MOSFET would you recommend? I might want to power 2 relays in parallel
with each of the 4 MOSFETs... Is this 60v N-channel one, with 1.2 ohm
on-resistance an appropriate choice? :

<http://www.jameco.com/Jameco/Products/ProdDS/256031FSC.pdf>

That one is already 'on' at .8V, I'd rather use one that was on at about 6V

And it includes a diode (which will act as a flyback, yes?)

The flyback would be positive, maybe above 60V in this case.
That intrinsic diode only limits negative swings.
Some MOSFETS have avalanche protection diodes that way (the intrinsic diode
then zeners), not this one I think.

Replies
4
Views
368
Replies
2
Views
593
Replies
39
Views
2K
Replies
15
Views
806
Replies
12
Views
2K