Introduction: Lo-fi Arduino Guitar Pedal

Picture of Lo-fi Arduino Guitar Pedal

Bit crushing, rate reducing, weird noises: DIY 10-bit effects/guitar pedal with an Arduino for lo-fi DSP.

Check out the demo video on Vimeo.

Step 1: Materials

Picture of Materials


  • Arduino (Diecimila, or with auto-reset)
  • Soldering iron
  • Hot glue gun
  • Wire cutters
  • Drill press or dremel


  • Enclosure
  • Solder
  • Hot glue
  • Wire
  • Perf board
  • Audio jacks (I used 1/8") (x2)
  • Interface inputs, e.g.: 3 potentiometers
  • Interface outputs, e.g.: 3 LEDs and 3 150 ohm resistors
  • Resistors: 1 k, 10 k, 1.2 k (x2), 1.5 k, 390 k
  • Capacitors: 2.2 uF (x2)

Double the number of resistors and capacitors for stereo wiring.

Step 2: Preparing the Enclosure

Picture of Preparing the Enclosure

I used a "fast ethernet media converter" for my enclosure. It's just a box that happens to fit the Arduino, some interface elements, and two audio jacks. It's pretty sturdy metal, which is important for a pedal. As an added bonus: it has a hinge on the back, which makes it easy to open and close.

The only modifications I had to make to this enclosure were some holes for the three pots (using a drill press) and cutting out some plastic for the USB connector.

Step 3: Connecting the Components

Picture of Connecting the Components
Once the enclosure is prepared:

  • Situate the Arduino
  • Install any of your interface components, like pots or LEDs
  • Install your input and output jacks

Remember that the LEDs need resistors between them and the pins on the Arduino. I used 150 Ohm resistors.

We'll be modifying the analog reference value, so if you want to use any pots you have to connect them to the AREF pin instead of the usual 5V pin.

For the 1/8" connectors (or anything that isn't on the same panel of the enclosure as the Arduino) be sure to use flexible wires. Otherwise it will be hard to close the case and the joints might break or other connections might come loose.

Step 4: Normalize the Input and Output

Picture of Normalize the Input and Output


This is the only real "trick" when it comes to the hardware for this system. Audio happens as an AC signal from -1 V to +1 V, but the analog inputs on the Arduino run from 0 V (Ground) to some positive voltage called the analog reference (5 V by default). You can specify this positive voltage in code or with an external reference.

Since -1 V to +1 V is a 2 V range, we'll choose something smaller than 2 V for our analog reference value. It turns out 1.1 V is specified as a built in internal reference, which works out nicely.

From here we have to normalize the -1 V to +1 V as 0 V to 1.1 V. I did this using a resistor in series followed by a voltage divider circuit. A guitar cannot directly drive this circuit, it needs a preamp (like another pedal) to drive it. I'm sure you could add a transistor or op-amp preamp to the perf board so you could plug into the pedal directly.


For the output, we're going to be using PWM. With some low level hacks in software, you can get an 8-bit PWM running at 62kHz = 16 MHz / 28

There are some other methods for audio output on the Arduino. A good overview can be found at uC hobby. I got some great results from an R2R DAC, but considering it needs around 40 resistors for 10-bit stereo output, I decided against it. Instead I went with the weighted pins technique, which is kind of like a cross between standard PWM and a resistor ladder.

Building the Circuit

I built two of each circuit on one perf board. I had a ground strip down the center that helped for arranging things as neatly as possible. The first time I built the circuit, it was too tall and didn't fit in the enclosure, so I had to build it again.

When you have capacitors in series like this, they will cut off some of your low frequencies. WIth a 2.2 uF capacitor, it's low enough so it doesn't really affect sounds in our hearing range. The larger the value, the better; but capacitors tend to get physically larger as their value increases.

Step 5: Connect Remaining Components

Picture of Connect Remaining Components
Once your input and output circuits are made on your perf board, place it inside and start attaching all the wires that have yet to be attached.

  • The audio input goes into the input circuit, then into the Arduino's analog inputs
  • The pot taps go to the Arduino's analog inputs
  • Two LEDs go to PWM outputs, one goes to a digital output
  • Four PWM outputs go into the 8/2-bit weighted DAC circuit
  • The output of the weighted DAC circuit goes to the audio output

Step 6: Upload DSP Code

Picture of Upload DSP Code
Download the code and you'll find two folders. One is the basic DSP code, "ArduinoDSP", that you can use to make your own pedal. "GlitchPedal" is the one I used for this specific setup. At some point, Vimeo removed the per-group file hosting I was using to host the code. For better reference, see this code from Tony Ivanov or follow Randy's Instructable instead.


The includes in ArduinoDSP are useful for setting the proper PWM prescaling and analog input prescaling values. They turn pins 3 and 11 into the left outputs (8 and 2 bits respectively) and 5 and 6 into the right outputs, using Fast PWM settings with no prescaling so the PWM is as fast as possible. The ADC is also set to a low prescale value, 32, and the analog reference is set to 1.1 V (the internal reference).

To modify the basic ArduinoDSP code, just insert your own code to modify the variable "input" between the line "short input = analogRead(left);" and "output(left, input);".


The code I've already written does a few things. The LEDs provide visual feedback about the knob positions and input level, and the pots control settings for the DSP happening inside the microcontroller. The first pot controls the mode, the second controls a parameter of that mode, and the third controls an effective sample rate. The modes include:

  • Bitcrush: bit shift the input to the right and then to the left, chopping off N bits.
  • Bitshift : shift the input to the left, leading to a weird effect for the first few values and then eventually noise (i.e., the "dithering bits").
  • Overdrive: Multiply the input by a float from 1-20.
  • Binary impulse response: do various binary operations on the input and the last result (XOR, NOR, XNOR, NAND...)

Step 7: Variations and Notes


  • Add an RC low pass filter on the output with selectable corner frequency
  • Weirder modes: bit remapping? bit rotation?
  • Repeat last N samples? This is heavily limited by the ATmega's RAM.
  • Run off 9V wall adapter instead of USB power
  • 6 8-bit outputs running into a 5.1 speaker system?
  • Use an Arduino mini for a super small pedal
  • Patch bay as an interface?
  • Input volume knob


Because the ADC is really the primary bottleneck in this setup, any alternative ADC methods could be really helpful (there's a great reference of alternatives here, though ultimately it'd be easiest to use a dedicated ADC chip via SPI instead of implementing these manually). As the system is now, it's best to stick to mono inputs if you want to retain fairly accurate output.

Thanks to Andrew Armenia for help with input normalization, Dane Kouttron for explaining a few things about PWM on ATmega168s, James Miglietta for assuring me that guitar pedals run at normal audio voltages, and Blair Neal for wanting a bitcrusher/sample rate reducer in the first place.


Another great technique using an audio buffer and doing "real" effects has been demoed by Martin Nawrath.

I think one of the biggest benefits of Martin's approach is that he has an interrupt for the ADC sampling. Normally, the ADC is called in a blocking way using analogRead() (i.e., the code doesn't go past analogRead() until the conversion is made). Martin's technique frees up the code to do other things while the ADC is being done.


BrunoR7 (author)2015-09-09

dsmith139 (author)2015-08-09

How would I create this with 1/4 audio jacks?

nuelma (author)2015-05-18

I played guitar and I think a great invention

benrosenbach (author)2015-05-12

I'm having trouble getting sound from this build. I wanted to test the voltage on the input circuit to make sure I was getting values that looked righht, so I wrote a little dummy test to output my value of A0 in the serial console after going through the input circuit (I couldn't find my voltmeter!)

Oddly enough, when no audio signal is coming in, I keep getting values between 405 and 409. Even stranger, when I connect the input to ground, I still get the same values. When I have a strong audio signal coming in, I get values between 405 and 620.

The only thing I can think of is that I had to use a lower value cap (.1uF instead of 2.2uF) because it's all I had, but I thought that would just affect filtering. Otherwise I'm not sure what's going on. I've double checked the build of the circuit and resistor values. Any help would be appreciated!

Nevermind, I realized I was a fool and forgot how voltage dividers worked! When I replaced the cap with the proper value 2.2uF I got a ground value of 495, which I realized is close to 512, which is where it's supposed to be since it's a DC offset audio signal, so it's going to oscillate around the middle of the voltage range. When I turned my volume all the way up, I got values between 13 and 1020, just as I should!

Still no sound out of the other end though, but I haven't tested everything yet.

