Xylophones are popular kids’ toys because they’re simple, affordable, and cheery. The name is also fun to say and gives us something to fill in the X spot in alphabet books. But while many of us banged on xylophones as children, few learned how to play them properly. To make such learning unnecessary, Rachad El Moutaouaffiq built this automatic xylophone.
If you listen to the melody in the video, you can hear that this sounds far more pleasant than any toddler smacking their toy xylophone while their parents pretend their ears don’t work. That’s because it is fully computer-controlled. Each bar has its own solenoid that acts as a mallet, for a perfect strike every time. Those operate according to MIDI files, so the automatic xylophone can play any tune.
To gain some experience with electromagnetism, El Moutaouaffiq constructed all of the solenoids himself. Each one consists of a nail, a short length of flexible tube, a couple of washers, and a hand-wound coil of wire.
An Arduino Mega 2560 controls all of the DIY solenoids through bipolar junction transistors (BJTs). It has a sketch that activates the solenoids according to incoming MIDI notes received via serial. Those come from a computer running LMMS MIDI software and are sent through serial by Hairless MIDI. El Moutaouaffiq simply had to define a pin for each MIDI note and connect the proper transistor to each pin.
El Moutaouaffiq hopes to add some AI functionality to send MIDI notes based on sheet music, but that isn’t working yet. For now, the automatic xylophone can play existing MIDI files.