Jack-o-Lantern
Concept
Team 3 wanted to have some fun by making a Halloween inspired Arduino project! A simple plastic pumpkin from Party City was the only prop that we needed, along with the components required to execute the programmed code. As the door to the studio is opened, a switch is triggered, indicating that the door has been opened. When the Arduino board receives the signal, a delay is then sent to a speaker and four LED lights, which have been installed inside of the plastic pumpkin. Once the unsuspecting person is inside of the room, the speaker plays a cynical laugh mp3 file and the lights illuminate the pumpkin.
Technical Information
This design required the use of an mp3 shield accessory for the Arduino Uno processor board; this allowed us to play the sound clip from a micro SD card. We chose to install headers instead of soldering the connections so the board can be used again for future projects. Each of the four LED lights have been wired to the power terminals on the mp3 shield, with a solder connection linking all of the wires to a common ground.
We thought that our switch could utilize tin foil for a connection at the doorframe, however through trial, we found tin foil wasn’t conductive enough to close the circuit. Instead we soldered two pieces of metal to each side of the switch wires, and hot glued them to the doorframe.
As a group, we wanted to have a clean looking project, which we achieved by acknowledging the aesthetic of the design. All necessary components for the project to work are self contained within the plastic pumpkin. Using a smaller bread board and careful manipulation of the wiring allowed for this.
Jack-o-Lantern Schematic Diagram
arduino script
#include <SPI.h>
#include <Adafruit_VS1053.h>
#include <SD.h>
// define the pins used
//#define CLK 13 // SPI Clock, shared with SD card
//#define MISO 12 // Input data, from VS1053/SD card
//#define MOSI 11 // Output data, to VS1053/SD card
// Connect CLK, MISO and MOSI to hardware SPI pins.
// See http://arduino.cc/en/Reference/SPI “Connections”
// These are the pins used for the breakout example
#define BREAKOUT_RESET 9 // VS1053 reset pin (output)
#define BREAKOUT_CS 10 // VS1053 chip select pin (output)
#define BREAKOUT_DCS 8 // VS1053 Data/command select pin (output)
// These are the pins used for the music maker shield
#define SHIELD_RESET -1 // VS1053 reset pin (unused!)
#define SHIELD_CS 7 // VS1053 chip select pin (output)
#define SHIELD_DCS 6 // VS1053 Data/command select pin (output)
// These are common pins between breakout and shield
#define CARDCS 4 // Card chip select pin
// DREQ should be an Int pin, see http://arduino.cc/en/Reference/attachInterrupt
#define DREQ 3 // VS1053 Data request, ideally an Interrupt pin
Adafruit_VS1053_FilePlayer musicPlayer =
// create breakout-example object!
Adafruit_VS1053_FilePlayer(BREAKOUT_RESET, BREAKOUT_CS, BREAKOUT_DCS, DREQ, CARDCS);
// create shield-example object!
//Adafruit_VS1053_FilePlayer(SHIELD_RESET, SHIELD_CS, SHIELD_DCS, DREQ, CARDCS);
void setup() {
Serial.begin(9600);
Serial.println(“Adafruit VS1053 Simple Test”);
if (! musicPlayer.begin()) { // initialise the music player
Serial.println(F(“Couldn’t find VS1053, do you have the right pins defined?”));
while (1);
}
Serial.println(F(“VS1053 found”));
SD.begin(CARDCS); // initialise the SD card
// Set volume for left, right channels. lower numbers == louder volume!
musicPlayer.setVolume(10,10);
// Play one file, don’t return until complete
Serial.println(F(“Playing track 001”));
musicPlayer.playFullFile(“Demon Laugh.MP3”);
}
void loop() {
// File is playing in the background
if (musicPlayer.stopped()) {
Serial.println(“Done playing music”);
while (1);
}
if (Serial.available()) {
char c = Serial.read();
// if we get an ‘s’ on the serial console, stop!
if (c == ‘s’) {
musicPlayer.stopPlaying();
}
// if we get an ‘p’ on the serial console, pause/unpause!
if (c == ‘p’) {
if (! musicPlayer.paused()) {
Serial.println(“Paused”);
musicPlayer.pausePlaying(true);
} else {
Serial.println(“Resumed”);
musicPlayer.pausePlaying(false);
}
}
}
delay(100);
}