Stepper Motor Key-tar: a New Kind of Instrument
by tanner_tech in Circuits > Audio
3547 Views, 21 Favorites, 0 Comments
Stepper Motor Key-tar: a New Kind of Instrument
Have you ever started a printer, and heard the various sounds it creates? Wouldn't it be awesome to create a whole instrument that plays these retro printer sounds on actual printer parts? Well, you're in luck. In this Instructable, I will show you how to build the Stepper Motor Keytar. This recycled instrument is unlike anything I have ever seen, it is the first of its kind. The Keytar uses an old computer keyboard to interface between the musician and the component that actually makes the music. This component is a stepper motor that spins at different speeds to play different notes. The stepper in this instrument actually came from an old printer. It sounds really cool when played. The video below complements this Instructable with a demonstration of the Keytar being played by me.
Lets get started.
Tools and Materials
To build this stepper motor Key-tar, you will need:
I found most of these parts in old devices, but if you just want to buy them, you can purchase them through the provided amazon links.
- Soldering iron http://amzn.to/2AiuKU7
- PS2 Keyboard (I saved this from being trashed)
- Wood
- Ice cream bucket
- Drill/bits http://amzn.to/2itnv3L
- Wood screws
- Lithium Polymer battery http://amzn.to/2AjHIRS
- Stepper motor (I got this from a printer) http://amzn.to/2zcDFGR
- Arduino uno http://amzn.to/2h9R4L8
- Stepper motor driver http://amzn.to/2h9O4hT
- LM386 Preamp circuit(I built this myself, you can buy one pre-made) http://amzn.to/2xYWjAo
- 100k Pot
- Power Switch
- Audio Jack
Mounting the Keyboard
The base of the entire instrument is a piece of 2*.5 inch wood. This wood stretches about 3 feet and holds all of the components necessary to make the Stepper Motor Key-tar function. You will need to start by cutting your piece of wood. The size you cut it too will depend on your height. After that, disassemble the keyboard. This will separate the back plate from all the other keyboard parts. You can then use a drill to put screws through the back of the keyboard into the wood. After the back plate is screwed back onto the keyboard, the first part of your instrument will be done.
The Acoustic Drum
This drum will help amplify the vibrations of the stepper motor. I used an ice cream bucket for this part, because I found it in the trash. I then painted this bucket with my logo to make it look cool. You can customize your acoustic drum however you want while building.
Mounting the Drum
The drum needs support inside of it to secure it to the wooden spine of the instrument. This comes in the form of a rectangular piece of plywood with holes drilled inside it. There are two screws in the bottom that go through the support beam, through the drum, and into the spine. This will ensure that the drum's support beam is secured. The drum will still wobble around, but this will be solved after the next step.
Mounting the Stepper
The stepper motor is what actually makes the sound. It is heavy, so it needs to be secured to a stable part of the Key-tar. This spot is the wooden support inside the bucket. You will need to drill 3 holes in the drum and support beam. The middle hole will be for the stepper motor gear. The two outer holes will be to mount the stepper to the support with bolts. By bolting the stepper to the outside of the drum and making a sandwich of the stepper, drum, and support beam, the stepper motor will be secured and able to be heard due to the amplification effects of the drum.
Adding Power
The stepper motor Key-tar needs to be powered by a 12 volt power supply. This power supply is a LiPo drone battery. I used some velcro straps to make sure that the battery can be placed between the keyboard and spine without risk of it falling out. There is a connector that plugs into the battery and runs in series with a switch to the main electronics. The switch is hot glued to the top of the keyboard. The power wires run, along with the keyboard wire, in a spiraling pattern around the neck of the instrument to the stepper motor controls.
Wiring
Without the correct wiring, your Key-tar will be nothing but a really big paperweight. To wire it, you need to first mount the control boards. The Arduino is the main control circuit for this project. It converts the digital signals from the keyboard into different pulses that are sent to the L298N motor driver to play different tones on the stepper. The arduino is mounted to the spine near the stepper. The L298N is mounted right next to the arduino, but perpendicular to it. There is also a fan that is placed at the end of the electronics section to keep everything cool.
To wire this, first connect the 2 power wires to the 12 volt input and ground terminals of the L298N module. You will also need to connect the 2 fan wires to these terminals. The 5 volt out and common ground of the L298N module will need to be connected to the Arduino's VIN and GRD pins respectively. After this, find where the 2 coils on the stepper motor are. There will be 4 wired, and each pair will have a resistance of about 4 ohms. Each pair will need to go to a different output of the L298N. The Arduino's pins 10, 11, 12, and 13 will need to be connected to the L298N's IN1 through IN4 pins(Refer to diagram above). The two PWM motor enable pins need to have jumpers to 5 volts.
All that is left is to wire the keyboard. There will be 4 wires that we need to use from the keyboard. Refer to the pinout of a PS/2 cable. The 5 volt and ground wires need to go to the 5 volt and ground pins of the Arduino. The Clock pin of the keyboard will need to go to Arduino pin 3 and the Data pin will need to go to Arduino pin 8. After all this is wired, your Stepper Motor Key-tar is just about ready for action.
The Code
The code is what actually makes the Key-tar work. First of all, the PS2Keyboard.h library decodes the signals sent by the keyboard into the ASCII characters that they represent. It then saves each keystroke as a char variable. There is then a series of variable assignments that assign stepper motor RPM to different piano notes based on the stepper RPM at 200 steps per rotation. This means that the stepper motor will move a certain number of steps per second equivalent to the frequency. For example, 200 steps per second will equal 200hz. The code will then figure out what key was pressed and assign the stepper to turn at the frequency associated with that key. I have changed the code to make the keys on the keyboard correlate to the keys on a piano when the keyboard is upside down. After the not plays, the program shuts down the motor. I have even hid a special piece of code in the program, press the up arrow key to find out what this hidden program does. Hint: Listen to one of my YouTube videos.
To upload this code, you will first need to download the ps2 library and import it into the library folder in arduino. Then, open up the attached Arduino program and upload it to the arduino. Make sure to set the correct board and port types.
If all goes well, if you fire up the Key-tar and press a key, you should hear the stepper play a note. If not, comment below and I will do my best to help you.
The Amplifier
The Key-tar is very quiet by itself. The acoustic drum does have some effect on the volume of this instrument, but not much. You will need to have an amplifier board and piezo pickup so everybody can hear you play. The amplified output can then be sent to a loudspeaker. This board is just a preamp. I used an LM386, which is a dedicated amplifier IC. It is fed by a piezo element that I rescued from a microwave beeper. The board is powered by the 5 volt and ground rails of the arduino. The audio output is used in the next step. I built my own amplifier board, you can see how to make it here:
Volume Controls and Outputs
The outputs from the LM386 go to a potentiometer and 1/8 inch output jack. The 100k pot is wired in a voltage divider configuration with the audio output. This means that Audio+ and Audio- from the preamp board go to either side of the pot. The wiper blade, or middle pin, and Audio- goes to the output jack. Both the potentiometer and output jack were mounted to the drum. I connect the Key-tar to a portable speaker or stereo system using a really long aux cord.
The Strap
Most instruments have a strap so you do not have to constantly hold them. To add a strap to my Key-tar, I added 2 eye screws with a length of rope running between them. This allowed me to hold the instrument while playing without getting tired of holding it.
Time to Play
After the Stepper Motor Key-tar is finished, you can play it. I find it really fun. It is kind of like playing the piano, but a little bit more difficult. I am still not perfect at playing this, but because I am a relatively good pianist, I have caught on quickly. I encourage everybody to build this fun instrument. It lives on the grey line between a digital instrument and an acoustic one, which makes it all the more interesting. You can watch the video in the intro to see me playing it.
Thanks for reading and make sure to vote for me in the reclaimed contest.
Good luck building!