Community project

Synchronized Light Sound Effects

Photo of Synchronized Light Sound Effects
Generated with AI

Sean Catalan

Published November 23, 2026

This project creates synchronized light and sound effects using an Arduino Uno to control three LEDs and a piezo buzzer in coordinated patterns. By pressing buttons to cycle through different effects, makers can trigger sequences that combine color changes with musical notes, creating engaging visual and audio feedback.

The guide provides a complete wiring diagram showing how to connect the LEDs with current-limiting resistors, wire the piezo buzzer for tone generation, and set up push buttons for effect selection. Assembly steps walk through circuit preparation and verification, while the included firmware handles debouncing, PWM brightness control, and effect sequencing to keep lights and sound perfectly in sync.

Wiring diagram

Loading diagram…

Gather all the parts

QtyComponent
1

LED

red

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

LED

green

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

LED

blue

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

Resistor

330 Ω

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

330 Ω

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

330 Ω

Through-hole resistor (current-limiting in series with an LED)

1

Piezo Buzzer

Small passive piezo buzzer (TDK PS1240) for beeps, tones and alerts. It has no built-in oscillator, so drive one lead with a 3-30 V square wave from a microcontroller pin using tone() or PWM and connect the other lead to ground. It is loudest around 4 kHz and works from about 2 to 10 kHz; driving both leads in antiphase roughly doubles the volume.

1

Push Button

Momentary push button switch

1

Push Button

Momentary push button switch

Assemble it in 5 steps

1. Prepare the circuit

Unplug the Uno USB cable. Place the three LEDs, three 330 ohm resistors, passive piezo buzzer and two momentary buttons on a breadboard. Connect an Uno GND pin to the breadboard ground rail.

2. Connect the three lights

Connect D5 through r1 to the red LED long leg, D6 through r2 to the green LED long leg, and D9 through r3 to the blue LED long leg. Connect each short leg (flat-side leg) to ground. The resistors limit current and protect the LEDs and Uno.

  • Never connect an LED directly to an Uno output without its series resistor.

3. Connect the sound

Connect one passive piezo buzzer lead to D11 and its other lead to ground. Use a small passive piezo, not an active buzzer or a low-resistance speaker. The changing signal makes it play different notes.

4. Connect the effect buttons

Connect the previous button between D2 and ground and the next button between D4 and ground. Each press must join two normally separate contacts. Internal pull-up resistors in the Uno keep the released inputs steady; no external button resistor is needed.

  • On a four-leg tactile switch each pair of permanently joined legs is one contact. Use contacts that become joined only when pressed; straddle the breadboard centre gap.

5. Check the wiring

Check all LED polarities and resistor connections before connecting USB power. The circuit starts with breathing lights. The next button cycles through breathing with beeps, flashing with alarm tones, and chasing with a melody; the previous button cycles backwards.

Review all connections

1. Connections between "r1" and "Arduino"

Functionr1Arduino
digitalP1GPIO 5
digitalP2 → LED ANODEEXT

2. Connections between "red" and "Arduino"

FunctionredArduino
groundGNDGND

3. Connections between "r2" and "Arduino"

Functionr2Arduino
digitalP1GPIO 6
digitalP2 → LED ANODEEXT

4. Connections between "green" and "Arduino"

FunctiongreenArduino
groundGNDGND

5. Connections between "r3" and "Arduino"

Functionr3Arduino
digitalP1GPIO 9
digitalP2 → LED ANODEEXT

6. Connections between "blue" and "Arduino"

FunctionblueArduino
groundGNDGND

7. Connections between "sound" and "Arduino"

FunctionsoundArduino
pwmSIGGPIO 11
groundGNDGND

8. Connections between "previous" and "Arduino"

FunctionpreviousArduino
digitalSIGNALGPIO 2
groundGNDGND

9. Connections between "next" and "Arduino"

FunctionnextArduino
digitalSIGNALGPIO 4
groundGNDGND

Deploy the firmware

#include <Arduino.h>

// PWM pins 5, 6 and 9 avoid the Uno tone() timer's PWM pins 3 and 11.
const uint8_t LED_PINS[] = {5, 6, 9};
const uint8_t BUZZER_PIN = 11;
const uint8_t PREVIOUS_PIN = 2, NEXT_PIN = 4;
const uint16_t NOTES[] = {2093, 2349, 2637, 2794, 3136, 2794, 2637, 2349};
uint8_t effect = 0;
uint32_t effectStart = 0;
int lastStep = -1;

// Ignore switch chatter and report one event per press.
struct Button {
  uint8_t pin;
  explicit Button(uint8_t inputPin) : pin(inputPin) {}
  bool lastRead = HIGH, stable = HIGH;
  uint32_t changedAt = 0;
  bool pressed(uint32_t now) {
    bool reading = digitalRead(pin);
    if (reading != lastRead) { lastRead = reading; changedAt = now; }
    if (now - changedAt >= 25 && reading != stable) {
      stable = reading;
      return stable == LOW;
    }
    return false;
  }
};
Button previous{PREVIOUS_PIN}, next{NEXT_PIN};

void lights(uint8_t r, uint8_t g, uint8_t b) {
  analogWrite(LED_PINS[0], r);
  analogWrite(LED_PINS[1], g);
  analogWrite(LED_PINS[2], b);
}
void changeEffect(uint8_t selected, uint32_t now) {
  effect = selected;
  effectStart = now;
  lastStep = -1;
  noTone(BUZZER_PIN);
  lights(0, 0, 0);
}
void setup() {
  for (uint8_t pin : LED_PINS) pinMode(pin, OUTPUT);
  pinMode(BUZZER_PIN, OUTPUT);
  // Internal pull-ups keep released buttons HIGH; pressing connects to ground.
  pinMode(PREVIOUS_PIN, INPUT_PULLUP);
  pinMode(NEXT_PIN, INPUT_PULLUP);
  effectStart = millis();
}
void loop() {
  uint32_t now = millis();
  bool back = previous.pressed(now), forward = next.pressed(now);
  if (forward) changeEffect((effect + 1) % 3, now);
  else if (back) changeEffect((effect + 2) % 3, now);
  uint32_t elapsed = now - effectStart;

  // No delay(): buttons, lights and sounds all keep running together.
  if (effect == 0) {
    // Two-second triangular breathing ramp, with a short beep at each peak.
    uint16_t phase = elapsed % 2000;
    uint8_t brightness = (phase <= 1000 ? phase : 2000 - phase) * 255UL / 1000;
    lights(brightness, brightness, brightness);
    int step = phase / 1000;
    if (step != lastStep) {
      lastStep = step;
      if (step == 1) tone(BUZZER_PIN, 3136, 120);
    }
  } else if (effect == 1) {
    // Alternating lights and high/low alarm notes share a 250 ms clock.
    int step = (elapsed / 250) % 2;
    if (step != lastStep) {
      lastStep = step;
      lights(step == 0 ? 255 : 0, 0, step == 1 ? 255 : 0);
      tone(BUZZER_PIN, step == 0 ? 2637 : 3951, 200);
    }
  } else {
    // Each melody note advances the lit LED; brief gaps separate the notes.
    int step = (elapsed / 300) % 24;
    if (step != lastStep) {
      lastStep = step;
      uint8_t led = step % 3;
      lights(led == 0 ? 255 : 0, led == 1 ? 255 : 0, led == 2 ? 255 : 0);
      tone(BUZZER_PIN, NOTES[step % 8], 240);
    }
  }
}

Remix this project

Make it yours in one click

Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.

Open in Schematik