Maker Pro
Arduino

How to Make a Programmable Guitar Pedal With Arduino

August 28, 2016 by Ray Jay From ElectroSmash
Share
banner

Use an Arduino to make your own programmable guitar pedal and add effects like distortion, fuzz, and more to your music.

This DIY Guitar Pedal project is for guitarists, hackers, and programmers that want to learn about digital signal processing, effects, synthesizers, and experiment without deep knowledge of DSP, electronics, or hardcore programming. pedalSHIELD UNO is a lo-fi, programmable guitar pedal that works with the Arduino UNO/Genuino UNO boards and is Open Source & Open Hardware. Learn to create your own programmable DIY Guitar Pedal and add effects such as distortion, fuzz, and more to your music. You can program your own effects in C/C++ or even use the ready-to-play effects from the ElectroSmash forum we have set up to support this project.

You can either get the PCB for this project on the ElectroSmash store or you can make your own on a breadboard by following the schematics in this tutorial. Check out this demo video of the Arduino DIY Guitar Pedal:

Required Materials

Reference Qty Value Description Part Reference
Capacitors   
C5,C2, C7, C8, C9 5 6.8n ceramic cap SR211C682MARTR1
C3, C6, C10 3 4.7u electrolytic cap ECE-A1EKA4R7
C1, C11 2 100n ceramic cap K104K10X7RF5UH5
C4 1 270p ceramic cap D271K20Y5PH63L6R
Resistors    
R12,R13, R10, R9, R6, R4, R3 7 4.7K Resistor, 1%,1/4W MFR-25FRF52-4K7
R5, R7, R8, 3 100K Resistor, 1%,1/4W MFR-25FRF52-100K
R1, R2 2 1M Resistor, 1%,1/4W MFR-25FRF52-1M
R11 1 1M2 Resistor, 1%,1/4W MFR-25FRF52-1M2
Others    
RV1 1 500K resistor trimmer 3319W-1-504
D1 1 Led 3mm blue blue led 3mm SSL-LX3044USBC
U1 1 TL972 pdip-8 op-amp rail-to-rail  TL972
IC Socket 1 dip 8 socket socket dor dip8 1-2199298-2
SW1 1 3DPT footswitch 3PDT footsitch 107-SF17020F-32-21RL
SW2 1 Toggle switch SPDT toogle switch 612-100-A1111
SW3, SW4 2 Pushbutton off-on pushbutton 103-1013-EVX
Conn1,2,3,4 1 40 pin header 2.54 pitch pin header
J1, J2 2 1/4 Jack audio stereo 6.35mm jack NMJ6HCD2


How Does the Arduino Guitar Pedal Work?

The system consists of three stages:

  • The Input Stage: Amplifies and filters the guitar signal making it ready for the Arduino Uno ADC (Analog do Digital Converter).

  • Arduino Board: Takes the digitalized waveform from the ADC and does all the Digital Signal Processing (DSP) creating effects (distortion, fuzz, volume, metronome...).

  • The Output Stage: Once the new waveform is created, the signal is taken from the Arduino digital outputs (two PWMs combined) and prepared to be sent to the next pedal or the guitar amp.
This is how you connect the system to your amp and guitar:

Building the Hardware

Schematics from ElectroSmash.com

You can either get our PCB to make the DIY Guitar Pedal here and follow this guide to solder the board, or you can build your own hardware on a breadboard. The following higher level schematic explains the connections required for setting it up and the subsequent magnified individual parts explain it in detail:

The functionality is simple; one op-amp will prepare the signal to be digitized and one opamp will recover the signal from the Arduino UNO microcontroller. One ADC is used to read the guitar signal and two PWM signals are used to generate the output signal.

  • Input Stage: The guitar signal is amplified for better acquisition by the first op-amp which follows the MicroAmp guitar pedal design. The trimmer VR1 adjusts the gain of this amplifier from 1 to 21, so the guitar level can be optimized. The signal pass through 3 low pass filters (formed by R3&C2, R5&C4, R6&C5) that will remove the excess of high harmonics that can create aliasing during the ADC signal acquisition (fc=5KHz).

Output Stage: Uses a Sallen & Key 3rd order low pass filter which removes harmonics above 5KHz. Two PWM signals are used in parallel improving the bit resolution (2x8bits). If you want to read more about the PWM audio generation read the forum topic dedicated to the PWM configuration options. There is fantastic research done by OpenMusic Labs referring to this topic.

