tgarg
Published © GPL3+

Music Snowflake Decor

An epic Winter Decor that will light up your home with music and light.

IntermediateFull instructions provided169
Music Snowflake Decor

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
The brain of the project.
×1
Male/Male Jumper Wires
Connections
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
Connections
×1
LED White and Warm White (Generic)
The Lights for the snowflake. You can choose any color. 12 LEDs total(6 of one color and 6 for the other).
×1
Buzzer
Buzzer
Plays the music
×1
Resistor 10k ohm
Resistor 10k ohm
Resistor for the buzzer
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Permenantly connecting the wires and jumper cables
Hot glue gun (generic)
Hot glue gun (generic)
Necessary for joining the cardboard that structures the LEDs

Story

Read more

Schematics

The Circuit Diagram

Do not use 11 and 3 when using the function tone() for the buzzer.

Code

Code for the song "We Wish You a Merry Christmas"

Arduino
int buzzer = 2; // 2 = The pin you use for the buzzer on the Arduino
int x = 450;

void setup() {
  pinMode(buzzer, OUTPUT); // Telling the Ardiuno that Buzzer is an Output
}

// New Function
void We_Wish_You_A_Merry_Christmas() {
  // Tone(pin, hertz, milleseconds)
  tone(buzzer, 262, 417); // C4
  delay(x); // Delay is there to space out the notes to understand the melody
  tone(buzzer, 349, 417); // F4
  delay(x);
  tone(buzzer, 349, 208); // F4
  delay(x/2); // Give the feel of a eighth note rather than quater
  tone(buzzer, 392, 208); // G4
  delay(x/2);
  tone(buzzer, 349, 208); // F4
  delay(x/2);
  tone(buzzer, 330, 208); // E4
  delay(x/2);
  tone(buzzer, 294, 417); // D4
  delay(x);
  tone(buzzer, 294, 417); // D4
  delay(x);
  tone(buzzer, 294, 417); // D4
  delay(x);
  tone(buzzer, 392, 417); // G4
  delay(x);
  tone(buzzer, 392, 208); // G4
  delay(x/2);
  tone(buzzer, 440, 208); // A4
  delay(x/2);
  tone(buzzer, 392, 208); // G4
  delay(x/2);
  tone(buzzer, 349, 208); // F4
  delay(x/2);
  tone(buzzer, 330, 417); // E4
  delay(x);
  tone(buzzer, 262, 417); // C4
  delay(x);
  tone(buzzer, 262, 417); // C4
  delay(x);
  tone(buzzer, 440, 417); // A4
  delay(x);
  tone(buzzer, 440, 208); // A4
  delay(x/2);
  tone(buzzer, 466, 208); // B FLAT 4
  delay(x/2);
  tone(buzzer, 440, 208); // A4
  delay(x/2);
  tone(buzzer, 392, 208); // G4
  delay(x/2);
  tone(buzzer, 349, 417); // F4
  delay(x);
  tone(buzzer, 294, 417); // D4
  delay(x);
  tone(buzzer, 262, 208); // C4
  delay(x/2);
  tone(buzzer, 262, 208); // C4
  delay(x/2);
  tone(buzzer, 294, 417); // D4
  delay(x);
  tone(buzzer, 392, 417); // G4
  delay(x);
  tone(buzzer, 330, 417); // E4
  delay(x);
  tone(buzzer, 349, 835); // F4
  delay(1500);
  }

void loop(){
  We_Wish_You_A_Merry_Christmas(); // Runs the function
} 

The code for the LEDs and the Song

Arduino
const int buzzer = 2;
const int x = 450;

void setup() {
  pinMode(buzzer, OUTPUT);
  for(int i=13; i>=6; i--) {
    if(i!=11){
      pinMode(i, OUTPUT);
      digitalWrite(i, LOW);
    }
  }
}

// A function where all the inside LEDs are on
void LED_on(){
  for(int o=6; o<=12; o++){
    digitalWrite(o, HIGH);
    }
}

