Introduction: Musical Robot

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

1. Mechanical

  • Nut bolt
  • 3d print of the model given on the next step

2. Electronics

3. Servo Motors(2)

4. Software

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.

servoAttach(a,9);

servoAttach(a,8);

servoWrite(a,9,90);

servoWrite(a,8,90);

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

trial4('filename',a);

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.

Comments

author
bikec made it! (author)2015-06-05

Hi,,i was planing to do your project dance robot,but i can not open file Arduino OI because the link can not opened. please help

author
bikec made it! (author)2015-06-04

I was looking and can not find a music cable. Why we need a lot pin output in arduino.

author
spectrum15 made it! (author)2015-04-19

Haha that dudes better at dancing than i am! you should put a mouth on it so it does look like a little dude.

author
gada888 made it! (author)2015-04-12

I love it, but the drawback is everytime you showcase this to people you worry about your laptop being stolen.joking,anyway,i standalone platform piggybacked on an arduino without the bulky matlab's presence will be better.

author
lakshay garg made it! (author)lakshay garg2015-04-13

The project is far from complete and I need matlab for dsp which is just not possible with arduino. There is a lot of scope for motion planning and music information retrieval in this project.

P.S. I didn't get your joke

author
amberrayh made it! (author)2015-04-10

That little robot just wants to dance!

About This Instructable

5,902views

81favorites

License:

More by lakshay garg:Musical RobotDrawing Robot
Add instructable to: