I've been trying to build stuff to inspire my students about the possibilities for wedding microcontrollers to mechanical systems. In that spirit, I made this mechanical xylophone:
To those for whom the video does not display, it's here
The xylophone is controlled by a Propeller programmed in Spin. It uses two servos: a HobbyKing HK15138 standard servo
to control the mallets' rotational positioning and a Turnigy TGY-9018MG 9G metal-gear servo
to operate the mallets striking the bars. I had tried a cheaper plastic-gear servo for the latter, but it quickly wore out -- not surprisingly, given the punishment it receives.
The bars are cut from 3/4" x 1/8" aluminum bar stock purchased from the local hardware store. I bought a three-foot-long piece and computed the lengths to yield 8 bars, spanning one major scale, with a little bit left over. The tonal frequency of each bar is proportional to the square of its length. The eight bars comprise one full octave, with two semitones separating the notes, except for between the third and fourth and seventh and eighth notes, which are separated by one semitone. (A semitone is 1/12th of an octave.)
Each bar is supported at its nodal points, which are 22.4% of the way from each end. This allows the bar to vibrate freely. The supports are covered with a self-adhesive layer of felt. I found that this was necessary to eliminate some nasty pinging noises as the bars were struck by the mallets. The mallets are wooden balls I found at the hardware store, press-fit onto laser-cut 3/32" Delrin stock. The "sounding board" is cheap 2.7mm plywood doorskin. Unlike stringed instruments whose vibrations are transmitted to the sounding board through a "bridge," a xylophone's vibrations are transmitted through the air to the sounding board (or resonant pipes) beneath.
The reason for two mallets is to minimize the distance the rotational servo must travel between notes. Also, the centers of all the bars are positioned equidistant from the rotational servo's axis.
All the parts, except for the bars are laser-cut. The bars were initially cut on a horizontal bandsaw, then trimmed to their precise lengths with a vertical disc sander, with the aid of a dial caliper. These could have been machined on a CNC mill from 1/8" aluminum plate with more precision -- especially regarding the hole locations -- but I was in a hurry and chose the more manual method just to get the job done.
Attached is an archive of the Spin program that controls everything. It's programmed to play the meager repertoire at random, separated by five-second gaps, with the proviso that the same tune cannot be played twice in succession. Each tune begins with a tempo (number of quarter notes in one minute), followed by bytes packed with duration and note info. Although it supports eighth notes, they cannot be played at a tempo much over 120.