Power Supply: The pedal uses the +5V from Arduino Uno to feed the rail-to-rail operational amplifier and achieve design simplicity and maximum signal swing without clipping. A resistor divider R7&R8 generates 2.5V for virtual ground and the cap C6 remove ripple on the power line.

User Interface: The player can use 2 configurable push-buttons, 1 configurable toggle switch, 3PDT true-bypass footswitch, and a programmable LED.

Arduino Uno Connectors: Pin headers will link the shield with the Arduino Uno transferring the signals and power supply.

Check out this higher level picture of all the interfaces and connectors:

Programming the DIY Guitar Pedal

This project is built using free/open source software and is easy to program. The DIY Guitar Pedal is programmed in C/C++ using the standard Arduino functions and can be hosted on platforms like Linux, Windows, and Mac. Basic knowledge of C is needed. The best way to illustrate how to program it is showing a simple example pedal with a Volume/Booster effect. The block diagram for this software looks like this:

Arduino Code for the DIY Guitar Pedal

// CC-by-www.Electrosmash.com
// Based on OpenMusicLabs previous works.
// pedalshield_uno_booster.ino: pressing the pushbutton_1 or 2 turns the volume up or down.

//defining harware resources.
#define LED 13
#define FOOTSWITCH 12
#define TOGGLE 2
#define PUSHBUTTON_1 A5
#define PUSHBUTTON_2 A4

//defining the output PWM parameters
#define PWM_FREQ 0x00FF // pwm frequency - 31.3KHz
#define PWM_MODE 0 // Fast (1) or Phase Correct (0)
#define PWM_QTY 2 // 2 PWMs in parallel

//other variables
int input, vol_variable=512;
int counter=0;
unsigned int ADC_low, ADC_high;

void setup() { //setup IO - inputs/outputs pins configurations and pull-ups
pinMode(FOOTSWITCH, INPUT_PULLUP);
pinMode(TOGGLE, INPUT_PULLUP);
pinMode(PUSHBUTTON_1, INPUT_PULLUP);
pinMode(PUSHBUTTON_2, INPUT_PULLUP);
pinMode(LED, OUTPUT);

// setup ADC- configured to be reading automatically the hole time.
ADMUX = 0x60; // left adjust, adc0, internal vcc
ADCSRA = 0xe5; // turn on adc, ck/32, auto trigger
ADCSRB = 0x07; // t1 capture for trigger
DIDR0 = 0x01; // turn off digital inputs for adc0

// setup PWM - for more info about this config check the forum.
TCCR1A = (((PWM_QTY - 1) << 5) | 0x80 | (PWM_MODE << 1)); //
TCCR1B = ((PWM_MODE << 3) | 0x11); // ck/1 TIMSK1 = 0x20; // interrupt on capture interrupt ICR1H = (PWM_FREQ >> 8);
ICR1L = (PWM_FREQ & 0xff);
DDRB |= ((PWM_QTY << 1) | 0x02); // turn on outputs
sei(); // turn on interrupts - not really necessary with arduino
}

void loop()
{
//Turn on the LED if the effect is ON.
if (digitalRead(FOOTSWITCH)) digitalWrite(LED, HIGH);
else  digitalWrite(LED, LOW);
//nothing more here, all happens in the Timer 1 interruption.
}

ISR(TIMER1_CAPT_vect) //Timer 1 interruption.
{
// read the ADC input signal data: 2 bytes Low and High.
ADC_low = ADCL; // Low byte need to be fetched first
ADC_high = ADCH;
//construct the input sumple summing the ADC low and high byte.
input = ((ADC_high << 8) | ADC_low) + 0x8000; // make a signed 16b value

// The push-buttons are checked now:
counter++; //to save resources, the push-buttons are checked every 100 times.
if(counter==100)
{
counter=0;
if (!digitalRead(PUSHBUTTON_1)) {
if (vol_variable<1024) vol_variable=vol_variable+1; //increase the vol } if (!digitalRead(PUSHBUTTON_2)) { if (vol_variable>0) vol_variable=vol_variable-1; //decrease vol
}
}

//the amplitude of the signal is modified following the vol_variableusing the Arduino map fucntion
input = map(input, 0, 1024, 0, vol_variable);

//write the PWM output signal
OCR1AL = ((input + 0x8000) >> 8); // convert to unsigned, send out high byte
OCR1BL = input; // send out low byte
}

Copy this code into your Arduino IDE and upload it to bring your DIY Guitar Pedal to life! Try hacking and improvising to add more effects to this project.

Related Content

Comments


You May Also Like