Infrared Controlled Wah-Wah – Big Picture

The goal of this project was to build and program a wah-wah guitar effect pedal that is controlled through an infrared sensor to detect hand motion and vary the frequency of a guitar signal based on distance from the sensor.  Traditional wah-wah pedals are controlled via a potentiometer that varies the frequency response of the guitar creating a vocal wah wah sound effect. For this project the potentiometer was replaced with an LDR ( light dependent resistor), which varies resistance based on the amount of light detected.  The LDR was coupled to an LED with heat-shrink tubing to directly vary the amount of resistance based on the brightness of the LED. The LED is controlled with the atmega328pb microcontroller using ADC and PWM. The project was successful and resulted in an effective wah-wah guitar effect that is controlled through hand  movement. Control through the distance sensor allows for unique and expressive sounds based on the motion that the IR sensor detects. The sounds range from smooth crescendoing wah, to a fast stuttering effect when the hand is waved in successive motion over the sensor.

Infrared Controlled Wah-Wah – Code Snippet

The programming of the microcontroller was accomplished using Atmel studio 7 on Windows 10.  The goal of converting the analog voltage produced by the Sharp IR sensor to a digital signal was accomplished using the ADC of the microcontroller. The ADC was setup in an ADC initializing function, ADCinit. PC5 was selected as the input for the ADC by setting the MUX0 and MUX2 to 1. The ADCSRA register was set up to enable the ADC, enable auto trigger, enable interrupts and set the prescaler to 64. Global interrupts were enabled in this function using the sei instruction. The output voltage of the sharp IR sensor was found to have a range of 0 to 3 volts depending on the distance. The ADC voltage reference was set to 3.3 volts to more closely match the output of the IR sensor as opposed to the 5 volt default. This was accomplished using AREF as the voltage reference by connecting the 3.3 volt output of the microcontroller to AREF pin with a jumper wire. The LED brightness was controlled with PWM. PWM was set up in the PWMinit function. The clock was set up with no prescaler and using CTC mode. In this mode the OCR1A acts as the top value of the counter while the OCR1B is the value to be compared to. Interrupt service routines were used to change the duty cycle based on the ADC value passed into the duty variable and then by setting OCR1B compare value to duty.  The result of the program was a smooth fluctuation in the brightness of the LED based on the distance of a hand or object from the sensor.

The Wah circuit was combined with the microcontroller by inserting the LED and LDR into a heat-shrink tube in order to have the light passed to the LDR directly related to the LED without outside light interference. The resulting behavior of the LED based on hand position can be observed in the video above.

Infrared controlled Wah-Wah Schematic


The initial part of the project involved building a wah-wah circuit on breadboard in order to test its functionality. Through online research, a schematic of the Colorsound inductorless wah was discovered. This wah-wah circuit replaces the traditional wah inductor with a combination of only resistors, capacitors and a 2n5088 NPN transistor. The schematic was constructed on breadboard and tested with a flashlight in a dark room. As the flashlight was swept across the LDR the frequency response produced was the desired vocal wah-wah sound. After successful testing the circuit was  constructed and soldered onto Vero board consisting of strips of copper that are populated with the electrical components. This is an effective method to quickly prototype designs without having to order a custom PCB. The circuit is powered by a 9-volt DC adapter through a 2.1 mm DC jack. The design uses two quarter inch jacks as input and output for the circuit. The LDR was attached to the board with jumper wires to allow for flexibility with positioning. The input is connected to the guitar, while the output is connected to the amplifier.