Introduction: UltraGuitar - an Ultrasonic Guitar
Runner Up in the
Raspberry Pi Contest 2016
I love music. I'm playing on piano but I also wanted to learn to play on guitar. I've tried a lot of times, but it was very difficult to play even simple songs. I could play a melodic line, but not the chords. I looked for a way to make it easier. So why don't to make a guitar, which plays whole chords for us? You don't have to care about each string.
So that's what I've done - an ultrasonic guitar. On the video you can see how the guitar will look and play. For every song probably you'll have to change the code a little bit for better sound and easier play.
Step 1: How It Works
This guitar doesn't have strings. It plays only whole chords (as I said before). On fretboard is an ultrasonic sensor which measures the distance from the slider (look at the image) to the sensor. By the change in the distance you change the chords (from C, C# to B). On the guitar's body are three buttons. If you push any of these buttons, the guitar (actually a computer) will play a chord. Depends on which button you'll push, it'll play a major chord, minor chord or 7th chord. All of it will be controlled by the Arduino and computer. The Arduino will get data from the sensor and the buttons, and send it to the computer via USB. Computer depending on what it'll receive on the serial port (USB) it'll play a chord or not.
So that's how it will work. Easy?
Step 2: Parts List
Parts needed to build the circuit:
three small buttons,
female-to-male or female-to-female wires,
Parts needed to build the guitar:
plywood (about 45cm x 70cm, 8mm thick),
wooden plank (it will be the fretboard, 6cm x 90cm, 1cm thick),
wooden plank (20mm x 20mm, about 50cm long),
wooden plank (15mm x 15mm, about 10cm long),
peg (8mm diameter, about 25cm long),
screws (4 16mm x 3mm and 6-8 30mm x 3mm),
electric impact screwdriver,
hot glue gun,
Some of this items might not be on images.
Step 3: Making Body
First thing you gonna do is to make the guitar body. There are many types of guitars - like electric guitar, acoustic guitar, etc. Different types of guitars have different bodies. I always wanted to play on electric guitar so I designed body which looks like the body of an electric guitar. So I sketch it on plywood (the body is 45cm height and 30cm width). You'll need two the same body shapes - one on top and another on bottom (to your body). Between these will be mounted fretboard, Arduino and all electronic stuffs. Now just cut the body as you designed and then redraws the shape of it and cut it again. OK, now you've got two bodies.
Step 4: Mounting Fretboard and Distance Blocks
Now you have to mount fretboard. So take one body, then take long wooden plank (90cm long) and fit it that it'll be 25cm in the body and in the middle of the body (like in the first image). After that screw it on 4 screws.
Take another body. You have to add some blocks (2cm x 2cm wooden plank) which will keep a distance between two bodies. Cut two blocks: 16cm and 19cm long. One block (about 16cm long) should be as near as possible to the fretboard (there will be Arduino and buttons) and the other should be on the other side of the fretboard (this block should have about 19cm long and should be parallel to the fretboard. I've made a mistake and my block wasn't parallel). In the second image you'll see where will be the fretboard when we put together two bodies and all dimensions which will help you to fit your distance blocks.
Now it's time for buttons.
Step 5: Buttons
Reverse the body with distance blocks. Put hand on it and check where will be the best place to mount three buttons. I've made it like in image 1. If you found the best place mark places for these three buttons and make holes using an 8mm drill.
OK, now cut from the peg (8mm diameter) three 32mm long little pegs. It will be our beautiful extension of the button. Polish them up until they will easily come into the holes in the body. Now about 9 mm from one end of one of those little pegs make a hole using a 1.5 mm drill. Take a toothpick and put it into this hole. Cut it that it will protrude about 2-3mm. Another end of the toothpick put into the same hole, but from the other side. Cut it the same as before. Do it for all little pegs.
Now put two bodies together that neither side will stick out. Take pencil and through each button hole mark its position on the other guitar body. Put away top body. Now we need to connect buttons together. One of two button pins is connected to GND so connect one button pin to another pin on another button using wire (look at image 4). Last button pin connects to the male-to-female wire (connect it to male end, female end will be connected to Arduino). Now take three male-to-female wires and connect the male end to the other button pin (image 5) on each button. Put each button on its place and glue it to plywood with the hot glue gun. Then glue wires to the plywood using one-sided tape (like in image 6). Choose which button is major, which is minor and which is 7th(in my guitar left button is major, middle is minor and right is a 7th - first image).
Now it's time for the Arduino.
Step 6: Mounting Arduino
Now you have to connect everything to the Arduino. Take ultrasonic sensor and connect to it four male-to-female wires. Take another four male-to-female wires and solder their male ends together to make four long female-to-female wires.
Take the Arduino and connect Vcc pin to +5V pin on the Arduino, Trig pin to 12 pin on the Arduino, Echo pin to 11 pin on the Arduino and GND to GND pin on the Arduino. Connect major button to 8 pin on the Arduino, minor button to 9 pin on the Arduino, 7th button to 10 pin on the Arduino and button GND to left GND pin on the Arduino.
Cut from a double-sided tape piece of Arduino's length and glue it in place where will be Arduino. Then put the Arduino on side on it (USB port to the outside of the guitar's body). Cut two more pieces of tape and glue it on the top of the Arduino.
Next will gonna put bodies together.
Step 7: Putting Guitar's Bodies Together, Mounting the Ultrasonic Sensor and Guitar Belt
Take other (top) body, put there three wooden expansions of the buttons that the longer side is in plywood. Now put two bodies together that if you push a wooden button it will press button on bottom body. If every button works properly rotate them together that bottom body is now in front of you. Screw bottom body to distance blocks on top body. I used two screws, but you can use four. It will be more solid.
Now we have to mount ultrasonic sensor. Rotate the whole body (top and bottom body - now are connected together). We have to mount ultrasonic sensor that its "eyes" will "look" parallel to the fretboard. To do this will need a hot glue gun. Put some glue on the top body part which is where fretboard goes (image 2) and touch sensor to it.
OK, we've put bodies together and we've got sensor in the right place. Now we need slider. We'll need two wooden blocks: one 20mm x 20mm 10cm long and 15mm x 15mm 8cm long; and also the peg (8 mm diameter). Cut wooden block and cut two 35mm long pegs. Take shorter block and on each side of the block make a hole using an 8mm drill, which is 10mm deep and 6mm from the end of the block. Take longer block and do the same thing, but make a hole which is 15mm deep and 16mm from the end of the block. Now put pegs in holes in bigger block and put the smaller block on the pegs which protrudes from the bigger block (look at image 3). Put slider on fretboard.
Rotate guitar's body and make a hole using an 8mm drill like in image 4. Now you can fasten your guitar belt.
Almost done. Last amendments.
Step 8: Bumpers, Coding and Writing
Now it's time for bumpers. They will avoid to get the slider to close to the sensor and to far from the sensor. Make a hole using a 1.5 mm drill on the side of the fretboard 5cm from the end of the plywood (image 1), put there a toothpick and cut it about 3-4mm from the fretboard. Now at the end of the fretboard about 2mm before the end make two holes using the same drill as before - one on each side, put there toothpicks and cut it that it'll protrude about 3-4mm from the fretboard. OK, bumpers done.
Now some coding. To read data from ultrasonic sensor you'll need library New Ping. You'll also need my code to properly communicate with the computer. Download them now. Save NewPing to libraries folder, open Arduino Software, go to File -> Examples -> NewPing -> NewPingExample. Connect your Arduino to the computer and send NewPingExample to the Arduino. Open Serial Monitor and set bound to 115200 (right-bottom corner). You should see something like this: Ping: number>cm. Get slider that touches closer (to the ultrasonic sensor) bumper. Open guitar code. In line #define INITIAL_TRESHOLD set number to what you've got in Serial Monitor. OK, go back to the Serial Monitor. Take a pencil, make a line and move slider 5cm far from the sensor. Make a line. Repeat this process until you'll have 12 lines. Now between each line write different chord. Between first and second line should be C, between second and third should be C#, etc. These are chords from the closest line to the farthest line: C, C#, D, D#, E, F, F#, G, G#, A, A#, B. Look at image 3. Now if you've got that write button names (image 4).
OK, the next step will be the last one.
Step 9: Last Coding
OK, last thing. The computer should play chords. To do this will need Processing. If you don't have it you can download it from here. Open the Processing software. You should see something like image 1. My program uses library called Minim. To download it click on Sketch -> Import Library -> Add Library. You should see a new window. There should be a text box. Write there minim and click enter. You should see something like in image 3. Click on Minim and click Install. If it was successfully installed, download and open guitar_play. There should be many.mp3 files and one guitar_play.pde file. Open it. All you need to change in this code is to write your Serial Port name to which the Arduino is connected. To check this go to Arduino Software, open guitar code and upload it to the Arduino. If you've done it in the right-bottom corner should be a string: "Arduino Nano ATmega328 on " and text after "on" write to the variable called portName in guitar_play code. Click on the Play button (left-top corner) and start playing.
That's the end. I hope you've enjoyed it. Please vote for me in the contest.
To the next Instructable :)
We have a be nice policy.
Please be positive and constructive.