Programmable Arduino DIY Guitar Pedal Tutorial

From our STAR Maker: Ray Jay from ElectroSmash 

This DIY Guitar Pedal project is  aimed for guitarists, hackers and programmers that want to learn about digital signal processing, effects, synthesizers and experiment without deep knowledge on DSP, electronics or hardcore programming. pedalSHIELD UNO is a lo-fi programmable guitar pedal that works with the Arduino UNO / Genuino UNO Board 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 online forum we have set up to support this project.

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

What are the stuff required to make this project?

Reference Qty Value Description Mouser 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
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
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 it work?

arduino DIY guitar pedalThe 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: It 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.

And this is how you connect the system to your amp and guitar:arduino DIY guitar pedal

STEP 1: Building the hardware

arduino DIY guitar pedal

Image courtesy: ElectroSmash.com

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

The functionality is simple; 1 op-amp will prepare the signal to be digitized and also 1 opamp will recover the signal from the Arduino UNO microcontroller. One ADCs 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).arduino DIY guitar pedal

 

 

 

 

 

 

 

 

 

 

  • 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 a fantastic research done by OpenMusic Labs referring to this topic.arduino DIY guitar pedal
  • 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.arduino DIY guitar pedal
  • User Interface: The player can use 2 configurable push-buttons, 1 configurable toggle switch, 3PDT true-bypass footswitch and a programmable LED.arduino DIY guitar pedal
  • Arduino Uno Connectors: pin headers will link the shield with Arduino Uno transferring the signals and power supply.arduino DIY guitar pedal

Also check out this higher level picture of all the interfaces and connectors:Arduino DIY guitar pedal

STEP 2: 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/Mac. Basic knowledge of C is needed. The best way to illustrate how to program it is showing an simple example pedal with a Volume/Booster effect. The block diagram for this software looks like this:Arduino DIY guitar pedal

The Arduino code for it is this:

// 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
}

 

Now 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.

Arduino DIY Guitar Pedal

I have also summed up all the resources for this project as so:

  1. Order the PCB here.
  2. Get the schematic pdf here.
  3. Forum for troubleshooting here.
  4. Guide for soldering the PCB here.
Ray Jay ElectroSmash

From our STAR Maker: Ray Jay from ElectroSmash

 

-Submitted by Ray Jay from Team ElectroSmash:
Smashing audio electronics since MMXIII

Recommended Posts
Comments
  • john
    Reply

    Hello gays its john watson.I am here for give you a great way how can you buy a guitar from online.

    Which is too much best for all of online market.You can visit here

Leave a Comment

− 3 = 1

Start typing and press Enter to search