Electronics

MUX 8 Channel Analog Multiplexer 74HC4051 Purple

AED 14.70

1

Description

The MUX 8 Channel Analog Multiplexer 74HC4051 Purple module has an integrated circuit as a single-pole octal-throw analog switch. Functioning as an 8:1 multiplexer or demultiplexer in analog and digital applications, the module features eight switch channels, each connecting one of eight inputs to a common output. Control is achieved through three digital input pins, selecting the desired input channel. An additional enable pin, when low, disables all channels, setting the output to a high-impedance state. With a voltage range of 2V to 10V, low on-resistance (125 ohms), and compatibility with both analog and digital signals, the 74HC4051 is suitable for applications requiring low distortion and high accuracy

Principle of Work:

  • Multiplexing: It is choosing from one of the various lines (one at a time) and forwards its contents down a single line. In this case, by setting the A/B/C lines to have 2 (in binary), that is 010, then line 02 (pin 15) is chosen to be the "active" line, and whatever voltage is on it is forwarded to the "common" in/outline (pin 3).

Screen Shot 2023-02-24 at 7 29 32 AM

Demultiplexing: It is doing the reverse operation. A single input line is forwarded to one of many output lines. In this case, by setting the A/B/C lines to have 7 (in binary), that is 111, then line 07 (pin 4) is chosen to be the "active" line, and whatever voltage is on the "common" in/outline (pin 3) is forwarded to it.

Screen Shot 2023-02-24 at 7 30 38 AM

  • How does it know which direction to go?
    • The device is bi-directional. If you have a signal on one end of the pair (the selected line, and the common line) then that signal is echoed on the other end.
    • Effectively the selected channel has around an 80-ohm resistance (between the selected pin and the common pin) achieved by side-by-side MOSFETs (one P-channel and one N-channel). The unselected channels have a very high resistance between them and the common pin.
    • So you could use it, for example, to connect up 8 analog inputs, and connect them up to a single analog port on your microprocessor (eg. your Arduino). The Arduino does not generate analog outputs (the so-called analogWrite function actually does digital pulse-width modulation or PWM) so the device isn't quite as useful as an output device.
    • However, you could conceivably connect up LEDs to some of the pins and flash them from time to time, interleaving with taking analog readings.

Features:

  • Three digital select inputs (S0, S1, and S2): This feature allows the user to choose which of the eight independent inputs/outputs (Yn) is connected to the common input/output (Z). The three digital select inputs provide a total of eight different combinations, allowing for flexibility in selecting the desired input/output channel.
  • Eight independent inputs/outputs (Yn): The product has eight independent inputs/outputs that can be selected using the digital select inputs. This feature makes the product suitable for use in applications that require the switching of multiple analog or digital signals.
  • Common input/output (Z): The common input/output is the point to which the selected input/output channel is connected. This feature allows the user to interface with a common bus or system.
  • Digital enable input (E): The digital enable input allows the user to turn the switches off when not in use. When the enable input is set to high, the switches are off, which reduces power consumption and prevents signal interference.
  • Terminal diodes: The product includes terminal diodes, which allow the use of current-limiting resistors to interface inputs and protect the circuit from excess voltages.
  • Wide voltage range: The product is designed to handle a wide voltage range of up to VCC. This feature makes the product suitable for use in a variety of applications.
  • Low power consumption: The product has a low power consumption, which makes it suitable for use in portable and battery-operated devices.

Specification:

  • Model: 74HCT4051
  • Color: purple
  • Dimension: 29.5 x 18.5 x 3 Mm

Applications:

  • Analog signal multiplexing: The device can be used to select and route one of several analog input signals to a single analog output. This is useful in applications such as audio mixing, signal routing, and switching.
  • Digital signal multiplexing: The device can also be used to switch between multiple digital signals in a digital system, such as selecting one of several data inputs for processing or transmission.
  • Data acquisition systems: The multiplexer can be used to expand the number of analog input channels available in a data acquisition system, allowing for the simultaneous measurement of multiple analog signals.
  • Instrumentation and measurement systems: The device can be used in instrumentation and measurement systems to select and route analog or digital signals to appropriate measurement or processing circuits.
  • Industrial control systems: The multiplexer can be used in industrial control systems to switch between various sensors, actuators, and control signals, allowing for more efficient and flexible control of industrial processes.

Pin Connections:

Pin Description
(Y0-Y7) Independent input/output pins
(GND) Ground supply voltage (0V)
(S0-S2) Select control inputs
(Z) Common input/output pin
(VCC) Positive supply voltage (2-10V)
(VEE) Negative supply voltage (jumpered to ground by default)
(E) Active low enable input

Screen Shot 2023-02-24 at 7 37 07 AM

Package Includes:

  • 1 x MUX 8 Channel Analog Multiplexer 74HC4051 Purple

Sample Project:

Circuit:

  • To get the most out of this example, you'll need to connect some sort of output device to each of the independent I/O pins (Y0-Y7). For example, grab a pack of LEDs and some 330Ω resistors for a quick hardware-verifying circuit.
  • In this example, S0, S1, and S2 are connected to Arduino pins 2, 3 and 4 respectively. "Z" is connected to pin 5, which the example uses to produce PWM "analog output" signals.
  • VCC is connected to the Arduino 5V pin, and GND goes to GND. The breakout board's JP1 is left intact, shorting VEE to GND.
  • Finally, the Y0-Y7 pins are all connected to LED/resistor pairs, with the positive anode end of the LED connected to the Y-pin and the resistor connecting the LED's cathode to ground. This way, when the output is selected and "Z" goes high, the LED on that output will turn on.

Screen Shot 2023-02-24 at 7 35 08 AM

Library:

  • No external library is required for this module to work.

Code:

/******************************************************************************
Mux_Analog_Input
SparkFun Multiplexer Analog Input Example

This sketch demonstrates how to use the SparkFun Multiplexer
Breakout - 8 Channel (74HC4051) to read eight, separate
analog inputs, using just a single ADC channel.

Hardware Hookup:
Mux Breakout ----------- Arduino
     S0 ------------------- 2
     S1 ------------------- 3
     S2 ------------------- 4
     Z -------------------- A0
    VCC ------------------- 5V
    GND ------------------- GND
    (VEE should be connected to GND)

The multiplexers independent I/O (Y0-Y7) can each be wired
up to a potentiometer or any other analog signal-producing
component.
******************************************************************************/
/////////////////////
// Pin Definitions //
/////////////////////
const int selectPins[3] = {2, 3, 4}; // S0~2, S1~3, S2~4
const int zOutput = 5; 
const int zInput = A0; // Connect common (Z) to A0 (analog input)

void setup() 
{
    Serial.begin(9600); // Initialize the serial port
    // Set up the select pins as outputs:
    for (int i=0; i<3; i++)
    {
        pinMode(selectPins[i], OUTPUT);
        digitalWrite(selectPins[i], HIGH);
    }
    pinMode(zInput, INPUT); // Set up Z as an input

    // Print the header:
    Serial.println("Y0\tY1\tY2\tY3\tY4\tY5\tY6\tY7");
    Serial.println("---\t---\t---\t---\t---\t---\t---\t---");
}

void loop() 
{
    // Loop through all eight pins.
    for (byte pin=0; pin<=7; pin++)
    {
        selectMuxPin(pin); // Select one at a time
        int inputValue = analogRead(zInput); // and read Z
        Serial.print(String(inputValue) + "\t");
    }
    Serial.println();
    delay(1000);
}

// The selectMuxPin function sets the S0, S1, and S2 pins
// accordingly, given a pin from 0-7.
void selectMuxPin(byte pin)
{
    for (int i=0; i<3; i++)
    {
        if (pin & (1<else
        digitalWrite(selectPins[i], LOW);
    }
}

Notes:

  • A is the low-order bit. So therefore if you set A and B high, and C low, you would activate channel 3, not channel 6.

References: