Help multiplexing with 74HC4052

Hello World !!!
I'm new to this hobby.

Please , can somebody tell me how to wire and use this IC for multiplexing.

What the pins are for compared to the most used 595 , and how to read the schematic tech notes.

Any sketch and advice is appreciated.

I have abunch of these, and would like to use them to light up multiple led strips with ARDUINO ONE.

Can it be used ?

T.I.A.

Franky

74HC4052.pdf (277 KB)

The 4052 is useless for multiplexing an output, it is simply the wrong thing to use. This is because you can only have one led on at a time and you have to multiplex them to make it look like more. All that for no pin saving. Use a 595 instead, or a port expander or anything but not an analogue multiplexer.

Thank you GRUMPY.

I will .

One more question . What is a port expander ?

Franky

It is a chip that gives you extra input / output, configurable just like the pins on the arduino.
Typical would be a MCP23S17 or an MCP23017.

GRUMPY - isn't that the point of the 4052 multiplexer...to multiplex an output. It does both multiplexing(taking many inputs and sending them all out one line) and demultiplexing(taking a single input and sending it out multiple lines)
yes, the 4052 will only be able to power one LED at a time - but this is the principle behind multiplexing. you do it one at a time, but very very fast. If this person has 5 led strips, and the multiplexer switched between each one 5/9600 times...im guessing the eye would perceive this as all one at once...

I'm very confused as to what you're talking about...

It is an analog multiplexer, the amount of current it can handle is piddling, a couple of milliamps at the very most. Look at the datasheet, specifying performance at 1000 microamps. It is essentially intended for multiplexing inputs, not outputs. And it inconveniently is a two by four array. You could use it to feed other digital logic, but little else.

I do seem to recall using one (actually, a 4051) to drive LEDs - one at a time - many years ago, with indifferent results.

Grumpy_Mike:
An analogue multiplexer is simply the wrong thing to use for a single dimension.

Yeah, that too!

Zalterman
Oddly enough I do know all about multiplexing. It is usefull employed in two or more dimensions where the price you pay in software brings you a saving in pins.
With one dimensional multiplexing there is no such payback. What is needed if you want to use a chip in that mannor is to use what is known as an addressable latch. You write the data once and it stays on the output.

An analogue multiplexer is simply the wrong thing to use for a single dimension.

I want to make a video/audio switch, IR controlled for my TV. I have a 1 of 2 now using two relays. I want to make it 1 of 4 for video and 1 of 4 for audio. The 74HC4052 looks like it will do the job. Do you think it will pass a video signal OK? It would be great if it will do it. Thanks. :slight_smile:

OK, I have tried the transistor route, with poor results. :frowning: Then I used a 74HC4052 IC for my TV switcher. It works great! :slight_smile: I control it with the TV remote. I used that IC, a Pro-Mini, a IR receiver and 4 LEDs. I'll be making a few more, maybe with 2 or 3 chips for 8 channels and or stereo. :cold_sweat:

/*
TV 4ch 74HCT4052 IR Switcher 12 April 2014 JDS
Arduino Uno or Pro Mini
See: http://www.instructables.com/id/The-Easiest-Way-to-Use-Any-IR-Remote-with-Ardiuno/?ALLSTEPS

 The IR sensor pins are attached to Arduino like so:
 Pin 1 to Vout (pin D11 on Arduino)
 Pin 2 to Gnd (Ground on Arduino)
 Pin 3 to Vcc (+5v on Arduino)

The 74HCT4052 IC pins are used as follows:
Pin 1 = video 0 in
Pin 2 = video 2 in
Pin 3 = video out
Pin 4 = video 3 in
Pin 5 = video 1 in
Pin 6 = Enable = Ground
Pin 7 = VEE = Ground
Pin 8 = Ground
Pin 9 = Select bit 1 to Arduino pin 3
Pin 10= Select bit 0 to Arduino pin 2
Pin 11= audio 3 in
Pin 12= audio 0 in
Pin 13= audio out
Pin 14= audio 1 in
Pin 15= audio 2 in
Pin 16= +5 Volts

Optional are LEDs from the Select pins via 4k7 resistors to ground
Or Arduino pins 4-7 for decimal readout

The Manual Button is Arduino pin 8 to button to Ground
*/

#include <IRremote.h>
byte i;
byte j;
byte k;

byte va1pin = 2;
byte va2pin = 3;

byte sled1 = 4;
byte sled2 = 5;
byte sled3 = 6;
byte sled4 = 7;