// A function where all the inside LEDs are off
void LED_off(){
  for(int o=6; o<=12; o++){
    digitalWrite(o, LOW);
    }
}

void We_Wish_You_a_Merry_Christmas() {
  LED_off(); digitalWrite(13, LOW);
  delay(500);
  
  tone(buzzer, 262, 417); // C4
  digitalWrite(12, HIGH); digitalWrite(13, HIGH);
  delay(x);
  
  tone(buzzer, 349, 417); // F4
  digitalWrite(11, HIGH);
  delay(x);
  
  tone(buzzer, 349, 208); // F4
  digitalWrite(10, HIGH);
  delay(x/2);
  
  tone(buzzer, 392, 208); // G4
  digitalWrite(9, HIGH);
  delay(x/2);
  
  tone(buzzer, 349, 208); // F4
  digitalWrite(8, HIGH);
  delay(x/2);
  
  tone(buzzer, 330, 208); // E4
  digitalWrite(7, HIGH);
  delay(x/2);
  
  tone(buzzer, 294, 417); // D4
  digitalWrite(6, HIGH);
  delay(x);
  
  tone(buzzer, 294, 417); // D4
  LED_off(); digitalWrite(13, HIGH);
  delay(x);
  
  tone(buzzer, 294, 417); // D4
  digitalWrite(6, HIGH);
  delay(x);
  
  tone(buzzer, 392, 417); // G4
  digitalWrite(7, HIGH);
  delay(x);
  
  tone(buzzer, 392, 208); // G4
  digitalWrite(8, HIGH);
  delay(x/2);
  
  tone(buzzer, 440, 208); // A4
  digitalWrite(9, HIGH);
  delay(x/2);
  
  tone(buzzer, 392, 208); // G4
  digitalWrite(10, HIGH);
  delay(x/2);
  
  tone(buzzer, 349, 208); // F4
  digitalWrite(11, HIGH);
  delay(x/2);
  
  tone(buzzer, 330, 417); // E4
  digitalWrite(12, HIGH);
  delay(x);
  
  tone(buzzer, 262, 417); // C4
  LED_off(); digitalWrite(13, LOW);
  delay(x);
  
  tone(buzzer, 262, 417); // C4
  digitalWrite(12, HIGH);
  delay(x);
  
  tone(buzzer, 440, 417); // A4
  digitalWrite(11, HIGH);
  delay(x);
  
  tone(buzzer, 440, 208); // A4
  digitalWrite(10, HIGH);
  delay(x/2);
  
  tone(buzzer, 466, 208); // B FLAT 4
  digitalWrite(9, HIGH);
  delay(x/2);
  
  tone(buzzer, 440, 208); // A
  digitalWrite(8, HIGH);
  delay(x/2);
  
  tone(buzzer, 392, 208); // G4
  digitalWrite(7, HIGH);
  delay(x/2);
  
  tone(buzzer, 349, 417); // F4
  digitalWrite(6, HIGH);
  delay(x);
  
  tone(buzzer, 294, 417); // D4
  digitalWrite(13, LOW); LED_off();
  delay(x);
  
  tone(buzzer, 262, 208); // C4
  digitalWrite(13, HIGH);
  delay(x/2);
  
  tone(buzzer, 262, 208); // C4
  digitalWrite(13, LOW); LED_on();
  delay(x/2);
  
  tone(buzzer, 294, 417); // D4
  digitalWrite(13, HIGH); LED_off();
  delay(x);
  
  tone(buzzer, 392, 417); // G4
  digitalWrite(13, LOW); LED_on();
  delay(x);
  
  tone(buzzer, 330, 417); // E4
  digitalWrite(13, LOW); LED_off();
  delay(x);
  
  tone(buzzer, 349, 1000); // F4
  LED_on(); digitalWrite(13, HIGH);
  delay(1500);
  }

void loop(){
  We_Wish_You_a_Merry_Christmas();
} 

Credits

tgarg
0 projects • 0 followers
Contact

Comments

Please log in or sign up to comment.