Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 10 of 10

Thread: Multiplexer to retain the value sent to channels

  1. #1
    Junior Member
    Join Date
    Aug 2017
    Posts
    19

    Multiplexer to retain the value sent to channels

    Hi, community!

    I've recently tried to use 74HC4051 multiplexer in order to control my 6 LEDs (let's call the like this) with just 4 outputs from Teensy 3.6. So I am sending signals from Teensy to Mux.
    The test went successfully, but there's one thing I wasn't aware of. The Mux doesn't retain the values sent. E.g:

    Each of my LEDs is ON when the HIGH signal is sent, and is OFF when LOW signal is sent.
    If I send the HIGH value to my first LED - it is ON, but as soon as I change the channel on Mux to address my second LED, the first LED goes OFF.

    I need to be able to retain values sent to LEDs until the LOW signal is sent to them. Is there a way to achieve this with the Mux? Or do I need to add anything to my chain?

  2. #2
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Location
    Florida
    Posts
    420
    Most people wouldn’t recommend a multiplexer for controlling LEDs, while it is possible and I’ve done it, it’s not the best device to do it. That being said, while the 4051 is not latchable if you update the LEDs fast enough it will look like they are all on even though in reality that’s not the case. Your best option for a small number of LEDs would be to use a shift register without adding much overhead to your existing program, but if you need a large number of LEDs shift registers aren’t the best option.

  3. #3
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    Hi, vjmuzik! Thank you for the reply!

    Quote Originally Posted by vjmuzik View Post
    Most people wouldn’t recommend a multiplexer for controlling LEDs, while it is possible and I’ve done it, it’s not the best device to do it. That being said, while the 4051 is not latchable if you update the LEDs fast enough it will look like they are all on even though in reality that’s not the case. Your best option for a small number of LEDs would be to use a shift register without adding much overhead to your existing program, but if you need a large number of LEDs shift registers aren’t the best option.
    To be honest, I've tried to simplify the schema and probably confused you. In reality the mux is connected to Opto-Triacs, each of them in its turn is connected to a TRIAC, which controls EL Wire. To make it simpler, mux is controlling the Gate on TRIACs. When mux sends HIGH value, the TRIAC is opened and the current flows through the EL Wire

    What do you mean by "latchable"? What I really want to avoid is to have an endless loop in my program which goes over all the gates and sends their real value every millisecond over the 6 mux channels.
    The shift register you are referring, does it have a possibility to retain the sent value on its own? Or is it at all not technically possible?

  4. #4
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    578
    I'd use a standard 74HC575 for that. It only requires 3 wires for 8 outputs.
    Here some information. https://learn.adafruit.com/adafruit-...shift-register

  5. #5
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    Quote Originally Posted by luni View Post
    I'd use a standard 74HC575 for that. It only requires 3 wires for 8 outputs.
    Here some information. https://learn.adafruit.com/adafruit-...shift-register
    Thanks, luni! Looks like what I need.

    Thank you all very much, guys!

  6. #6
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,237
    If you are looking to stay with a mux here's a latching example. http://www.ti.com/product/CD74HC4351

  7. #7
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Location
    Florida
    Posts
    420
    Quote Originally Posted by oddson View Post
    If you are looking to stay with a mux here's a latching example. http://www.ti.com/product/CD74HC4351
    That doesn’t have an output latch like he would need, it’s only an address latch.

  8. #8
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,237
    I likely haven't thought it through... but I thought you connect a sink or source to the common side and switch the mux connections when needed.

    ...don't bother to explain if this is nonsense. I just don't like shift registers and thought it might be an option.

  9. #9
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Location
    Florida
    Posts
    420
    If you choose to build stuff with common buses it’s really easy to get a large I/O amount with a relatively small number of pins needed. Even though common buses have died off in favor of serial it’s still a good option for fast I/O that really adds low overhead to your program since they have high MHz versions of most 8 bit bus chips. For example, with 17 microcontroller pins you can connect 1024 buttons and 1024 LEDs that can all still be run in real-time very easily and with minimal programming. If anyone is interested in the example circuit that I speak of I can take a picture of the PCB and the schematic for it.

  10. #10
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    Hi, guys! I was able to accomplish my task with the shift register 74HC595. It perfectly latches the values. Everything as I need.
    Thank you very much!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •