Introduction: Christmas Cabin

This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com).

Ever since I was a kid, I have always been very fond of the Christmas season. I decided it would be fun to design and build a cabin with a Christmas theme to it.

All of the materials that make up the cabin was designed using Inventor Professional and later 3D printed. These parts DO NOT have to be 3D printed. This project would have turned out very similar and much cheaper if alternate materials such as wood, plastics, or cardboard was used.

The final look of the cabin is open to the imagination of the designer. The design process could even be a family event for the Holidays.

A list of all the electrical components used to build project are:

- Arduino Uno

- Jumper cables

- Piezo Buzzer

- DC motor (if larger motor will not spin as fast if powered only by the Arduino)

- 3 LEDs (your choice of colors)

- Touch Pad Sensor module

- 3 220k ohm resistors

- 1 NPN transistor (small signal)

Step 1: Fritz Diagram of the Circuit Wiring

Here is the Fritz diagram to connect all the electrical components together.

The transistor is being used as a switch to power the DC motor. The base pin of the transistor is connected to the PWM pin 6 of the Arduino. Since the motor I used was a small 3-5 volt motor, this method helped better control the spinning power of the motor (although it still spun pretty fast). The pulse signal in my sketch was set to 57 which is about 25% Duty Cycle. The PWM signal ranges from 0 - 255 (smaller # = smaller duty cycle) and you can change this value depending on the performance of the motor you choose. The motor was glued to the bottom of the base board and the protruding pin was further glued to the bottom of the Christmas tree in order to rotate it.

The circuit is initialized using the Touch Pad sensor. When the sensor is touched by any object, a change in voltage occurs and is recognized by the Arduino. The Arduino then enables the output components to turn on. Note, the ISR feature of the Arduino is required in order for this circuit to perform correctly.

The sketch was written to turn all the components on and off synchronously with the buzzer. When the buzzer is initialized, it begins to play the Christmas tune "Ding Dong Merrily on High." Three LEDs were placed inside the cabin. One is placed underneath the fireplace to imitate the look of an actual fire. The other two were placed in the ceiling to give it more a festive look. The buzzer is pasted inside the base wall of the project and aligned with a tiny hole for the sound to escape.

Step 2: Arduino Sketch

#define interruptNumber 0                                       //this initializes pin 2 as the external interrupt
#define touchpad 2 
#define fireplace 3
#define led 4
#define buzzer 5
int dcmotor = 6;
#define blinker 7
                                                                //Buzzer begins
int length = 73;
char notes[] = "ggagsed deggsgg ggagsed deggsgg DCbCDbCbabCabagabgagsgasgsesgeseddeggsgg "; // a space represents a rest
int beats[] = { 2,2,1,1,1,1,4,2,2,2,2,2,2,4,2,2,2,2,1,1,1,1,4,2,2,2,2,2,2,4,2,2,3,1,1,1,1,1,3,1,1,1,1,1,3,1,1,1,1,1,3,1,1,1,1,1,3,1,1,1,1,1,3,1,2,2,2,2,2,2,4,2,2 };
int tempo = 200;
void playTone(int tone, int duration) {
  for (long i = 0; i < duration * 1000L; i += tone * 2) {
    digitalWrite(buzzer, HIGH);
    delayMicroseconds(tone);
    digitalWrite(buzzer, LOW);
    delayMicroseconds(tone);
  }
}
void playNote(char note, int duration) {
  char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' };
  int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014, 956 };
  // play the tone corresponding to the note name
  for (int i = 0; i < 8; i++) {
    if (names[i] == note) {
      playTone(tones[i], duration);
    }
  }
}
                                    //Buzzer ends
                                          
volatile byte TouchPadEventFlag;    //all variables that are changed within ISR need to be dimensioned as "volatile"
                                    //this variable will be used to tell the main loop that an interrup event occurred
void setup() {
  pinMode(fireplace, OUTPUT);
  pinMode(led, OUTPUT);
  pinMode(blinker, OUTPUT);
  pinMode(dcmotor, OUTPUT);
  pinMode(buzzer, OUTPUT);
  pinMode(touchpad, INPUT);
  attachInterrupt(interruptNumber, InterruptServiceRoutine, CHANGE); //CHANGE defines the ISR is called when the voltage
                                                                     //on the PIN changes in either direction. We are using CHANGE and not LOW
                                                                     // to 'debounce' the pad. Using LOW would result in a continuous reading of the touch event
                                                                     // until your finger is removed from the pad
       
                             
}
void loop() 
{
 
 if(TouchPadEventFlag==1)
 {
  TouchPadEventFlag=0;                                              //resets the flag for the next interrupt
 }
}
void InterruptServiceRoutine()                                      //ISRs need to be void and have no parameters
{
    if(digitalRead(touchpad)==HIGH)
    {
      digitalWrite(led,LOW);                                        //turns off components after loops ends
      digitalWrite(fireplace, LOW);
      digitalWrite(blinker, LOW);
      digitalWrite(dcmotor, LOW);
    }
    if(digitalRead(touchpad)==LOW)                                  //touching the pad causes the output to go LOW
    {
      
      digitalWrite(led,HIGH);                                       //Components turn on while Buzzer performs
      digitalWrite(fireplace,HIGH);
      digitalWrite(blinker, HIGH);
      analogWrite(dcmotor, 57);
                                                                    //Buzzer begins
      for (int i = 0; i < length; i++) {
    if (notes[i] == ' ') {
      delay(beats[i] * tempo); // rest
    } else {
      playNote(notes[i], beats[i] * tempo);
    }
    // pause between notes
    delay(tempo / 2);
    }
    }
      TouchPadEventFlag=1;                                        //set the flag to tell the main loop that a touch event occurred
   }

Step 3: Video of the Finished Product

This project has a festive theme to it and it can perhaps be part of a family craft. The external look of this project will vary based on the imagination of the designer.

The LEDs can also be exchanged. Perhaps you can hang a small set of string LEDs on the outer rim of the roof instead of placing individual ones under the ceiling.

I hope you this instructable provides with a sufficient foundation on how to build your own Christmas Cabin/House. Allow your ideas to come out and make them a reality this Christmas season.