Sound Recreater (my First Instructable)

by aswathmurari123 in Circuits > Arduino

45 Views, 2 Favorites, 0 Comments

Sound Recreater (my First Instructable)

image.jpg

This project combines a passive buzzer and a servo motor to make a dancing cardboard character that moves in sync with music.

The buzzer plays simple tunes like nursery rhymes, while the servo makes your character “dance” to each note.

It’s a fun beginner-friendly Arduino project — perfect for kids, STEM fairs, or just for fun at home!

Supplies

Arduino Uno 1


The main controller 1(any arduino preferably uno r3)

Passive Buzzer 1


Servo Motor (SG90) 1(Moves the dancing character)


Breadboard 1



For easy wiring

Jumper Wires

Few

Male-to-male or male-to-female as needed

Cardboard Cutout

1

Your dancing character

USB Cable

1

To connect Arduino to computer

Gathering Parts

1. Gather parts

  1. Arduino (Uno/Nano/Mega)
  2. SG90 (or similar) micro-servo
  3. Passive buzzer (not active)
  4. Breadboard (optional)
  5. Jumper wires (male-male)
  6. Small cardboard figure and tape/glue to mount on servo horn
  7. USB cable to connect Arduino to PC
  8. (Optional) External 5V supply if servo draws too much current


Character Making

Cut a small cardboard figure or draw on cardboard (similar to your photo).

Glue or tape the figure to the servo horn (the plastic piece that screws onto the servo). Center the figure so it balances — heavier on one side causes odd motion. Use a small amount of tape so the horn still fits on the servo shaft.

Configuration

3. Wiring (exact pins used in the code)

Use the pins you tested earlier: Buzzer → pin 8, Servo signal → pin 9.
  1. Servo
  2. Brown or Black wire → GND (Arduino GND)
  3. Red wire → 5V (Arduino 5V)
  4. Orange/Yellow wire → Pin 9 (Arduino digital PWM pin)
  5. If using external 5V supply: connect servo +5V to the external 5V, connect servo GND to Arduino GND (common ground), and servo signal to pin 9.
  6. Passive Buzzer
  7. Buzzer + (long leg) → Pin 8
  8. Buzzer - (short leg) → GND
  9. USB
  10. Connect Arduino to PC with USB cable for power + programming.


Uploading

  1. Open Arduino IDE on your PC.
  2. Select correct board and COM port: Tools → Board → Arduino Uno (or your board), Tools → Port → COMx.
  3. Install nothing extra is required for servo/tone — Servo.h is included by default.


Trial Phase

Upload a test sketch (confirming everything still works)

  1. Copy this short test sketch into Arduino IDE and upload:

#include <Servo.h>
Servo myServo;
int buzzer = 8;
int servoPin = 9;

void setup() {
Serial.begin(9600);
myServo.attach(servoPin);
pinMode(buzzer, OUTPUT);
Serial.println("Test start");
}

void loop() {
Serial.println("Servo 0°, buzzer 1000Hz");
myServo.write(0);
tone(buzzer, 1000);
delay(700);
noTone(buzzer);

Serial.println("Servo 90°, buzzer 1200Hz");
myServo.write(90);
tone(buzzer, 1200);
delay(700);
noTone(buzzer);

Serial.println("Servo 180°, buzzer 800Hz");
myServo.write(180);
tone(buzzer, 800);
delay(700);
noTone(buzzer);

myServo.write(90);
delay(1000);
}
  1. Open Serial Monitor at 9600 baud to watch status messages while it runs.


Trouble Shooting

Tune servo movement (if motion too harsh)

  1. If servo moves too fast or strains: reduce travel range. In code, replace myServo.write(45); and myServo.write(135); with gentler angles (for example myServo.write(60); and myServo.write(120);).
  2. Increase delay slightly between notes to reduce speed: change delay(beat); to delay(beat + 50);


More Songs

To start you out this is a simple rhythm for all.

:

#include <Servo.h>

Servo myServo;


int buzzer = 8;

int servoPin = 9;


void setup() {

myServo.attach(servoPin);

pinMode(buzzer, OUTPUT);

}


void loop() {

// Simple beat pattern

tone(buzzer, 440, 300);

myServo.write(45);

delay(300);


tone(buzzer, 523, 300);

myServo.write(135);

delay(300);


noTone(buzzer);

myServo.write(90);

delay(500);

}





these are more complex songs which might need troubleshooting😅😅😅😅


Twinkle twinkle little star

#include <Servo.h>

Servo myServo;

int buzzer = 8;

int servoPin = 9;


int melody[] = {262, 262, 392, 392, 440, 440, 392,

349, 349, 330, 330, 294, 294, 262};

int noteDurations[] = {4,4,4,4,4,4,2,

4,4,4,4,4,4,2};


void setup() {

myServo.attach(servoPin);

}


void loop() {

for (int i = 0; i < 14; i++) {

int duration = 1000 / noteDurations[i];

tone(buzzer, melody[i], duration);


// Servo dance with notes

if (i % 2 == 0) myServo.write(45);

else myServo.write(135);


delay(duration * 1.3);

noTone(buzzer);

}


myServo.write(90);

delay(2000);

}







mary had a little lamb:


#include <Servo.h>

Servo myServo;

int buzzer = 8;

int servoPin = 9;


int melody[] = {330, 294, 262, 294, 330, 330, 330,

294, 294, 294, 330, 392, 392};

int noteDurations[] = {4,4,4,4,4,4,2,

4,4,4,4,4,2};


void setup() {

myServo.attach(servoPin);

}


void loop() {

for (int i = 0; i < 13; i++) {

int duration = 1000 / noteDurations[i];

tone(buzzer, melody[i], duration);

if (i % 2 == 0) myServo.write(45);

else myServo.write(135);


delay(duration * 1.3);

noTone(buzzer);

}


myServo.write(90);

delay(2000);

}




The End

I hope you can do the project well and improve it by adding lights and voice mimicking but until then


ps: I hope to win this contest and this is my first post btw!!