Help replicating Project on Arduino

Hello,

I found this circuit that allows a servo to move in sync with sound (Please refer to link below). I want to duplicate this project but I want to do with an Arduino, a servo, and a sound sensor. Does anyone know how the code for that will be?

Thanks.

Link to Demo Video

Probably nobody does because usually code is posted on the video creator's website or description, but still it is generally really bad to use code which wasn't written by you because it might not work if you use it in other project and because you don't get any better.
I would suggest instead looking for tutorials on the microphone module and how to use a servo motor, and then figure out how to interface them, that way you can get better at programming and you can understand tìhow those modules work

tutorial for understanding servo here
how to use it here

I’ve just took a look at the description and there is literally a link to the code, you are damn lazy sir

michelecioccarelli:
I've just took a look at the description and there is literally a link to the code, you are damn lazy sir

There is no source code in the link to the project. You owe the OP an apology, sir.

Depending on which Arduino board you use, the analog input will be where you send the sound. If from a microphone, you will need a pre-amp. You can read the level of the sound on the analog input then map that to a servo position.

Just Google Arduino sound to servo and you will get lots of ideas. Try writing some code and if you get into trouble, come back here with specific questions.

First answer to first reply under the video had the code.

Not the most helpful, it is a .hex file for the PIC chip used.

This is what I have right now. The servo is very jittery (yes, i’m using a separate power supply) so it doesn’t move all the way to its desired position. How would I fix this and improve the code so it can be as accurate as possible?

Thanks.

[code]
#include <Servo.h>
int soundSensor=2;
int LED=6;

Servo myservo;
//Define Servo
Servo servo1; 
int servoPos = 0;

void setup() {
  pinMode(soundSensor,INPUT);
  pinMode (LED,OUTPUT);
   //Define servo pins
  servo1.attach(3); //attach servo 1 to pin 3
}

void loop() 
{
  int statusSensor=digitalRead(soundSensor);
  if (statusSensor==1)
  {
    digitalWrite(LED,HIGH);
    servo1.write(90);
  }
  else
  {
    digitalWrite(LED,LOW);
    servo1.write(0);
  }
  }

[/code]

Servos do not move instantaneously. You are commanding the servo to move between 90 and 0 without waiting for it to reach its destination. At the very least, look at the examples that come with the servo library.

Reading a microphone as a digital input means ON/OFF which doesn't really seem like moving to music. You should be using an analog pin.