arduinolover (author)2012-12-02

The folder I downloaded is named "Arduino_Guitar_Pedal" including five files. There is not any GlitchPedal file. May you send me the link to the Glitchpedal code? I am doing something wrong..

Did you ever get the proper code? I'd also like to see it!

nimmis (author)2013-07-17

@CyrilHaumont, could not get reply working, so here are the answer:

To make it work on newer IDE (>= 1.0) you need to replace all "Wprogram.h" and "Wconstants.h" with "Arduino.h"

CyrilHaumont (author)2013-06-09

I'm doing a new version of your guitar pedal. But i have just one problem, I can't find any Wprogram.h or Wconstants.h...
And i read all comments (randolfo's too), it seems nobody has this kind of problem ?
can it be from my version of arduino ide ?

arduinolover (author)2012-11-23

Hi there,
I am about to start building this specific project but I would like to know how I am going to upload the code to my Arduino and make it run. Where can I find the GlitchPedal code and do I have to load more code (libraries) to run it? I am noobie as you understood.. Thanks a lot!!

there are no other libraries to run, just the GlitchPedal code. but i recommend you follow this new tutorial by randy

purebluearth (author)2012-02-21

could someone tell me why the compiler tells me that analogWrite is not defined within scope?

stvincent (author)purebluearth2012-03-01

I'm a total arduino/electronics noob, but I think that some of the function libraries got migrated to a new location in some core revision to the arduino libraries.

Basically, in dsp.cpp, replace

#include "WProgram.h"



And then make the same swap in timers.cpp with

#include "WConstants.h"

The code at least compiled for me. Of course I am still having problems with the actual build. All I'm getting is a very faint square wave buzz that modulates with knobc.

Why did I think this was going to be simple?

DJsoundestroyer (author)2012-01-02

hey man! this looks truly awesome. any chance of a video or mp3? also, how would keyboards/synthesizers/drum machines work through this? sweet project!

check out the video on vimeo
nexekho (author)2011-09-16

I got the asynchronous analog read you discussed working, though not using interrupts but a standard loop. Vastly increases my sample rate. Ported the chorus/flanger to it.

nexekho (author)2011-09-15

Wrote a chorus!
Pot 1 is chorus speed. Define LINEARITY for experimental sine wave LFO using pot 2 to blend between linear or sine (it has problems) and pin 13 which has a LED on most devices will display the rate visually.
Works really nicely on low values, with a subtle flange on high values. Can also do many silly noises with the chorus set really fast.

nexekho (author)nexekho2011-09-15

Site note: buffers take up quite a bit of memory, might need to go mono for a Mega 168.

nexekho (author)nexekho2011-09-15

Sounds MUCH BETTER in mono due to higher sample rate.

nexekho (author)nexekho2011-09-16

Added a depth control that changes how far it sweeps. Very useful for getting good flange effects.

LukaR (author)2010-09-25

Is there a way to add an on/off switch to the circuit (like the one on the picture), making a stomp box out of this?

nexekho (author)LukaR2011-09-15

You can make a bypass with a SPDT which will select either the Arduino output or the guitar input, but it will likely "suck tone" and as such you will need a DPDT to isolate the Arduino input as well.

Blip-Blip-Duino (author)LukaR2011-08-18

Yes it would be possible, in you can see a wiring diagram for these switches. It would have to be a DPDT or 3PDT.

kylemcdonald (author)LukaR2010-09-26

I don't usually make guitar pedals so I'm not familiar with the way that switch is wired. If it actually toggles between two sources, you just need to wire the "clean" input directly to one side of the switch, and the distorted output to the other.

On the other hand, if it is a momentary switch you'll need to wire it to an interrupt pin on the Arduino and modify the code to watch for that interrupt, not applying any effects when the toggle is on.

I'm sure there are also plenty of schematics out there for making toggle boxes with these switches, in which case you would just wire your clean signal to one input and the distorted signal to the other.

nexekho (author)2011-09-14

Hey, I just built one of these on perfboard, made a mistake on the inputs (biasing with A7 rather than 5V, will correct in the morning) and while almost everything works (the dials work, etc.) I can't get a sound wave out. If I just take a standard flashing light example script and tell it to whack a PWM to pin 3, it outputs a very loud square wave. Using your code, nothing is output. This is my first Arduino project. I'm using a Nano but it's a Mega328P Nano which should work right?

nexekho (author)nexekho2011-09-14

I've fixed it now. It was an issue with the timer registers. Thanks for the design.

I've attached some photos of my custom build.  Small size was a priority here so I built the output filters under the Arduino itself which was a fun challenge.

kylemcdonald (author)nexekho2011-09-14

wow! awesome, and congratulations on your first arduino project. glad everything worked out. your design is super compact, it looks great :)

