Introduction: Messi Music Box

Picture of Messi Music Box

This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com). The Messi Music Box is a figure of Lionel Messi that is triggered by a touch to rotate and plays commentary sounds using internet speakers.

To create this project, you will need:

  • Access to 3D printer
  • Arduino Uno
  • Stepper motor
  • Touchpad capacitive sensor
  • Ada fruit FX Soundboard
  • Speakers (with Aux cord)
  • Wires
  • Battery 5-9V
  • Black Box with detachable lid (7.62 x 4.62 x 2.25 in.) or any kind of similar enclosure

Step 1: Step 1: Arduino Connections

Picture of Step 1: Arduino Connections

Stepper Motor

  • Connect the four pins of the stepper motor's to the Arduino's 3-7 digital pins
  • Connect the Vcc and Gnd pins of the stepper motor to the Arduino's GND and 5V pins

Ada fruit

  • If not soldered already, solder the pins to the ada fruit board and place it on a breadboard
  • Connect pin #1 to the Arduino digital pin #8
  • Connect reset pin to the Arduino digital pin #9
  • Connect VCC and GND to the Arduino's 5V and GND respectively.
  • Connect Speakers AUX cord to the Ada fruit headphone jack

Touchpad

  • Connect touchpad pin S to the Arduino's digital pin #1
  • Connect V and G to the Arduino's 5V and GND respectively.

Arduino Program

#define interruptNumber 0 //if we use pin 2 for the external interrupt, we need to attach interrupt number 0
//pin 3 would require interrupt number 1 #define Sound 3 //For playing sound on adafruit #define reset 4 //To reset adafruit #define TouchPadPin 2 //connect touch sensor output (pin "S") to D2 (and pin "G" to GND and pin "V" to 5V) #define LED 13 //we use the built in LED to show a touch event

volatile byte TouchPadEventFlag;//all variables that are changed within an ISR need to be dimensioned as 'volatile' //this variable will be used to tell the main loop that an interrupt event occurred. #include //use modified stepper library with 1000/0100/0010/0001 magnet firing sequence. Put library in your library folder.

#define gearratio 64 //1:64 gear ratio const int stepsPerRevolution = 2048; //the Arduino Kit motor is geared down. By experiment I determined that 2048 steps turn the shaft one round.

// instantiate a 4-wire stepper on pins 8 through 11: Stepper myStepper(stepsPerRevolution, 8,9,10,11);

void setup() { myStepper.setSpeed(0.15*gearratio);//the motor appears to be geared down 1/64, meaning that the speed needs to be set 64x. // initialize the serial port: pinMode(LED, OUTPUT);//define the built in LED pin as output pinMode(TouchPadPin, INPUT);//define the interrupt pin as an input attachInterrupt(interruptNumber,InterruptServiceRoutine, CHANGE);//CHANGE defines that 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 pinMode(reset, OUTPUT); //Initializes reset pin as output digitalWrite(reset, LOW); pinMode(Sound, OUTPUT); //Initializes sound pin as output digitalWrite(Sound, HIGH); } void loop() { if (TouchPadEventFlag==1) //This means if Pad is touched, initialize interrupt { digitalWrite(reset, HIGH); //reset pin not grounded therefore not active digitalWrite(Sound, LOW); //sound pin grounded ... playing music

myStepper.step(stepsPerRevolution); //To rotate stepper motor delay(5); myStepper.step(stepsPerRevolution); delay(5); myStepper.step(stepsPerRevolution); delay(5); myStepper.step(stepsPerRevolution); delay(5); myStepper.step(stepsPerRevolution); delay(5); myStepper.step(stepsPerRevolution); delay(100); myStepper.step(-stepsPerRevolution); //To rotate in opposite direction delay(5); myStepper.step(-stepsPerRevolution); delay(5); myStepper.step(-stepsPerRevolution); delay(5); myStepper.step(-stepsPerRevolution); delay(5); myStepper.step(-stepsPerRevolution); delay(5); myStepper.step(-stepsPerRevolution); delay(5); myStepper.step(-stepsPerRevolution); delay(5); delay(30000);

TouchPadEventFlag=0;//reset the flag for the next interrupt } digitalWrite(reset, LOW); //Reset pin active, prepares the fx board for the next time

}

void InterruptServiceRoutine()//ISRs need to be void and have no parameters. { if(digitalRead(TouchPadPin)==HIGH) //when nothing touches the pad the output is HIGH { digitalWrite(LED, LOW); //LED is off } if(digitalRead(TouchPadPin)==LOW) //touching the pad causes the output to go LOW { digitalWrite(LED, HIGH);//turn the LED on TouchPadEventFlag=1;//set the flag to tell the main loop that a touch event occurred. } }

Step 2: Step 2: Design and 3D Printing

Picture of Step 2: Design and 3D Printing

Using AutoDesk Inventor, create the following structures that will be 3D printed to envelope the hardware.

  • Frame for touchpad sensor
  • Customize lid with speak hole, motor shaft hole, "MESSI" graved on it
  • Stepper motor support poles
  • Motor shaft stand
  • Lionel Messi Figure

Step 3: Step 3: Download Sound File on FX Board

Connect the ada fruit to your personal computer. Copy the sound file you want to use and paste it onto the removable disk. The sound file has to be in WAV format and under 16 MB. Name the file "T01NEXT0.wav"

Step 4: Step 4: Place Components Inside the Box

Picture of Step 4: Place Components Inside the Box

Secure Touchpad on the lid by placing it inside the 3d printed frame. Place all components inside the box and make sure you connect the Arduino to a 5V battery. Turn ON the speakers and close the box. Afterwards, mount the figure onto the stepper motor's shaft by placing through the hole of the lid.

Step 5: Step 5: You Are Ready!

Touch the touchpad to active the music box. The figure should rotate along with the sounds you place onto the Adafruit.

Comments

3366carlos (author)2016-12-10

very nice

Awert19621962 (author)2016-12-10

This is unique.

HStiles11 (author)2016-12-08

I love it - but you should give him a tutu! ;)

Swansong (author)2016-12-07

This is unique. I haven't seen a music box like this before :)

About This Instructable

1,158views

9favorites

License:

More by ealhaddad:Messi Music Box
Add instructable to: