Shop OBEX P1 Docs P2 Docs Learn Events
Robotic Xylophone — Parallax Forums

Robotic Xylophone

Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
edited 2015-10-18 03:26 in Robotics
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:

[video]

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.

-Phil
«1

Comments

  • ercoerco Posts: 20,244
    That is GENIUS! I have thought along the same lines and bought several xylophones and glockenspiels for just such a project, but my girls always intercede and take them away before I can hack them up. I have studied several decorative Christmas chimes which have 4 stations, wired together. Each station has 2 chimes with a push/pull solenoid for activation (8 notes total, a full octave like yours). With that method, multiple chimes can be hit simultaneously for 2-part harmony.

    Your 2-servo radial layout is pure awesauce, and the fact that you made your own bars is amazing, both tone and tune are perfect. I am absolutely in awe and a bit jealous of this great achievement. Once again, everything PhiPi does is at an extremely finished and professional level.

    It's funny, I'm at the opposite end of the build spectrum. I slam-build once (rarely a v2.) with whatever is laying around. Messy but functional, with found objects, plenty of superglue drips, etc. Over the years I have rationalized this on several counts:

    1) I'm not a finish guy, I just want to see something work. Once it works, I'm happy and I move on.
    2) My brief attention span requires me to finish a project before I get bored with it and get distracted by something newer and shinier.
    3) I'm a toy guy, where the KISS principle rules. Usually my ugly "works-like" prototypes are accompanied by a pretty "look-like" rendering by a professional artist to get the idea across to imagination-free marketing types.
    4) My crude building techniques demonstrate that the mechanisms don't require hyper precision, and can be readily mass produced or duplicated by others who are not master craftsmen.

    That last point has been driven home many times recently after writing several DIY magazine articles. Getting people to get off their butts and scratch-build these days is difficult. Things need to look easily achievable, or people just turn the page. I build quick & dirty in hopes of making people say "sure, I can do that good or better".

    PhiPi, you are in an amazing classroom situation where you lead by example. Your students see how high you have set the bar and I'm sure they are motivated by your enthusiasm as much as by the grades they get. Jeepers, how I would love to be in your classes!
  • ercoerco Posts: 20,244
    PhiPi, which servo would you recommend for "Flight of the Bumblebee"?

  • erco,

    Thanks for the kind words!
    PhiPi, which servo would you recommend for "Flight of the Bumblebee"?

    LOL! I doubt that 88 servos could keep pace with that! There are still cases where biology can trump technology!

    -Phil
  • Pretty neat, Phil!

    We built a xylophone for an exhibit for a children's museum in Las Vegas. One octave, with the longest aluminium bar being 24". I was project manager, and I learned a lot from this site:
    http://www.nerdkits.com/videos/robotic_xylophone/
    and this site:
    http://www.mmdigest.com/Tech/breen_xylo.html
    (The spreadsheet was very handy.)
    I found the location of the nodes are critical. No solenoids on ours, just low tech mallets. :)

  • That's a neat project. There are plenty of toy xylophones that could ease the construction of a project like this.
  • That is mesmerizing! I love the simplicity of it, as well!
  • Brilliant, Phil!!!

    I don't know if your kids are inspired but I sure am!
  • Thanks, guys!
    Martin_H wrote:
    There are plenty of toy xylophones that could ease the construction of a project like this.
    Very true, but you have to be careful what you buy. I started by buying a toy xylophone at a local shop. 'Took it out, played a "scale," and noticed that something was just not right. The C->C octave was okay, but the intermediate tones were all equally spaced -- definitely not the way a major scale is tuned. So I took it back. That's when I decided just to get some aluminum bar stock from the local hardware store and make the bars from scratch.

    -Phil
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2015-10-19 21:22
    Very brilliant. Nice use of just two servos, instead of a bunch of solenoids You do an Erco proud.

    Nothing to add, except some day do a version with jars (if you're not a John Candy/Eugene Levy Shmenges fan, you might not fully appreciate this video):

  • Thanks, Gordon! I was a huge fan of those guys on SCTV, but I've never seen that skit. What a hoot!

    -Phil
  • What about low tech selenoid's actuating mallet's.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2015-10-20 01:06
    MikeDYur wrote:
    What about low tech selenoid's actuating mallet's.
    It takes one for each note, rather than just two servos. OTOH, faster songs and chords can be played using solenoids.

    -Phil
  • By the way, I have a question about the video. When the mallets return to a neutral/level position, there appears to be a bit of jitter. Is this intentional? Overshoot? A video artifact? Just curious...
  • The jitter is caused by the servo's control algo in the face of considerable rotational inertia -- much more than what might be encountered in, say, a model plane. It's what ultimately destroyed the first, cheaper servo. Lighter mallet ends would help. Maybe I can get one of my students to 3D print a couple.

    -Phil
  • WhitWhit Posts: 4,191
    WOW! Amazing job Phil!
  • I hadn't bothered to check this thread until now. I figured it was a link to some YouTube video made by someone I didn't know.

    Come to find out it was our own Phil! Very, very cool!

    As others have said, I love the simplicity of it.

    Thanks for sharing.
  • ercoerco Posts: 20,244
    edited 2015-10-20 17:09
    Phil, here's an extra credit challenge for your students. Benjamin Franklin invented the Armonica.

    https://en.wikipedia.org/wiki/Glass_harmonica



  • That would take a lot of Wine Glasses!
  • ercoerco Posts: 20,244
    edited 2015-10-20 21:37
    I didn't notice the guy wetting his fingers in the water. That's one job where sweaty hands would be a plus.
  • ercoerco Posts: 20,244
    PhiPi: Keep buying servos, there is much work to do!

  • erco wrote: »
    PhiPi: Keep buying servos, there is much work to do!


    So what are you thinking? A three-servo challenge? :lol:

  • To those for whom the video does not display, it's here.
    -Phil

    That's really neat, my wife want's one, and what do you know, I have the aluminum laying around.
  • ercoerco Posts: 20,244
    I think a radial layout of the bars would look pretty cool. I was about to post an Animation (simulation) video when I found this! Intel pulled it off, just not as colorfully. Wowsers. How do I get paid to build cool stuff like this?



  • Yes; a continuous rotation a
    servo could give you some fancy move's.
  • You will need a wheel encoder.
  • ercoerco Posts: 20,244
    MikeDYur wrote: »
    You will need a wheel encoder.

    I'd need a lot more than that! Might need both of Publison's Parallax USB Servo Controllers!

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2015-10-22 02:02
    My first xylo incarnation was a four-note Westminster chimes (C-F-G-A) device, with the bars arranged radially. Then I realized that it was a waste of space and required the rotary servo to turn farther than it had to. As long as the centers of the bars lie on the same radius, the effect of a radial arrangement can be achieved more compactly.

    But, yes, a radial arrangement does have that cool factor -- especially if the bars are somewhat pie-shaped.

    And, yeah, a radial arrangement with four mallets at 90 degrees to each other could be controlled by something akin to a helicopter swash plate, thus reducing maximum travel. Hmmm ...

    I'm now thinking about a set of chimes, hanging radially about a common center. I think two servos would do it: one for X; the other for Y. Each would operate a Delrin or UHMW (for slipperiness) panel with a slot in it, the two slots being arranged at right angles to each other. The mallet shaft, affixed on center at the top end, would hang downwards through the slots ...

    -Phil
  • But, yes, a radial arrangement does have that cool factor -- especially if the bars are somewhat pie-shaped.
    -Phil

    Does a pie shaped give you the same tonal quality?
  • MikeDYur wrote:
    Does a pie shaped give you the same tonal quality?
    Good question. I wonder, too, if it changes the locations of the nodal points.

    -Phil
  • Energy is going to seek the path of least resistance, may sound tinny or not vibrate as long.
Sign In or Register to comment.