nexekho (author)kylemcdonald2011-09-15

Made some code changes and got it as good as it'll ever be in terms of sound cleanliness. Using 10-bit in, 16-bit out, and a prescale of 8.
(note: I'm using a POD as a preamp and distortion, the Arduino is just clean passthrough at the moment and then a Valvecaster post-amp before going into my PC's line in)
I'm finding that using a tone dial to roll off the highs makes a far cleaner sound.

nexekho (author)nexekho2011-09-14

(also note: I'm not being silly, I'm trying to output a 100Hz triangle wave using your code instead of passthroughing the input ;])

nexekho (author)nexekho2011-09-14

Also, the schematic describes a high-pass-filter for the output. Is that right? It feels like it should be low pass.

Or2 (author)2011-08-26

I'm new the the arduino scene, is Diecimila the same as Duemilanove ?

kylemcdonald (author)2011-07-10

using the two 190k resistors in series against the 1.5k gives a ratio of 253 which is totally acceptable. the resistor manufacturing tolerance will probably be the bigger error. good luck!

yesiam (author)2011-02-04

This looks great! I was wondering if this can be used with a synth or laptop audio. And if not, if it can be modified to do so..

kylemcdonald (author)yesiam2011-02-04

anything you can plug into a guitar pedal should work fine. and definitely laptop output, i primarily used my laptop for testing this while i developed it.

j03tv (author)2010-08-29


kylemcdonald (author)2010-04-29

No, they're just giving you a value between 0 and 5V.

missingmax (author)2010-04-26

I see you used ceramic and electrolytic caps. Which one works better? 
Also, what would be the polarity if you used the electrolytics in your schematic?

kylemcdonald (author)missingmax2010-04-26

I didn't evaluate ceramic vs electrolytic for their "sound" really, so I can't say which one is "better". You'll have to try both out and let me know if you hear a difference!

I vaguely remember, on the outputs, the electrolytic caps facing the output. But again, you should try it both ways -- this was two years ago now and I have been writing a lot more code that making circuits since then :)

loneguitarist (author)2010-04-20

 Any chance you could post a picture with the other side of the perfboard circuit for the DAC? I'd like to have a go at this project but am having a little trouble with this stage.

Someone should make an audio input/output sheild for the Duemilanove with all the DAC on board for projects like this!

Sorry, I don't have this pedal any more, I made it for a friend!

If I remember correctly, the perf board wasn't connected on the back and everything was manually soldered. So hopefully the diagrams/schematics on this page will explain anything missing from the pictures. The pictures were meant more as a layout guide for fitting the components in a smaller space.

jsd78 (author)2010-04-08

