Introduction: Stepper Motor Piano

This was inspired by a number of projects people have made that consist of motors programmed to spin at different speeds to play music. However, very few allow a user to play them like an instrument–instead, they are all pre-set songs, where notes were instructed to play for a certain period of time and the user would simply hit a button to start a song. I wanted to create something that looked and felt like an instrument, but secretly had an electronic skeleton. 


To understand how this instrument works, you need to know what a stepper motor is. This is a type of motor that divides a full rotation into a certain number of “steps” which present as clicks as the motor spins around. These particular motors have 200 steps per revolution. The motors spin one step at a time, so you can very accurately tell them exactly how many degrees to spin, and how fast you want them to spin. This is very useful in manufacturing and robotics, but it also means that they work perfectly for making music! 


When music is made traditionally, the sound is generated by something (either a string, a reed, or a membrane) vibrating at a certain frequency. The frequency is what determines the note, a higher frequency being a high note (like a flute), and a low frequency being a low note (like a tuba). This is the same concept that allows the stepper motors to create music. The speed at which they spin controls the frequency of the “clicks” generated by the steps, which means when the motor is spinning slowly it creates a low note, and the faster it spins the higher the note gets. 


The copper keys on this instrument are connected to a capacitive sensor. This emits an electrical field, and can sense when something disrupts it (which in this case happens when you touch it with your finger). Depending on what key you touch, it is telling one of the motors to spin at a certain speed, which determines the note you hear.


Finally, I used a combination of sapele wood and anigre veneer (African hardwoods, the former which creates dust I’m mildly allergic to) to make the shell of the instrument, trying to mirror the aesthetic of string instruments in the design. This not only helps with the acoustics of the instrument, it also does a good job of hiding the tangle of wires that lurk underneath the keyboard…


Supplies

Below are the tools I used, but if one was making a simpler version of this (it can even be done with a cardboard box!) you can skip quite a few of these:

  • Soldering Iron (and electrical solder)
  • Drill Press
  • Table Saw
  • Band Saw
  • Router Table
  • Wood Glue (if we're counting this as a tool)
  • Spindle Sander
  • Random Orbital Sander


Below are the components I used:

  • 2 Adafruit 12-Key Capacitive Touch Sensor Breakout - MPR121 [ADA1982]
  • 4 Nema17 stepper motors
  • 4 A4988 stepper drivers
  • 2 Perf Boards
  • 1 Adafruit Metro Mini 328-5V 16MHz
  • Electrical wire
  • A 12v Panel Mount plug
  • 12v 8A Power Supply
  • 24 1/2" Copper End Caps
  • Mother of Pearl Powder
  • Sapele Wood
  • Anigre Veneer

Step 1: The Planning

I knew I wanted my final product to look like a traditional instrument, while hiding all of the electronic components. After fiddling around in Tinkercad for a while, I landed on this design. The idea being that it brought in aspects of a piano (the layout of the keys), while also incorporating the resonance chamber and curving silhouette of a string instrument.

Step 2: Electronics

I'll begin with a few words of advice, and an apology: when soldering the components to a perf board, make sure you use male to female connector pins, so that if you accidentally short out any of your components, it can be easily removed instead of needing to desolder an entire board at a time which is a huge pain. And I apologize because when I was creating this instrument, I didn't write down a wiring diagram, and it has now been many months so I will try my best to explain how the wiring was connected.

I used an Adafruit Metro Mini as the brains for the instrument, which is fully compatible with arduino and in my opinion a great substitute when you need a small arduino with lots of I/O. This was connected to two adafruit capacitive touch sensor breakout boards. Each wire from the breakout boards went to an individual copper cap, where it was soldered to the inside by using a torch to heat up the cap until the solder flowed freely. (It is important to note that this cannot happen until the wood portions of the instrument are built, otherwise there is no way to run the wires through the base.) This way, when touching the copper caps the capacitive touch sensors would be triggered, which would send an I2C signal to the metro about which key had been touched.

The metro was then also connected to 4 stepper motor drivers, each with one enabling wire and one direction wire. In the photo above, one of the drivers was being replaced which is why you can only see 3 on the righthand perf board. These were also connected separately to power and ground, so they wouldn't burn out the Metro pins by trying to pull too much current.

Finally, the Nema 17 motors were plugged into the stepper drivers, making sure that the wires were in the correct order for the motors to run correctly (some stepper motors have the wires in a different order, so you want to double check and make sure the continuity is what you would expect).

Step 3: Code

This was by far the most time consuming step. I started with just getting one stepper motor running, and then controlling the speed of it with arduino code. However, as I went to add more motors, it added a lot more complexity. This is because the speed at which you can send signals to the motors is dictated by how quickly your code runs, and you cant send info to all the motors at exactly the same time so it needs to be to one after another very quickly. That is, unless there's a simple way to do it that I haven't discovered, which is a very real possibility.

Step 4: The Enclosure

Let me start by saying if I was building this again I would not go about constructing the enclosure the same way. I had never worked with veneer before, and found myself in over my head very quickly. That being said, I think it turned out pretty well given my inexperience!

I started by making two oval frames out of MDF, and connecting them with dowels (I unfortunately don't have a picture of this part, my apologies). I then cut the veneer to roughly the right size, and glued it to the outside of the frames. This was my biggest mistake, as the veneer was nowhere near supported enough, and ended up cracking and peeling up in some places, and warping in others. However, through sheer willpower and lots and lots of epoxy and super glue, I managed to stick it back together, and patch the areas that had cracked. until they were no longer visible.

I then mapped out where everything needed to go on the sapele front, and drilled the holes for the stepper motors. For the main hole in the front I used a terrifying drill press circle cutter (one of the off-balance ones), which I then also used to create a small divot around that hole in order to lay in the mother of pearl inlay. This was a powder that I ordered online, which you simply dump into the divot and then flood with super glue, sand, and repeat. I think it turned out rather beautiful, especially given how easy it was! The most important thing though is to make sure the glue has fully dried, otherwise the wood dust from sanding can get stuck in the tiny crevices.

I glued the sapele front and back to the MDF frame, and used a router table with a flush cut bit to perfectly align the edges.

The base took some figuring out, but I eventually settled on drilling pilot holes for where the keys would sit, and then sanding the top down to the desired angle, and then completing the holes with the correct size bit so that I could make sure the depth was correct.

For the spinning hemispheres on the motor shafts, I first cut out a circle from some 1" thick sapele. I then screwed most of the way into the center, without going all the way through, and cut the screw head off so that I could mount it into a drill. I turned the drill on while holding the wood against a belt sander, and this allowed me to evenly sand it until it reached a contour I liked. I then simply removed the screw with a pair of vice grips, and glued the hemispheres onto the motor shafts.

In order to clean up the wiring a bit I placed a panel mount 12v female plug on the back of the base, so the power cord could simply plug in.

Step 5: In Conclusion

Please ignore my poor playing skills!

I hope this has provided inspiration for you to go out and make your own instruments!

Make Some Noise Contest

First Prize in the
Make Some Noise Contest