byte Button = 8;
int IRpin = 11;  // pin for the IR sensor
int LED = 13;    // LED pin
IRrecv irrecv(IRpin);
decode_results results;
byte chan = 0;
byte Video = 0;
byte Sound = 0;
byte Pbutton = 0;
//-----------------------
void Select()
{
  digitalWrite(LED, HIGH);
  digitalWrite(va1pin,LOW);
  digitalWrite(va2pin,LOW);
  digitalWrite(sled1,LOW);
  digitalWrite(sled2,LOW);
  digitalWrite(sled3,LOW);
  digitalWrite(sled4,LOW);
  chan = chan + 1;
  if (chan >3)
  {chan = 0;}
  i = chan;
  digitalWrite(va1pin, i&1);
  i = i >> 1;
  digitalWrite(va2pin, i&1);
  if (chan == 0)
  {digitalWrite(sled1,HIGH);}
  if (chan == 1)
  {digitalWrite(sled2,HIGH);}
  if (chan == 2)
  {digitalWrite(sled3,HIGH);}
  if (chan == 3)
  {digitalWrite(sled4,HIGH);}
  Serial.println(chan);
}
//-----------------------
void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  pinMode(LED, OUTPUT);
  pinMode(Button, INPUT_PULLUP);
  pinMode(va1pin, OUTPUT);
  pinMode(va2pin, OUTPUT);
  pinMode(sled1, OUTPUT);
  pinMode(sled2, OUTPUT);
  pinMode(sled3, OUTPUT);
  pinMode(sled4, OUTPUT);
  digitalWrite(LED,LOW);
  digitalWrite(va1pin,LOW);
  digitalWrite(va2pin,LOW);
  digitalWrite(sled1,HIGH);
  digitalWrite(sled2,LOW);
  digitalWrite(sled3,LOW);
  digitalWrite(sled4,LOW);
  delay(1000);
}
//-----------------------
void loop()
{
  digitalWrite(LED, LOW);
  // button test here
  if (0 == digitalRead(Button))
  {delay(100);
    if (0 == digitalRead(Button))
    {Select();
      while (0 == digitalRead(Button))
      {delay (200);}
    }
  }
  digitalWrite(LED, LOW);
  //--------------------------------------
  if (irrecv.decode(&results))
  {
    digitalWrite(LED, HIGH);
    //Serial.print(results.decode_type);
    //Serial.print(": ");

    switch (results.value)
    {
      case 16720350:
        Serial.println("MULT");
        break;

      case 16763190:
        Serial.println("POWER");
        break;

      case 16716270:
        Serial.println("SEARCH");
        break;

      case 16714230:
        Serial.println("|<");
        break;

      case 16718310:
        Serial.println("||<");
        break;

      case 16724430:
        Serial.println("|>");
        break;

      case 16728510:
        Serial.println(">||");
        break;

      case 16726470:
        Serial.println(">>");
        break;

      case 16761150:
        Serial.println(">|");
        break;

      case 16771350:
        Serial.println("ADD");
        break;

      case 16746870:
        Serial.println("FN");
        break;

      case 16742790:
        Serial.println("MENU");
        break;

      case 16767270:
        Serial.println("Left");
        break;

      case 16750950:
        Serial.println("Right");
        break;

      case 16755030:
        Serial.println("Up");
        break;

      case 16734630:
        Serial.println("Down");
        break;

      case 16769310:
        Serial.println("1");
        break;

      case 16736670:
        Serial.println("2");
        break;

      case 16752990:
        Serial.println("3");
        break;

      case 16765230:
        Serial.println("4");
        break;

      case 16732590:
        Serial.println("5");
        break;

      case 16748910:
        Serial.println("6");
        break;

      case 16773390:
        Serial.println("7");
        break;

      case 16740750:
        Serial.println("8");
        break;

      case 16757070:
        Serial.println("9");
        break;

      case 16730550:
        Serial.println("0");
        break;

      case 16738710:
        Serial.println("ESC");
        break;

      case 16722390:
        Serial.print("-/--");
        Select();
        delay (200);
        break;

      default:
        digitalWrite(LED, LOW);
    }
    irrecv.resume();   // Receive the next value
  }
}

If you take the 1 vpp and 75ohms or even 50ohm in some cases you end up with a current of 13mA load on the 4052.

Not good, at least not if you use it for video.

On audio at line level you have 1 vpp and 10Kohm and that is a load of 100uA.
Much more suited and within the levels of an analog multiplexer.

If you insist on multiplexing outputs that are not analog, use a 74LS138 or 74LS154.

But the output is only active while selected.

switch current is 25 mA
Video and Audio IS analog!

steinie44:
Video and Audio IS analog!

I know that.
That reply was for a post further up.

I have also tried an analog mux for video and they have bad channel separation and won't last long used for video signal muxing.

There are however analog mux'es built for video use that can take the load.