Fiverr gig
$15 — I will help you with your project and simulate it for you
Hire me
📡 ESP32 Projects

How to Interface Arduino and Multiplexer

EmbedLab TeamApril 17, 20259 min read
How to Interface Arduino and Multiplexer

Published on January 11, 2025 | By ArduinoUnoProjex

Dive into the exciting world of embedded systems with these Arduino multiplexer LED projects! Using a 3-to-8 multiplexer and pulse-width modulation (PWM), you can control multiple LEDs with minimal pins, creating stunning lighting effects. Perfect for beginners and hobbyists, these projects teach multiplexing, PWM, and dynamic LED control. We’ll cover three projects—Brightness Decrease, Ping Pong, and Random LED Burst—complete with wiring, code, and recommended products. Let’s light up your Arduino journey!

Note: Amazon product links are included for convenience (not ours, just recommendations). ELEGOO boards are not Arduino but are compatible with Arduino IDE and more affordable.

Why Use a Multiplexer for LED Control?

What is a multiplexer? A 3-to-8 multiplexer (e.g., 74HC138) allows you to control up to eight outputs using just three Arduino pins, reducing pin usage for projects with multiple LEDs. Combined with PWM, it enables smooth brightness control and dynamic effects.

Benefits: Saves pins, simplifies wiring, and supports complex animations with minimal code.

Components Needed

To build these projects, gather these components:

  • Arduino Uno or ELEGOO Uno R3 (Arduino IDE-compatible)
  • 3-to-8 Multiplexer (e.g., 74HC138)
  • 8 LEDs (any color)
  • 8 Resistors (220Ω–330Ω)
  • Breadboard & Jumper Wires
  • USB Cable for Arduino

Optional: USB-to-Serial module (e.g., CH340) for troubleshooting.

Wiring the Multiplexer Circuit

How do I connect a multiplexer to Arduino for LED control? Follow this schematic and instructions to wire your 3-to-8 multiplexer and LEDs.

Arduino multiplexer LED circuit schematic
Figure 1: Schematic for 3-to-8 multiplexer with LEDs

Connection Table

Multiplexer Pin Arduino Pin Component
A, B, C (Select Pins) 2, 3, 4 -
Y0–Y7 (Output Pins) - LED Anodes (via 220Ω resistors)
GND GND LED Cathodes
VCC 5V -

Wiring Instructions

1

Connect Multiplexer: Wire select pins (A, B, C) to Arduino pins 2, 3, 4. Connect VCC to 5V and GND to Arduino GND.

2

Connect LEDs: Attach each multiplexer output (Y0–Y7) to an LED anode via a 220Ω–330Ω resistor. Connect all LED cathodes to Arduino GND.

3

Power Arduino: Use a USB cable to connect the Arduino to your computer.

Wiring diagram for Arduino multiplexer LED project
Figure 2: Wiring setup for multiplexer and LEDs

💡Tip: Verify resistor values to protect LEDs and ensure the multiplexer’s logic levels match Arduino’s 5V.

Project 1: Brightness Decrease Effect

How do I create a smooth LED dimming effect? This project dims eight LEDs sequentially using PWM and a multiplexer, creating a soothing fade-out effect.

Code


int selectPins[] = {2, 3, 4}; // A, B, C pins
void selectChannel(int channel) {
  for (int i = 0; i < 3; i++) {
    digitalWrite(selectPins[i], (channel >> i) & 1);
  }
}
void setup() {
  for (int i = 0; i < 3; i++) {
    pinMode(selectPins[i], OUTPUT);
  }
}
void loop() {
  for (int channel = 0; channel < 8; channel++) {
    selectChannel(channel);
    for (int brightness = 255; brightness >= 0; brightness -= 5) {
      analogWrite(5, brightness); // PWM pin
      delay(50);
    }
  }
}
        

How It Works

  • Multiplexer Control: The selectChannel function sets the A, B, C pins to choose an LED (0–7).
  • PWM Dimming: analogWrite on pin 5 adjusts brightness from 255 (full) to 0 (off).
  • Loop: Each LED dims sequentially, creating a wave-like effect.

Keywords: Arduino LED brightness control, PWM with Arduino, LED multiplexing project, smooth LED dimming.

Project 2: Ping Pong LED Effect

How do I create a bouncing LED pattern? This project lights LEDs in a forward-then-reverse sequence, mimicking a ping pong ball.

Code


int selectPins[] = {2, 3, 4};
void selectChannel(int channel) {
  for (int i = 0; i < 3; i++) {
    digitalWrite(selectPins[i], (channel >> i) & 1);
  }
}
void setup() {
  for (int i = 0; i < 3; i++) {
    pinMode(selectPins[i], OUTPUT);
  }
  pinMode(5, OUTPUT);
}
void loop() {
  for (int channel = 0; channel < 8; channel++) {
    selectChannel(channel);
    analogWrite(5, 255);
    delay(100);
    analogWrite(5, 0);
  }
  for (int channel = 7; channel >= 0; channel--) {
    selectChannel(channel);
    analogWrite(5, 255);
    delay(100);
    analogWrite(5, 0);
  }
}
        

How It Works

  • Sequential Lighting: LEDs light up from 0 to 7, then reverse from 7 to 0.
  • PWM Control: Pin 5 provides consistent brightness via analogWrite.
  • Dynamic Effect: The delay creates a smooth bouncing pattern.

Keywords: Arduino ping pong LED effect, sequential LED control, Arduino multiplexer project, LED animation with Arduino.

Project 3: Random LED Burst Effect

How do I create a random LED pattern? This project lights LEDs in a random sequence, creating a lively burst effect.

Code


int selectPins[] = {2, 3, 4};
void selectChannel(int channel) {
  for (int i = 0; i < 3; i++) {
    digitalWrite(selectPins[i], (channel >> i) & 1);
  }
}
void setup() {
  for (int i = 0; i < 3; i++) {
    pinMode(selectPins[i], OUTPUT);
  }
  pinMode(5, OUTPUT);
  randomSeed(analogRead(0));
}
void loop() {
  int channel = random(8);
  selectChannel(channel);
  analogWrite(5, 255);
  delay(100);
  analogWrite(5, 0);
  delay(50);
}
        

How It Works

  • Random Selection: random(8) picks a random channel (0–7).
  • Burst Effect: LEDs light up briefly with full brightness, then turn off.
  • Seed Randomness: randomSeed ensures varied patterns.

Keywords: Arduino random LED effect, LED burst effect Arduino, random number generation Arduino, dynamic lighting effects.

Recommended Products

Start your projects with these high-quality components from Amazon (affiliate links). ELEGOO boards are Arduino IDE-compatible and budget-friendly.

Troubleshooting Tips

  • ⚠️LEDs Not Lighting: Check wiring, resistor values, and multiplexer pin connections.
  • ⚠️Random Effect Not Random: Ensure randomSeed is set with an analog pin.
  • ⚠️PWM Issues: Verify the PWM pin (e.g., 5) is used correctly.
  • ⚠️Multiplexer Not Switching: Confirm select pins are correctly mapped to Arduino pins.

Advanced Project Ideas

  • 🚀Combine effects (e.g., random bursts with dimming) for complex animations.
  • 🚀Add a potentiometer to adjust effect speed or brightness.
  • 🚀Use RGB LEDs for color-changing effects.
  • 🚀Integrate with a music sensor to sync LEDs with sound.

Frequently Asked Questions

How does a multiplexer control LEDs with Arduino?

A 3-to-8 multiplexer uses three select pins to control up to eight LEDs, reducing the number of Arduino pins needed. The select pins choose which LED is active, and PWM adjusts brightness.

Why are my LEDs not lighting up in the multiplexer project?

Check wiring, ensure resistors are correct (220Ω–330Ω), and verify multiplexer select pins are connected to Arduino pins 2, 3, 4.

Can I use ELEGOO boards for these projects?

Yes, ELEGOO boards like Uno R3 are compatible with Arduino IDE and work perfectly for these multiplexer projects.

Conclusion

These Arduino multiplexer LED projects are a fantastic way to explore embedded systems, multiplexing, and PWM. From smooth dimming to random bursts, you’ve learned how to create captivating lighting effects with minimal pins. Use our recommended products to get started, and check out our Arduino tutorials for more inspiration. Share your creations in the comments and light up the maker community! 🚀

ET

EmbedLab Team

Embedded systems engineer and educator. Writes weekly tutorials at EmbedLab to help beginners ship real hardware.

Related projects

How to Control LEDs with Blynk and Arduino Uno: Ultimate IoT Guide
📡 ESP32 Projects

How to Control LEDs with Blynk and Arduino Uno: Ultimate IoT Guide

body { font-family: 'Arial', sans-serif; line-height: 1.6; max-width: 900px; margin: 0 auto; padding: 20px; background-color: #f9f9f9; color: #333; } h1, h2, h3 { color: #2c3e50; } h1 { font-size: 2.5

Apr 17 9 min
How to Fix Fatal Simulation Errors in Proteus 8 - Easy 2025 Guide
📡 ESP32 Projects

How to Fix Fatal Simulation Errors in Proteus 8 - Easy 2025 Guide

Solve Proteus 8 Simulation Issues with IR Sensors and More Are you encountering a fatal simulation error in Proteus 8 while working on your embedded electronics projects? This common issue often occur

May 3 4 min
ESP32 WROOM DevKit LED blink simulation in Proteus 8 with Arduino IDE
📡 ESP32 Projects

ESP32 LED Blink in Proteus 8 Simulation — Arduino IDE ESP32 WROOM DevKit Tutorial

Step-by-step ESP32 LED blink simulation in Proteus 8 using Arduino IDE ESP32, ESP32 WROOM-32 DevKit, the ESP32 pinout (GPIO2) and Wokwi/Proteus simulation — full Espressif ESP32 dev board code included.

Dec 16 5 min
Add ESP32 WROOM DevKit to Proteus 8 simulation with Arduino IDE
📡 ESP32 Projects

ESP32 Proteus 8 Simulation — Free ESP32 Library, Arduino IDE & WROOM DevKit Guide

Add the ESP32 to Proteus 8 easily and for free: ESP32 library install, Arduino IDE ESP32 setup, ESP32 WROOM / ESP32 DevKit pinout, Wi-Fi & Bluetooth simulation and Wokwi alternatives for ESP32-S3, ESP32-C3 and ESP32-CAM.

Nov 10 8 min
Wokwi, Proteus and Tinkercad ESP32 simulator comparison for Arduino ESP32
📡 ESP32 Projects

Top 3 Free Online ESP32 Simulators 2025 — Wokwi, Proteus & Tinkercad for Arduino ESP32

Compare the best free online ESP32 simulators in 2025: Wokwi simulation, Proteus simulation and Tinkercad for Arduino ESP32, ESP32 WROOM, ESP32-S3, ESP32-C3 and ESP32 DevKit Wi-Fi and Bluetooth projects — no hardware needed.

Oct 27 8 min
Browse all 50+ projects