The first video is a demo of my first approach which gives a more versatile motion and the second video corresponds to the demo for the second approach. Go through both videos and there respective explanations in the last couple of steps.
The idea for this project is inspired from various musical robots around the world. In fact musical robots are very popular among robotics enthusiasts.
I have been working on this project since a couple of months and wish to share the results I have got so far. The project is a musical robot which takes any sound track preferably non-vocal as input and estimates its tempo(beats). It then accordingly plans its motion to be performed in sync with the song being played. You can learn about arduino, Matlab and beat tracking from this project. In the future I will extract more features from the audio file and make robot motion more versatile. Beat tracking itself is a very complex process and there is a truckload of material on it available on net.
Mechanical structure was designed to sort of give a feeling of a person who is head banging on EDM tracks, which kind of looks cool.
Electronics is fairly simple and similar to my previous project Drawing Robot
So go through the complete 'ible and comment if a better explanation for something is required.
P.S. Do vote if you liked the project.
Step 1: Material Required
- Nut bolt
- 3d print of the model given on the next step
- Arduino Uno
- PCB or Bread board
- Power Supply (5V 2A)
3. Servo Motors(2)
Above links are for India, so you can find this stuff with your local retailer easily.
You can take any servos with torque greater than 15 Kg.cm and for bread board users soldering iron and wire are not required.
Step 2: Mechanical Design
Designing is flexible process and you can change it according to your preferences.
Lets quickly go through the mechanical design.
Firstly you have to get the 3d model printed given in the fourth figure.
Then fix one of the servo brackets on the table as in the second image using screws, nails or nut bolt(preferable).
Attach one end of the printed model to the other bracket of the servo.
Attach your servo to both the brackets and its pin number is 8.
For the second servo attach the second end of the printed model to another bracket.
Now attach your servo to it as in the 3rd picture.
Drill 4 holes in the speakers so that they can be attached to the second bracket of the second servo and the attach them as shown in 3rd image. pin number of this servo is 9.
Where ever I have said attach do it using nut-bolt.
Step 3: Electronics
The picture above is self explanatory you can either make a shield for
the arduino as I have done or a bread board for the circuit.
Here you can see what I meant by pin numbers in the previous step.
Step 4: Coding...............
In this step I'll explain the first approach along with the setup.
SETUP: Download ArduinoIO from the link given on the materials page and install it on your Matlab as given in the installation steps which comes along with the package. If there is still some problem comment below.
Now download and save all the files given on this step to your Matlab directory except adioes.ino . Uplaod adioes.ino to your arduino
Attach your arduino to your PC swich on the power supply, connect the speakers to your PC.
First calibrate your servos as follows:-
Type a=arduino('COM#'); in place of # type the comport number of your arduino which you can find from the arduino IDE or device manager.
Now make sure that the speakers are facing up and everything is straight.
Add your audio file in the matlab directory
Type the following in the command line of your matlab to start your musical robot.
trialnew('filename',a); filename is your audio file for example booyah.wav.
And you are done!
Explanation of the code: trialnew function takes in the audio file and arduino object as input then extracts its beat timings (which cannot be explained here) then estimate its tempo for the first second of the song.
It then constructs an angle trajectory which is a cosine wave such that the bot bangs at the beat time and intensity corresponding to the beat time length. Then it adds the beat time to the timer and estimates the tempo of the next second. Thus constructing the motion of both the servos.
Step 5: Alternative Coding.................
For this process type:-
Download and save the file given in this step along with all the files in the previous step
Explanation: Everything is same as in the previous step but there is no continuous updating of tempo instead on constant tempo is calculated at the beginning and the motion becomes repetitive.