AVR based Guitar Distortion Pedal
An effect pedal is a device which can alter the sound of a music instrument that comes in a format of a pedal or a stomp box. Guitarists normally arranges several pedals in what is called a "pedal board." Each of these analog pedals activate different sound effects. At the same time multi effect digital guitar pedals are also present in the market. Being a guitarist, I have been using some guitar pedals such as DS -1 distortion by BOSS, SD-1 super drive by BOSS etc. With that experience I tried to build a pedal that is capable of producing the distortion effect my self.
What is distortion?
The word distortion refers to any modification of wave form of a signal, but in music it is used to refer to nonlinear distortion (excluding filters) and particularly to the introduction of new frequencies by memoryless nonlinearities. Clipping is a non-linear process that produces frequencies not originally present in the audio signal. These frequencies can be harmonic overtones, meaning they are whole number multiples of one of the signal's original frequencies, or "inharmonic", resulting from general intermodulation distortion.
"Hard clipping" flattens peaks abruptly, resulting in higher power in higher harmonics. As clipping increases a tone input progressively begins to resemble a square wave, which has odd number harmonics. This is generally described as sounding "harsh".
The design
When I was doing the background research on the project I came across several other projects that other people have done on guitar pedals. Out of them, "Electrosmash pedalshield uno" which is an open source project based on arduino platform and "Homebrew digital effects pedal" which is a PIC micro controller based project particularly influenced me. So I designed a circuit using AVR ATmega32A microcontroller and the coding was done in C.
The first step was to understand the signal output of the guitar. So using a digital oscilloscope I tried to find what type of a signal does an electric guitar outputs. It was found out that the signal is an analog signal with a varying amplitude between 100mV and 1V with some noise. So it was important to use some high-pass filters to get rid of the noise. Then the analog signal had to be converted to a digital inside the microcontroller to do the processing of the signal. Since ATmega32A runs at 5V it was better to amplify the signal before feeding into the microcontroller. An operational amplifier was used to do that. When selecting an op amp there were two things to be considered. Because of the dynamic range of the signal it has to have a rail-to-rail operation. And the other thing was supply voltage below 5V. TL972 op amp from texas intruments was selected after consideration. So after the digital modification the signal leaves the micro controller and go through another circuit to set the signal back to its original voltage range.
Since the user should be able to switch on and off the effect when desired a 3PDT switch was used. Its a switch with triple pole- double throw setting which is capable of handing two separate circuits. So this allows the input signal to bypass the main circuit when the effect is switched off.
The powering of the system was done by a standard ac to dc adapter with a 15V dc output. So another circuit was designed using the 7805 power regulator to power the system with 5V.
The maximum inbuilt oscillator of the Atmega32A is 8MHz. But it was important to run the microcontroller at least at 16MHz to ensure the better quality of the sound. Therefore a 16MHz crystal oscillator was used.
The code
The basic step of the code was to convert the Analog signal to a digital one. This was done by the ADC inside the microcontroller. Then the modulation was done in such a way that if the ADC value is higher than a threshold then you pass on the threshold value, if the ADC value is less than a particular value then the original value will be passed as the output. And this threshold value can be controlled using two push buttons generating interrupts. Since there is no DAC ( Digital To Analog converter) inside the microcontroller the output was taken out using PWM (Pulse Width Modulation).
The physical design
As a test run I re created the "Electrosmash pedalshield uno" in arduino. Since it was successful I went onto implement it on AVR and using the Atmega32A. So a PCB was designed using "Eagle" and it was created on a copper board using basic techniques. Once the soldering was done the circuits was fitted inside a plastic box which I bought from an electronic shop. The necessary holes were drilled using the university workshop. And it could provide a decent distortion effect!
Click here for the code, project report, user manual, presentation and the PCB layouts.
What is distortion?
The word distortion refers to any modification of wave form of a signal, but in music it is used to refer to nonlinear distortion (excluding filters) and particularly to the introduction of new frequencies by memoryless nonlinearities. Clipping is a non-linear process that produces frequencies not originally present in the audio signal. These frequencies can be harmonic overtones, meaning they are whole number multiples of one of the signal's original frequencies, or "inharmonic", resulting from general intermodulation distortion.
"Soft clipping" gradually flattens the peaks of a signal which creates a number of higher harmonics which share a harmonic relationship with the original tone.
![]() |
| Hard clipping and soft clipping |
When I was doing the background research on the project I came across several other projects that other people have done on guitar pedals. Out of them, "Electrosmash pedalshield uno" which is an open source project based on arduino platform and "Homebrew digital effects pedal" which is a PIC micro controller based project particularly influenced me. So I designed a circuit using AVR ATmega32A microcontroller and the coding was done in C.
![]() |
| The design |
The first step was to understand the signal output of the guitar. So using a digital oscilloscope I tried to find what type of a signal does an electric guitar outputs. It was found out that the signal is an analog signal with a varying amplitude between 100mV and 1V with some noise. So it was important to use some high-pass filters to get rid of the noise. Then the analog signal had to be converted to a digital inside the microcontroller to do the processing of the signal. Since ATmega32A runs at 5V it was better to amplify the signal before feeding into the microcontroller. An operational amplifier was used to do that. When selecting an op amp there were two things to be considered. Because of the dynamic range of the signal it has to have a rail-to-rail operation. And the other thing was supply voltage below 5V. TL972 op amp from texas intruments was selected after consideration. So after the digital modification the signal leaves the micro controller and go through another circuit to set the signal back to its original voltage range.
Since the user should be able to switch on and off the effect when desired a 3PDT switch was used. Its a switch with triple pole- double throw setting which is capable of handing two separate circuits. So this allows the input signal to bypass the main circuit when the effect is switched off.
The powering of the system was done by a standard ac to dc adapter with a 15V dc output. So another circuit was designed using the 7805 power regulator to power the system with 5V.
The maximum inbuilt oscillator of the Atmega32A is 8MHz. But it was important to run the microcontroller at least at 16MHz to ensure the better quality of the sound. Therefore a 16MHz crystal oscillator was used.
![]() |
| The circuit |
The code
The basic step of the code was to convert the Analog signal to a digital one. This was done by the ADC inside the microcontroller. Then the modulation was done in such a way that if the ADC value is higher than a threshold then you pass on the threshold value, if the ADC value is less than a particular value then the original value will be passed as the output. And this threshold value can be controlled using two push buttons generating interrupts. Since there is no DAC ( Digital To Analog converter) inside the microcontroller the output was taken out using PWM (Pulse Width Modulation).
The physical design
As a test run I re created the "Electrosmash pedalshield uno" in arduino. Since it was successful I went onto implement it on AVR and using the Atmega32A. So a PCB was designed using "Eagle" and it was created on a copper board using basic techniques. Once the soldering was done the circuits was fitted inside a plastic box which I bought from an electronic shop. The necessary holes were drilled using the university workshop. And it could provide a decent distortion effect!
Click here for the code, project report, user manual, presentation and the PCB layouts.







No comments:
Post a Comment