Programmable Electric Music Box

by EstBuilds in Circuits > Arduino

833 Views, 8 Favorites, 0 Comments

Programmable Electric Music Box

FullSizeRender.jpeg

Hi, I am Cameron and I am 14 years old. I had the idea for this project a while back, but never made it. When I saw this contest I was motivated to attempt to make it. I am glad I did because I got a lot better at using Tinkercad, I used TPU for the first time, and I got some practice with electronics. The music box works fairly well, but some things could still be improved. So if you have any ideas or tips, please let me know. Also, for the explanation of this project, I will be mostly using pictures as I believe that is the best way to show the process. Thank you!

Supplies

  • 3D Printer
  • PLA Filament
  • TPU Filament
  • Hot Glue Gun
  • Hot Glue
  • Philips Head Screw Driver
  • #4 x 1/2 in Screws
  • Thin 6" x 7" Base (Any material that can be screwed into)
  • 8 Passive Buzzers
  • High Torque DC Motor
  • Arduino Nano
  • Cable for Arduino Nano
  • Sandpaper
  • Hobby Knife
  • Conductive Copper Tape
  • Wire Stripper
  • Variety of Dupont Wires
  • Electrical Tape
  • Ruler
  • Paint
  • Drill
  • 1/16 or Small Drill Bit

3D Print

Use the files below to print all of the pieces. Do not scale up or down. Print all pieces in PLA except for the two labeled with flexible which should be in TPU. The Arduino Nano Stand is only needed if you are using a Nano board. After printing, remove supports and use sandpaper when necessary.

Prepare the Base

IMG_6608.jpeg

Cut any thin material that can be screwed into easily to the dimensions 6" x 7". You can now paint the base if you would like. If you are painting the base, I would recommend sanding it first for better adhesion.

Add Axles to Barrel

IMG_6627.jpeg

Glue in the axles pieces to the barrel on both sides.

Pre Drill for Barrel Stands

IMG_6632.jpeg

Use the barrel stands on the barrel to mark out spots to pre drill.

Add Barrel to Barrel Stands

FullSizeRender.jpeg

Screw in one barrel stand. Slide in barrel and then screw in the other stand. Test to make sure it rolls.

Add Knobs Onto Axles

FullSizeRender.jpeg

Slide the two knobs on the axle. This may require some sanding and hammering.

Pre Drill for Motor Stand

IMG_6648.jpeg

Add the motor to the motor stand and connect motor shaft to the knob. Use this to mark the spots for pre drilling.

Screw in Motor Stand

IMG_6652.jpeg

Screw the motor stand onto the base and glue in the motor at the right height.

Connect Flaps Stand and Flaps

IMG_6655.jpeg

Screw the flaps piece to the flaps stand.

Add Copper to Flaps

IMG_6656.jpeg

Stick on a small piece of copper tape to each of the flaps.

Pre Drill for Flap Stand

FullSizeRender.jpeg

Pre drill holes for flap stand. You want the flaps to just barely miss the barrel.

Add Copper to Thin Flaps

IMG_6659.jpeg

Add a thin strip of copper tape to thin flaps.

Add Thin Flaps

IMG_6663.jpeg

Screw in flap stand and use glue or screws to attach the thin flaps so they rub on the bottom of the barrel.

Set Up Buzzer

IMG_6664.jpeg

On the positive terminal of the buzzer add female Dupont pins. On the ground terminal add a stripped wire.

Glue in Buzzers

IMG_6666.jpeg

Put the wires through the holes and glue in the buzzers.

Screw in Buzzer Stand

IMG_6669.jpeg

Screw the buzzer stand in. The stripped wires should go back through and the female Dupont pins should come through the front.

Add Arduino Board

IMG_6709.jpeg
FullSizeRender.jpeg

If you are using a Nano board screw in the stand and put the board on it. If you are using an Uno board just put it next to the base. The wiring and codes are the same for both boards.

Wire Up

Circuit design Smashing Bombul-Hango _ Tinkercad - Google Chrome 12_13_2023 8_49_27 PM.png
FullSizeRender.jpeg

Tape the stripped wires onto each of the copper flaps. You can use the picture and the diagram to match the rest of the wiring. Then, upload the code below to the your Arduino.


const int pins[] = {5, 6, 7, 8, 9, 10, 11, 12};

const int notes[] = {440, 494, 523, 587, 659, 698, 784, 880}; // You can change tones if desired.


void setup() {

 for (int i = 0; i < 8; i++) {

  pinMode(pins[i], OUTPUT);

 }

}


void loop() {

 for (int i = 0; i < 8; i++) {

  playNote(pins[i], notes[i]);

 }

}


void playNote(int pin, int frequency) {

 tone(pin, frequency);

 delay(0); 

 noTone(pin);

}

Wrap Peg in Copper

IMG_6691.jpeg

Wrap the peg in copper tape. You can make as many of these as you would like. They can be screwed onto any spot on the barrel to play different notes at different times.

Add Copper on Barrel

FullSizeRender.jpeg

Add copper tape all around the barrel and poke the wholes through.

Play!

Programmable Electric Music Box

Screw in some pegs, turn on the motor, and play some music. The video shows a simple tune played by the music box.