Connect with us

Controlling a linear array of LEDs and switches?

Discussion in 'Electronic Basics' started by Stuart Dawson, May 2, 2004.

Scroll to continue with content
  1. Newbie question: I want to control a linear array of about 100 LEDs with
    a PC. I want the PC to light up a particular LED (working from data in
    Excel) and then be switched off again, either from the PC or by an
    operator hitting a touch-switch or button next to the LED.

    The LEDs / switches will be mounted on the edge of a bench to facilitate
    ordered assembly of coloured tiles.

    I was thinking some sort of "Christmas-light" controller might do the
    job - or do I need a programmable logic controller? I'm reasonably
    fluent in software - mostly VBA - and a quick study, but right now I'm
    just starting in on control-related stuff, and very much a newbie. Any
    suggestions, links, resources welcome.

    Thanks
     
  2. Jamie

    Jamie Guest

    your going to need a 10x10 matrix output.
    since most dense logic chips don't allow for any
    great amouts of current, you will also need some
    inverter/non inverting buffer driver chips.
    so lets see.
    you will need at least 2 1 or 10 logic mux chips
    or something that is common like a 1 to 4, 1 to 8 or
    1 to 16 chip.. the 1 to 16 has 4 addressable lines and
    gate input.
    etc..
    the idea is to use chip as the low side of the signal to
    select the row of LED's and the other chip to produce the
    high side of the signal which will be 1 of the COLUMN selects.
    etc..
    if you i think something line 2 74154 type chips
    http://www.xs4all.nl/~ganswijk/chipdir/giicm/74154.txt
    then there is the problem of making it work from the PC.
    you can use the Parallel output, this will give you up to
    256 different combinations etc..
     
  3. CFoley1064

    CFoley1064 Guest

    Subject: Controlling a linear array of LEDs and switches?
    Hi, Stuart. Some hard-bought advice for making factory fixturing for
    PC-assisted manufacture or test:

    For any factory setup, the KISS principle (Keep It Safe & Simple) should be
    foremost in your mind. You have to look forward to a day when you're not
    there, and someone else (obviously without your experience in the craft) will
    have to fix your stuff or modify it. That's true whether it's your factory or
    someone else's. In fact, that someone might well be you a couple of years
    later (possibly as a consultant). In that event, it won't look very good if
    you don't have a good handle on how things work. Any extra money spent in
    hardware which will make it more simple and straightforward, and will make it
    easier to debug and troubleshoot, will be more than worth it tomorrow. Using
    Excel and VBA is going to make the software pretty much inscrutable for a
    maintenance person to begin with. If you add another level of complexity by
    adding a custom hardware multiplexing interface to your 100 LEDs and switches,
    you're going to have something only you can fix or understand, and that's on a
    good day. Unless you own the company, and maybe even if you do, you're not
    doing the boss any favors here.

    If you can live with 96 inputs and 96 outputs, you might want to look at the
    Measurement Computing CIO-DI96 for $179.00 USD and the CIO-DO96H for $239.00
    USD. These will allow you to have all your wiring coming from and going to
    four 50-pin ribbon cables, with your only additional non-perfboard investment
    being the switches, LEDs and current-limiting resistors. The PC power supply
    can drive the LEDs directly, and you can read the switches directly. Straight
    shot on everything. You might want to get the Universal Drivers CD, and also
    four of the IDC ribbon cable-to-screw terminal adapters. Heck, they even sell
    the cables, if you want. The VB drivers will work with VBA.

    If it is your company, or the $500 USD is too steep, take a look at "Parallel
    Port Complete" by Jan Axelson of Lakeview Research ( www.lvr.com ). All the
    information and advice you'd need are in there, including VB drivers that will
    work with the parallel port. You'll probably want to use a chain of 13 HC595s
    (for 100 outputs) and two HC595s with one HC589 to multiplex the input switches
    (16 X 8). You might want to multiplex the LED outputs by using one '595 to
    source current and two to sink (8 X 16). But with Windows, you aren't going to
    be able to multiplex fast enough to keep the LED outputs looking good. There
    are other options for getting a lot of I/O from the parallel port, including
    ICs from Maxim (originally from Intersil). All of this is doable with the
    parallel port, but you have to ask yourself if this is really going to help
    your company, or if it's just going to create a job security issue.

    Either way, make sure to write and document a debugging program, which at
    minimum will light up the LEDs in sequences, and also read and display the
    switch readings. This will make it so that, if a switch or LED goes bad,
    someone has a chance of fixing it today.

    Oh, yes -- use the brightest, widest angle LEDs you can afford. The operator
    who's assembling things will move her head, right? With fairly good ambient
    lighting so she can see what she's doing? Use series resistors from the
    switches to provide some protection to the input ICs, and encourage an
    ESD-protected work environment. Static kills computers and I/O. (Again,
    hard-bought knowledge).

    Good luck
    Chris
     
  4. John Fields

    John Fields Guest

    ---
    If you used 2mA LEDs you could use twelve 8-bit serial in-parallel
    parallel-out shift registers (HC164) to drive them, like this:



    GND>-------------------------------+
    |
    +------+ |
    DATA>----+-|SDA Q0|---[R]--[LED>]--+
    | | | |
    +-|SDB Q1|---[R]--[LED>]--+
    | | |
    CLK>--+----|> Q2|---[R]--[LED>]--+
    | | | |
    | | Q3|---[R]--[LED>]--+
    | | | |
    | | Q4|---[R]--[LED>]--+
    | | |
    | | Q5|---[R]--[LED>]--+
    | | | |
    | | Q6|---[R]--[LED>]--+
    | | | |
    | | Q7|-+-[R]--[LED>]--+
    | +------+ | |
    | | |
    | +----------+ |
    | | |
    | | +------+ |
    | +-|SDA Q0|---[R]--[LED>]--+
    | | | | |
    | +-|SDB Q1|---[R]--[LED>]--+
    | | | |
    +----|> Q2|---[R]--[LED>]--+
    | | | |
    | | Q3|---[R]--[LED>]--+
    | | | |
    | | Q4|---[R]--[LED>]--+
    | | | |
    | | Q5|---[R]--[LED>]--+
    | | | |
    | | Q6|---[R]--[LED>]--+
    | | | |
    | | Q7|-+-[R]--[LED>]--+
    | +------+ | |
    | | |
    . . .
    . . .
    . . .
    \_______________ _____________/
    \/
    TO FOLLOWING STAGES


    and twelve 8-bit parallel-in serial-out shift registers (HC165) to
    read the status of the [normally-open momentary] switches, like this:

    +---------+
    CLK>-----+-----------------|> |
    _ | | _ |
    S/L>-----|--+--------------|S/L |
    | | | |
    GND>-----|--|--+-----------|SDIN |
    | | | | |
    VCC>--+--|--|--|--[R]---+--|D0 |
    | | | | ____ | | |
    | | | +--O O--+ | |
    | | | | | |
    +--|--|--|--[R]---+--|D1 |
    | | | | ____ | | |
    | | | +--O O--+ | |
    | | | | | |
    +--|--|--|--[R]---+--|D2 |
    | | | | ____ | | |
    | | | +--O O--+ | |
    | | | | | |
    +--|--|--|--[R]---+--|D3 |
    | | | | ____ | | |
    | | | +--O O--+ | |
    | | | | | |
    +--|--|--|--[R]---+--|D4 |
    | | | | ____ | | |
    | | | +--O O--+ | |
    | | | | | |
    +--|--|--|--[R]---+--|D5 |
    | | | | ____ | | |
    | | | +--O O--+ | |
    | | | | | |
    +--|--|--|--[R]---+--|D6 |
    | | | | ____ | | |
    | | | +--O O--+ | |
    | | | | | |
    +--|--|--|--[R]---+--|D7 |
    | | | | ____ | | |
    | | | +--O O--+ | SDOUT|--+
    | | | | +---------+ |
    | | | | |
    | | | | +---------------+
    | | | | |
    | | | | | +---------+
    | +--|--|--------|--|> |
    | | | | | | _ |
    | | +--|--------|--|S/L |
    | | | | | | |
    | | | | +--|SDIN |
    | | | | | |
    +--|--|--|--[R]---+--|D0 |
    | | | | ____ | | |
    | | | +--O O--+ | |
    | | | | | |
    +--|--|--|--[R]---+--|D1 |
    | | | | ____ | | |
    | | | +--O O--+ | |
    | | | | | |
    +--|--|--|--[R]---+--|D2 |
    | | | | ____ | | |
    | | | +--O O--+ | |
    | | | | | |
    +--|--|--|--[R]---+--|D3 |
    | | | | ____ | | |
    | | | +--O O--+ | |
    | | | | | |
    +--|--|--|--[R]---+--|D4 |
    | | | | ____ | | |
    | | | +--O O--+ | |
    | | | | | |
    +--|--|--|--[R]---+--|D5 |
    | | | | ____ | | |
    | | | +--O O--+ | |
    | | | | | |
    +--|--|--|--[R]---+--|D6 |
    | | | | ____ | | |
    | | | +--O O--+ | |
    | | | | | |
    +--|--|--|--[R]---+--|D7 |
    | | | | ____ | | |
    | | | +--O O--+ | SOUT|--+
    | | | | +---------+ |
    | | | | |
    | | | | +---------------+
    | | | | |
    . . . . .
    . . . . .
    . . . . .
    | | | | |
    | | | | | +---------+
    | +--|--|--------|--|> |
    | | | | | _ |
    | +--|--------|--|S/L |
    | | | | |
    | | +--|SDIN |
    | | | |
    +--------|--[R]---+--|D0 |
    | | ____ | | |
    | +--O O--+ | |
    | | | |
    +--------|--[R]---+--|D1 |
    | | ____ | | |
    | +--O O--+ | |
    | | | |
    +--------|--[R]---+--|D2 |
    | | ____ | | |
    | +--O O--+ | |
    | | | |
    +--------|--[R]---+--|D3 |
    | | ____ | | |
    | +--O O--+ | |
    | | | |
    +--------|--[R]---+--|D4 |
    | | ____ | | |
    | +--O O--+ | |
    | | | |
    +--------|--[R]---+--|D5 |
    | | ____ | | |
    | +--O O--+ | |
    | | | |
    +--------|--[R]---+--|D6 |
    | | ____ | | |
    | +--O O--+ | |
    | | | |
    +--------|--[R]---+--|D7 |
    | ____ | | |
    +--O O--+ | SOUT|---->DOUT
    +---------+


    Use the parallel port to write one bit at a time into the SIPO array
    like this:
    ___ _____ _____ _____ ____ _ _____
    DIN ___|_____|_____|_____|____ _|_____
    __ __ __ __ __
    CLK_____|01|__|02|__|03|__|04| __|96|__




    and to read the switch array, like this:

    _ __ _______________________ ______ ___________________
    S/L |_| |_|
    __ __ __ __ __ __ __ __
    CLK ______|01|__|02|__|03|__|04|_ _|96|_______|01|__|02|__|03|_
    ________\_____\_____\_____\______\__________\_____\_____\____
    DOUT________|_01__|_02__|_____|______|____96____|_01__|_____|____


    Write the pattern to the LED array once, then continually scan the
    switch array for zeroes, and if one appears, turn off the
    corresponding LED by writing a new word with that bit cleared to the
    LED array.
     
  5. Soeren

    Soeren Guest

    Hi Stuart,

    A fairly cheap way would be to use 13 pcs. of serially connected 8-bit
    serial-in-parallel-out shift registers for the LEDs and the same (only
    parallel-in-serial-out registers) for the switches - but do heed the
    warnings from Chris :)
     
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

-