DIY Motion Activated Tremolo guitar pedal


Hello Everyone!
Guitar pedals and music effects are very interesting to experiment with, so I decided to come up with something new and original. Using minimum possible components I made a circuit that simply breaks and rejoins the connection between the guitar and the amp. But thats not the catch,
This pedal can be controlled without coming in contact with the pedal. 
Weird, right?
The setup uses an ultrasonic sensor (Popularly, used for obstacle avoidance in robots) to calculate the distance from the pedal, and activate the effect accordingly. Also the closer you move towards the pedal, the more shallower the effect gets. 
Well, if I've got your attention and your head is bubbling with ideas,  here is , how I made it!-

Step 1- Watch the video-
https://www.youtube.com/watch?v=SwUfxQK5lw8

Step 2- Get the parts-
1. An Arduino ( Uno or Nano) ( a clone would also do the trick)
2. A single channel relay (an electro-mechanical switch)
3. (1/4 inch mono sockets) x2
4. Ultrasonic sensor module (HC SR04)
5. A toggle switch
6. A DC socket ( to use external power supplies between 6-12V)
7. Some wires (of-course)
8. An Enclosure( Preferably, not metal, to reduce noise)

Step 3- Wire it up!

























I've tried my best to make the diagram as clear as possible, however if you face any problems, just leave a comment.

Step 4- Upload the code to the Arduino
If this is the first time you're using an arduino, do some googling and get acquainted with basic arduino programs.
Simply copy-paste this program onto your arduino IDE, Heres the code-


const int trigpin =8; //this section is to tell the arduino what connects where
const int echopin=7;
int relay=10;
int distance;
long duration;

void setup() {
  // put your setup code here, to run once:
pinMode(trigpin,OUTPUT); //initializing OUTPUTS AND INPUTS
pinMode(10,OUTPUT);
pinMode(echopin,INPUT);
pinMode(6,OUTPUT);
pinMode(4,OUTPUT);
pinMode(12,OUTPUT);
pinMode(11,OUTPUT);

}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(6,HIGH); //we'll use pin 6 as a 5V powersupply for the ultrasonic sensor
  digitalWrite(4,LOW); // to use pin 4 as ground
  digitalWrite(12,LOW);// to use pin 12 as ground

  if(calculatedistance()<60 && calculatedistance()>=30){ //to activate the switch when an obstruction is 30cm-60cm away from the sensor
  digitalWrite(10,HIGH);// to break the connection between the guitar and the amp
   digitalWrite(11,HIGH);// for the indication LED
  delay(120);// a small pause
  digitalWrite(10,LOW);//to rejoin the connection
  digitalWrite(11,LOW);// for the LED...
  delay(120);// and another pause
 

  }
  else if(calculatedistance()<30 && calculatedistance()>=20){
  digitalWrite(10,HIGH);
  digitalWrite(11,HIGH);
  delay(90);
  digitalWrite(10,LOW);
   digitalWrite(11,LOW);
  delay(90);

}
  else if(calculatedistance()<20 && calculatedistance()>=5){
  digitalWrite(10,HIGH);
  digitalWrite(11,HIGH);
  delay(70);
  digitalWrite(10,LOW);
   digitalWrite(11,LOW);
  delay(70);
 
}
else{ digitalWrite(10,LOW);
digitalWrite(11,LOW);
}
}
int calculatedistance(){// to calculate the distance using the sensor
  digitalWrite(trigpin, LOW);
  delayMicroseconds(2);
  // Sets the trigPin on HIGH state for 10 micro seconds
  digitalWrite(trigpin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigpin, LOW);
  duration = pulseIn(echopin, HIGH); // Reads the echoPin, returns the sound wave travel time in microseconds
   distance= duration*0.034/2;
  return distance;
}




And thats it, it should work if you've done everything correctly.
Now that you've got it to work the way I designed it, you can use this as a base for a bigger and better project :). Let your creativity overWrite my code.
You would have realised that the relay is a bit noisy.
For sure, using a relay for this purpose is not the best idea, but is definitely the easiest way to go about it. If you're interested in improving on this you could read about( or if you already know), using a transistor as a switch for this purpose. 

Stay Creative
                                                                                          Cheers
                                                                                          Siddharth
       

Popular posts from this blog

Weekend project- DIY TV remote controlled car

Rubik's New Challenge -

Fender Squier Review