I was wondering what kind of preamp is necessary. I don't own a tuner that acts as a preamp (more like a filter). Is it possible to build a preamp that's not too difficult?

kylemcdonald (author)jsd782010-04-08

A preamp can be as simple as an opamp. But there are a ton of DIY guitar preamp designs, here's one of the first links that popped up on Google.

larsby (author)2010-03-11

Hi there,

love your work, I have one question about this though, the r1 on the in-part, what is it good for, why do you need it?

kylemcdonald (author)larsby2010-03-11

Hi Larsby,

The r1 acts to "scale" the incoming signal. I generally think in terms of software rather than hardware, so you can imagine the chain on the input acting like this:

- r1 divides the signal (scales it down slightly)
- c1 centers the signal around zero (removes the DC component)
- r2 and r3 add a constant DC component back in -- shifting the signal up

mashedmeat (author)2009-11-11

Hi guys, great work!

I'm trying to get the basic code working, but I can't seem to get all the PWM pins going! inputs are working fine, as far as I can tell, but only pin 3 is PWM'ing. 5/6/11 do nothing! I'm just using the basic aduino dsp code right out of the box.

When I edit setupIO() in DSP.cpp to say:

  waveformGenerationMode(11, fastPWM);
  timerPrescale(11, 1);
  analogWrite(11, 0);

11 seems to work fine. (though it's just noise, because i'm not using accurate resistors...)

I can't get 5/6 to work at all.

Any ideas?

Patches.tgz (author)mashedmeat2010-01-31

I had the same problem, I got around it by removing the "analogWrite"s from:

void setupIO() {
  // prepare left
  waveformGenerationMode(3, phaseCorrect);
  timerPrescale(3, 1);
//  analogWrite(3, 0);
  // prepare right
  waveformGenerationMode(5, phaseCorrect);
  timerPrescale(5, 1);
//  analogWrite(5, 0);
//  analogWrite(6, 0);
  // faster input

And also fiddling around with the timer registers:

void waveformGenerationMode(int pin, int type) {
  int timer = getTimer(pin);
  int wgm = type == phaseCorrect ? B001 : B011;
  if(timer == 0) {
    TCCR0B &= ~(B1 << 3); // clear WGM02
    TCCR0A &= ~B11; // clear WGM01 and WGM00
    TCCR0A |= wgm | B11110000; // set WGM01 and WGM00, Compare on Match
  } else if(timer == 2) {
    TCCR2B &= ~(B1 << 3); // clear WGM23
    TCCR2A &= ~B11; // clear WGM21 and WGM20
    TCCR2A |= wgm | B11110000; // set WGM21 and WGM20, Compare on Match

mashedmeat (author)Patches.tgz2010-02-01

Thanks man!

I'll try that and let you know how it goes.

kylemcdonald (author)mashedmeat2009-11-23

I recommend trying an earlier version of the Arduino IDE (maybe revision 15). I haven't tested this with the most recent versions, and this has some pretty low level stuff that might have been affected by changes.

mashedmeat (author)kylemcdonald2009-11-30

Thanks man, I tried versions 13 - 15, but no go.

Anyone else had this problem? I'm just using a standard Arduino Duemianove with an ATmega328P-PU.
I've tried both mac/windows. I'm just using the example code. (the Arduino DSP one, not the Glitch Pedal. Though, that has the same problems...) 

Thanks a million for all the help!
 - Loren

kylemcdonald (author)mashedmeat2009-12-04

I'm stuck on this one. There might be some difference I haven't run across yet between the 168 and 328 registers, but I'm pretty sure the only difference is memory.

I'm working with someone on making a more sturdy and varied version of this pedal that you could throw into a bag with your other pedals. I'll be rewriting the code completely, but there isn't a clear deadline... so for now I recommend asking on the Arduino forums. Sorry I can't be more helpful!

About This Instructable




More by kylemcdonald:Structured Light 3D ScanningNandhopper 1-Bit Noise SynthLo-fi Arduino Guitar Pedal
Add instructable to: