Introduction: Family Tree Grandfather Clock (class Project)

Materials:

1/4 inch wide Copper Tape

1 inch wide Copper Tape

Double Sided Tape

Clear Tape

Glue

Black Foam Core

White Foam Core

Copy Paper

Metallic Gold Paint

Pencil

Hobby Knife

Arduino Lilypad

Lilypad FTDI Basic Breakout

FTDI Cable

Conductive Silver Ink Pen

Conductive Thread

Speaker Head

12 LEDs (various colors)

Step 1: Connect the LEDs

Following the diagram, begin laying down the connections between your LEDs and the Lilypad with copper tape on a stiff surface, measuring at least 14 in. x10 in. Lay the LEDs down in rows of three, marking their positions with pencil. 10, 9, 6, and 5 should connect to the positive ends of your LEDs. Then, connect the negative of the Lilypad to the negatives of the LEDs. Leave about 4 inches of space between the top of the Lilypad and the first row of LEDs.

Step 2: Connect the Speaker

Next, connect your speaker to your Lilypad, using bridges of paper as necessary. 11 should connect to the positive end of the speaker. The negative end of the speaker should connect to the negative of the Lilypad. Tape the 14 in x 10 in surface down onto a 24 in x 11 in rectangle of black foam core board, leaving a 2 inch gap at the bottom. Then, with your regular tape, attach the speaker to the 24 in x 11 rectangle, where it meets the 14 in x 10 in board, so that the speaker rests on the side of the smaller board. Use conductive thread to secure the speaker's connection to the copper tape.

Step 3: Set Up the Touch Pads

On the leftside, connect A2 on the Lilypad to a 1 inch wide strip of copper tape, running down the length of the board to the last LED. Connect the positive of the Lilypad to a 1 inch wide strip of copper tape to the left.

Step 4: Prep the Interface

Cut out your clock face, center it, and attach it to your speaker with tape. Lay white copy paper over the surface hosting your connections. Tape it to the board from the top, so you can flip the copy paper over to reveal your connections, if you need to make corrections. Cut out a 2 in. to 2 1/2 in. tall harp shaped design from foam core with your hobby knife. Cut out three pieces of black foam core board to form a rectangular box around the Lilypad. Using black construction paper, cut out slits for the touch pads and LED strips.

Step 5: Attach the Interface

Form a box around the Lilypad, about 2 inches from the bottom of the longer board. The bottom end should be left open, to allow you to reach inside to access the Lilypad's on/off switch. Attach a piece of black construction paper to the top of the box to close it off. Attach the black construction paper you cut out from the previous step to white surface. Line up the cut-out slits with the appropriate areas and attach the harp shape to the bottom, just over the box. You can add a white block of foam core above the clock face, to act as a header.

Step 6: Decorate

Paint the white areas above the touch pads in metallic gold and add copper tape between the LED slits to create a family tree design. Add a handle to the box to create a false drawer.

Step 7: Upload Your Code and Finish

Connect the FTDI cable to the Lilypad FTDI Basic Breakout to upload your code onto the Lilypad. Copy and paste the following code onto your Lilypad through the Arduino Desktop IDE:

int sensorPin = A2; // fabric sensor is connected to analog pin A2
int sensorValue; // variable to store the value coming from the sensor int pin5 = 5; // LED connected to digital pin 5 int pin6 = 6; // LED connected to digital pin 6 int pin9 = 9; // LED connected to digital pin 9 int pin10 = 10; // LED connected to digital pin 10 int speakerPin = 11; // speaker connected to digital pin 11 void setup() // run once, when the sketch starts { Serial.begin(9600); // initialize the serial port digitalWrite(14, HIGH); // sets analog pin a0 to high pinMode(pin5, OUTPUT); // sets digital pin 5 to be an output pinMode(pin6, OUTPUT); // sets digital pin 6 to be an output pinMode(pin9, OUTPUT); // sets digital pin 9 to be an output pinMode(pin10, OUTPUT); // sets digital pin 10 to be an output pinMode(speakerPin, OUTPUT); // sets the speakerPin to be an output } void loop() // run over and over again { sensorValue = analogRead(sensorPin); // read the value from the sensor Serial.println(sensorValue); // send that value to the computer if (sensorValue < 1000 && sensorValue >= 670) { digitalWrite(pin5, HIGH); //turns on led connected to pin 5 digitalWrite(pin6, LOW); //turns on led connected to pin 6 digitalWrite(pin9, LOW); //turns on led connected to pin 9 digitalWrite(pin10, LOW); //turns on led connected to pin 10 } else if (sensorValue <= 670 && sensorValue > 590) { digitalWrite(pin5, LOW); digitalWrite(pin6, HIGH); digitalWrite(pin9, LOW); digitalWrite(pin10, LOW); beep(speakerPin,24.50,100); // D } else if (sensorValue <= 590 && sensorValue > 510) { digitalWrite(pin5, LOW); digitalWrite(pin6, LOW); digitalWrite(pin9, HIGH); digitalWrite(pin10, LOW); beep(speakerPin,65.413,100); // high C } else if (sensorValue <= 510 && sensorValue > 430) { digitalWrite(pin5, LOW); digitalWrite(pin6, LOW); digitalWrite(pin9, LOW); digitalWrite(pin10, HIGH); beep(speakerPin,82.41,100); //E } else if (sensorValue <= 430 && sensorValue > 360) { digitalWrite(pin5, LOW); digitalWrite(pin6, LOW); digitalWrite(pin9, HIGH); digitalWrite(pin10, LOW); beep(speakerPin,98.00,100); //F } else if (sensorValue <= 360 && sensorValue > 290) { digitalWrite(pin5, LOW); digitalWrite(pin6, HIGH); digitalWrite(pin9, LOW); digitalWrite(pin10, LOW); beep(speakerPin,196.00,100); //G } else if (sensorValue <= 290 && sensorValue > 220) { digitalWrite(pin5, HIGH); digitalWrite(pin6, LOW); digitalWrite(pin9, LOW); digitalWrite(pin10, LOW); beep(speakerPin,523.25,100); //A } else if (sensorValue <= 220 && sensorValue > 160) { digitalWrite(pin5, HIGH); digitalWrite(pin6, HIGH); digitalWrite(pin9, LOW); digitalWrite(pin10, LOW); beep(speakerPin,659.25,100); //B } else if (sensorValue <= 160 && sensorValue > 50) { digitalWrite(pin5, HIGH); digitalWrite(pin6, LOW); digitalWrite(pin9, LOW); digitalWrite(pin10, LOW); beep(speakerPin,392.00,100); //C: play the note C 500ms } else { digitalWrite(pin9, LOW); digitalWrite(pin10, LOW); digitalWrite(pin6, LOW); digitalWrite(pin5, HIGH); // turns on last set of LEDs so you know it is on but no audio } } void beep (unsigned char speakerPin, int frequencyInHertz, long timeInMilliseconds) // the sound producing function { int x; long delayAmount = (long)(1000000/frequencyInHertz); long loopTime = (long)((timeInMilliseconds*1000)/(delayAmount*2)); for (x=0;x

Step 8: Touch the Pads

Turn on the Lilypad and touch the pads to watch it work.

Credits:

Code by Jessica Gomula-Kruzic