Connect with us

12-volt matrix input->output?

Discussion in 'Electronic Design' started by John E., Feb 24, 2007.

Scroll to continue with content
  1. John E.

    John E. Guest

    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.

  2. Program EPROM.
    swicthes on address inputs.
    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).
  3. John E.

    John E. Guest

    Thus spake Jan Panteltje:
    Sounds very flexible, but again, I'm programming limited, so I think this
    won't work for me.
    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

    (ref: <>)

    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).

  4. Bob n.

    Bob n. Guest

    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.

    Your output table is:
    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?
  5. OK, but I'l do only part of the design:
    CD4051 diode LAMP
    +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.

    bulb A
    A' --| | Power MOSFET
  6. John E.

    John E. Guest

    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.)

    Thanks for making this reasonalby understandable by a good tech, but poor
  7. 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

    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.

    You are welcome.
  8. Joerg

    Joerg Guest

    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.

    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
  9. jasen

    jasen Guest

    W = C or B

    X = B and C

    Y = ( not B ) or (A and C)

    Z = A and B
    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

    google for

    4071 datasheet
    4069 datasheet
    4081 datasheet

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

  10. John E.

    John E. Guest

    Thus spake Jan Panteltje:
    Sort of using 4015 output pin 7 as a pull-down resistor for the MOSFET's

    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? :


    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?

  11. John E.

    John E. Guest

    Thus spake Joerg:
    I've looked at the data sheet. Fewer pins to deal with (no inhibit, no
    input/output control) -- looks more straightforward...
  12. John E.

    John E. Guest

    it's going to take three chips
    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...

  13. John E.

    John E. Guest

    Jan Panteltje diagrams:
    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.

  14. John E.

    John E. Guest

    Thus spake Bob n.:
    The existing 3 input switches are simple on-off SPST.
  15. 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)
  16. 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 |
    |_______| |_______| |_______|
    | | |
  17. On a sunny day (Sat, 24 Feb 2007 20:33:47 GMT) it happened Jan Panteltje

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

    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
    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...
  18. John E.

    John E. Guest

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

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

    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.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day