This is an instrument that uses a Ultrasonic sensor to measure the distance of an object (this could be your hand). With this a note is selected to play, in different modes the instrument plays different things. This could be a single note (for using the instrument as a bass) or multiple notes in sequence (for use as a synthesizer).
I recommend you make this only if you have a basic understanding of electronics and soldering.
- 3D printer with a minimum print area of 12x8cm
- Laser cutter or CNC machine with a minimum work area of 300x200mm
- Sanding equipment
- Hot glue gun
- Soldering Iron
- Wire stripper
- Wood (MDF) 3mm thick
The total size needed is 600x400mm but you can cut each part out of smaller planks, the minimum side needed then is 300x200mm (this is the outside dimention of a part needed so keep in mind that the outside does not need to be cut away if you use this method)
- Speaker (5W 8Ohms 93mm outer diameter)
you will most likely need to edit the dimensions of the speaker hole since not all speakers are alike
- Arduino (UNO)
- Dupont cables 20 and 10 cm
22x 10cm male - male
10x 20cm male - female
4 x 20cm female - female
approx. 2x60cm (2mm thick, but this does not really matter that much)
- 2 Ferrite rings (for noice reduction, not neccesairy for function but reccomended)
- 4 buttons (16mm)
- 1 piano pedal
- 20x4 LCD with I2C adapter
(20x4 LCD incl. I2C adapter)
- TDA2030A audio amp module
(TDA 2030 audio amp module)
- Arduino power source 5V or cut off usb cable to use with a power bank
- 3.5mm Audio Jack port
(3.5mm Audio Jack port (Not exactly the same as I use))
Design process and history
I made this instrument for a school project, I needed to design and build a smart object. After a bit of brainstorming I came with the idea to build a instrument that would play multiple notes when the user just gave the instrument 1.
When I first designed this instrument it looked a bit different and had a few other functions that the final product. My first criteria for this instrument where that it should be able to play diferent sounds (like a piano or guitar sound) and play chords. However after a few revisions I could not figure out how to play the sound files from a sd card, the sound kept getting messed up. So in a later iteration I decided the instrument should just play PWM signals which also sound nice. This is the point where this turned from a piano with a ultrasonic sensor to a smart version of a Theramin.
When programming a few other functions i realised that I was not going to be able to play multiple tones at the same time with one speaker within the timeframe of this project. So I decided to make it a synthesiser that instead of playing multiple tones at the same time, played a few notes in sequence.
This project is the first time I used a laser cutter and had to use Adobe Illustrator, so I hope I can explain my work well enough.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Assembling the Components (testing Phase)
Before we build the whole thing we should test all of our components so everything works.
Start by soldering the wires that need soldering, these are:
- The audio jack connector, these are 2 wires. One wire is the ground and the other is a signal wire. There are probable more connections available because a stereo jack plug has a R and L signal, we just use one. The only way to check wich one you need is to test connecting the wire to one at a time and see if the circuit is closed (you can test this with a multimeter).
- 2 wires on the speaker, positive and negative.
- The positive and negative wires on the 4 push buttons. You can insert the male wire end to the contact pins on the buttons. Use the heat schrink tubing to insulate the wires when you are done soldering
Now it is time to connect the wires. Follow the diagram and the photos to connect the right wires to the right places.
Because the arduino is not made for audio it can pick up electromagnetic interferance. You can add a ferrite ring to the audio signal cable and the speaker wire. You do this by wrapping the wire 2 or 3 times around a ferrite ring.
This should help reduce or completely remove hissing sounds from the instrument.
(power option 1) exteral powersource not trough Arduino
It is optional to add power directly into the circuit instead of trough the arduino power port. If you do want this you should connect the Positive and Negative wires from the external power source to the Positive and Negative lines on the breadboard. There should be a wire from the positive side on the breadboard to the Vin pin (located besides the GND pins) on the arduino and a wire from the negative side to a GND pin on the arduino.
(power option 2) External power connected to arduino power socket
If you want to use a adapter connected to the arduino power socket you should connect a wire from the arduino 5V pin to the positive side of the breadboard and a wire from a GND pin to the negative side
Uploading the files
Now plug the arduino into your computer and upload the program.
Note that you need to put the code.ino and pitches.h into a folder called code.
In the arduino IDE (the program) you need to download the following libraries if you dont have them: LiquidCrystal_I2C from Frank de Brabander
Wire from adafruit (this one should be built in already)
Step 2: Making the Case
If everything works you can make the case.
Laser cutting / CNC (see video)
Before you start cutting you may need to edit the speaker hole(s) to fit the speaker you have. I have a speaker with a small grill that uses the 4 holes around the speaker hole. So edit this first if you need to.
Start by cutting the wood with a laser cutter or CNC machine. The file to use is Case_laser_cut.ai
Once you have the parts you can test fit them, if they are to big just sand them a bit until they fit together.
You can now glue the wood pieces together with wood glue. You should not glue the top part (the plank with holes) since we need to put all the parts in and we need to be able to open the case if there is a problem. keep in mind that you tighten everything together while it dries (leave it for about 24 hours to fully harden).
Now you can print the lcd housing and the letters for above the buttons (Case LCD.stl and letters.stl)
I recommend these settings:
- Layer hight 0.1mm
- Speed 30mm/s for the letters and 60mm/s for the lcd housing
- Use a layer cooling fan for the LCD housing since it has a lot of overhang
- Support is not needed
Once the prints are finished, sand the edges to make them somewhat smooth and if the lcd does not fit try sanding it some more, it should fit.
Once the case is done and the parts are printed you can begin assembling everything.
Put the lcd in the lcd housing and put the audio jack connector for the pedal in the hole on the back.
Glue the lcd and jack connector in place. Now glue the lcd housing to the wood, you can put the glue on the lip on the bottom of the lcd housing.
Now glue the button letters on top of the buttons.
Depending on what speaker you have you can glue it in place, I have a speaker with a small grill that uses the 4 holes around the speaker hole. Depending on how you edited the speaker hole for your speaker this step could be different for you.
Glue the ultrasonic sensor in place using the 2 holes at the bottom.
You can also glue the breadboard(s), Arduino and audio amplifier module in place but this is not neccesairy.
Connect everything up again and you are done, turn on the power and enjoy!
Step 3: Known Problems and Limitations
This instrument is not perfect
First of all its a toy not a product!
The arduino is not made to use as a instrument so dont think the timing will be 100% correct. Due to lag in operations in the code it is impossible to make this instrument with accurate timing.
- Sometimes the ultrasonic sensor has a glitch which can result in a random note being played or inacurate notes being played.
- When using the instrument I recommend using a flat object like a piece of cardboard or wood to hold above the sensor. Curved surfaces reflect the signals from the sensor so this results in inacurate notes being played. You can use your hand but hold it as flat and steady above the sensor as possible.
- Not switching back from autoplay off to on. This is caused by a bug in the code that I have not found yet. You can solve it by pressing the autoplay button and at the same time press the pedal. Or you can turn it off and on again.
- Lag when playing a note, this is because the code in the arduino take a few milliseconds which is impossible to remove since the arduino is not made for making instruments.
- some code is in Dutch, this is because I am dutch and some English words did not fit on the LCD. I tried to do as much in English as possible.
Step 4: DIY Improvements
After building this you are not done!
You can try to improve your own skills and add features to this that I could not integrate in the timeframe I had.
Things you could try:
- adding multiple sounds
- playing multiple tones at the same time
- adding more speakers
- Add more styles!
- Add led's that dance with your music
Participated in the
Arduino Contest 2017