Introduction: Homebrew Digital Effects Pedal
Hi, my name is Colin. I am an avid guitarist, and I am always looking for cool new sounds. I'm a big fan of the guitarist Paul Gilbert, and I heard him play this crazy effect in one of his songs, so I decided I would try to emulate it. The result was a very long endeavor, but in the end a successful one.
I have created a digital loop pedal. The pedal itself is based upon the PIC16F877 microcontroller, and is complete with 256kb of RAM for storing sound. The unit achieves true bypass with the help of a relay, and runs on a standard 9V power supply.
If you want to build a pedal like this, be warned- it is a daunting task. The complexity of this project reached the upper limit of what my brain can autoroute on a prototyping board, and was very frustrating many times when it didn't work as planned.
In the end however, I learned a lot. I think this is a great project to try, but only try if you are really dedicated. For those interested, I would suggest you design your own, using mine as a template to know what works and what doesn't, rather than copying directly- though if you wish to copy, you are more than welcome.
Step 1: Audio-only Demo
This is an audio-only demo I recorded.
Step 2: Materials
I used a number of ICs in the construction of this project, they are listed below.
- PIC16F877a with 20MHz oscillator
- 23k256 RAM operating at 20MHz, interfaced via three-wire SPI
- A standard 9V single throw relay (though I recommend double throw, they are more useful)
- IRFD120 N-channel MOSFET for powering the relay
- LM358 operational amplifier
- 1 Mohm trim pot (for mixing ADC and unprocessed guitar when the pedal is not in "kill" mode)
- a bunch of 10k and 20k ohm resistors for the DAC
- 4 switches
- Aluminum enclosure
- Two LEDs
- 3 10k potentiometers
- lots and lots of stranded-core wire
- Guitar audio jacks
- Barrel plug socket for DC adapter
Resistances and capacitances are generally labeled on the schematic in the next step.
Step 3: Schematic, Explanations
This section addresses the circuits behind the project.
Explanation:
When the circuit is powered off, the relay is disengaged, and the guitar signal comes directly through the pedal, truly bypassed.
When the circuit is powered on, the relay remains disengaged and the signal is nearly fully bypassed, with most of the signal coming directly to the output, but some part of it is amplified through the op-amp (with gain set by the "gain" knob) and sent to the PIC for ADC processing.
When the system goes into "record" mode, the ADC values are transmitted to the 23k256 for temporary storage using the "continuous write" mode, overwriting previous data if there is any there.
When the system switches back into playback mode, the relay is engaged. Audio from the guitar gets transmitted through the amplifier if the "byp/kill" switch is in "byp" mode, otherwise it is silenced. Data is rapidly read from the 23k256 and outputted to the DAC. The resulting signal needs no amplification and is directly mixed through the trim potentiometer to the output of the pedal.
The values of the potentiometers are read continuously by ADC channels on the PIC.
Step 4: Code, Explanations
The entire purpose of this pedal is to record a short segment of sound and then play it back in a loop continuously, until the foot-switch is pressed again.
This pedal has two recording modes and two playback modes.
Recording:
"Loop" mode
In this mode, a guitarist will hit the foot-switch to begin recording, play a riff, then hit the switch again to stop playback. In this way, a guitarist can define the length of a recording during the recording process, allowing for live/dynamic loop playback.
"Burst" mode
In this mode, the guitarist defines the recording length via a knob. When ready, the foot-switch is pressed to initiate recording, which continues until the time defined by the knob is elapsed. This mode is mostly targeted at extremely short recording lengths, which can make crazy alien or robot sounds.
Playback:
"Bypassed" mode
In bypassed mode, the guitarist can play along with his own recording. When a recording is playing back, the live guitar signal is mixed in with the recorded one, which allows for interesting dynamic playing.
"Kill" mode
In "kill" mode, the signal from the guitar is killed and not mixed into the output, which allows the guitarist to adjust the pitch shift or do whatever else without worrying about their guitar making noise during playback.
Attachments
Step 5: Key Insights
I learned a lot during the course of this project. In a lot of ways, the design process was comprised of trial and error. My hope in publishing this online is that other people will learn from and build upon what I have figured out over the course of this project.
When to use proto-board and when to use PCB:
This schematic was the upper limit of complexity I am personally capable of autorouting with my brain while soldering. When circuits get complicated enough to require multiple pages of schematics, pages of diagrams, and ages of experimentation, it's probably worth it to create a PCB.
The smartest idea would have been to design a PCB and then use surface mount components. The DIP ICs with sockets barely fit inside the container- I had to dremel parts of the aluminum case away to fit all the components! Needless to say it was a tight squeeze.
Digital to Analog Converters:
I discovered that building your own DAC can work well, even with as few as 8 bits. Initially I bought a DAC IC, but it needed complicated biasing circuits, so I built one with a bunch of resistors, following the model shown here. Individual results may vary, but I played reasonably high quality sound from my iPod through it, and it fared well. Not the highest quality audio you've ever heard, but it represents the sound in a listenable manner.
RAM:
RAM is a very good way of storing and retrieving random access data quickly. I bought 23k256 20MHz SPI-interfaced RAM, totaling 256kb, which is 32kB. This ram runs off of 3V, so I ran all digital logic at 3V. Unfortunately, my PIC could only be programmed at 5V, which resulted in the accidental destruction of a few RAM chips. Good thing they are cheap!
Relays:
Always buy double-throw relays. When you need to solve a problem with a circuit, a lot of times it can be done if you have a double throw relay!
Op-amps/amplification circuitry
I had a lot of problems with my amplification circuitry. In the end, put capacitors everywhere you can anywhere you are biasing things, and separate biased supplies if you want to reduce interference between different signals being amplified separately.
COLD SOLDER JOINTS:
When you get an untrustworthy-looking solder joint during soldering, be sure to REHEAT the joint! A lot of times, if you don't do that, you can get a "cold solder joint", which can behave as an open circuit even if it passes cursory visual inspection! This has caused me problems with two different projects now, and it is an unspeakable evil that should be avoided at all costs!
Step 6: Improvements
For the future, many improvements may be proposed, including:
- Simple software-only modifications could make the pedal create a "delay" or "echo" effect
- Expression pedal substitution for the shift knob (already planned)
- Low pass filters on the output of the DAC
Any suggested improvements would be more than welcome!
Step 7: Notes
I have included here for reference selected notes from my notebook, in case they are in some way relevant to anyone.
60 Comments
Question 2 years ago on Step 4
Hi!
Great work! i don't understand in the code how in the main fonction, the playback function is called... might be an error?
Question 3 years ago
Based on my math - you're sampling at about 22-23khz, and you're sampling 8 bits/sample. That means you're at 176kb/s which on 256k of RAM leaves you just over a second of recording time. Is this correct?
4 years ago
Great project. Would love to do it but the schematics are unreadable,then again my eyes betray me some times.
Question 5 years ago
Looks like a great project. However, the code doesn't seem to download. I'd love to dig into it and see what you're doing. Any chance I can get the code somewhere or maybe explain the concept and maybe I can write my own?
9 years ago on Introduction
Hi! What relay do you use? Can you give me details?
Regs, Olgierd
10 years ago on Step 2
Really great DIY project!
I am not so familiar with microcontrollers programing, and seems it is to say only way to go, not like to build some digital echo or even reverb with PT 2399 ...
So, now if I would build that (I would really), for sure I need to make (to copy) only the same microcontroller circuit like your at least.
It would not be too hard?
I did not noticed you shown option how to add another sounds over first record, did you got idea about that?
Regards,
Peter
10 years ago on Introduction
I am so building this with an avr! I am also going to go through hell to try and add overdubbing. :) Wish me luck!
Really nice project!
11 years ago on Step 4
Hey,
I appreciate you taking the time to write this up, it's not easy working this stuff out without an electronic engineering degree! It's helping me understand how to work with audio. I'm using a dspic33F with the mplabx IDE and C16 compiler all from Microchip, with an aim to mess about with audio loops stored in RAM. I just had a quick question..
Is there some sort of peripheral library that isn't referenced in your code? I see functions like 'output_low(PIN)' but I can't find that in any of my libraries. Is that that same as writing 0 to the latch register for that pin?
Cheers, Matt
11 years ago on Introduction
Haha! Awesome! I want to build one, its like [url="http://http://www.mwfx.co.uk/judder"]this pedal/url]. I wish i could program on my mac. Kind of like the yamaha dds 20m from the 80s.
11 years ago on Step 3
Hi There.
Its really Hard to read your schematics.
Can you send the schematics via mail or make a digital version of them please?
sry for my bad english i hope you understand :)
Thank you
Hraaig
11 years ago on Introduction
So I really love this looper and how it sounds. Love the very quick loop you did in the video. I am looking to buy one but I'm on a very tight budget. How much do you think it would cost to make one of these? And I don't have any electrical engineering knowledge, so how much do you think somebody would charge to make one of these?
Just a few questions from a beginner guitar player, Thanks.
11 years ago on Introduction
Hi Colin
Could you please send the schematic of your amazing project.
I would like to build this effect.
TX
arik_123@walla.com
13 years ago on Introduction
Hey, I like it! The playing and the style isn't my thing, but it sounds really good.
Is the PIC 16 bit ? (or a DSP chip?) Because the sample quality is much better then most 8-bit audio projects I've heard. Even more amazing 'cause your using a serial RAM...
Reply 13 years ago on Introduction
Thank you! It actually is 8-bit recording. I used the PIC's internal ADC, which can handle 10-bits, but chose to use 8-bits because the SPI RAM was byte-addressable (and also for 10bit recording I'd need more ram).
Reply 11 years ago on Introduction
hi there, hope you are well, as i am sure your no stranger to this, i was hoping to pick your brains on the digital loop pedal that you made, here are my questios as follows, - how are you programming your microchip is it an arduino? - is the unit capable of layering or overdubbing ? - can more memory be attached to the unit? - have you ever used the ardiono boards? - could something similar be achieved with the ardiono? -does the guitar go through a pre-amp? - how much did your unit cost in the end? sorry for all the questions lol but i am realy intregued as this is by far the best diy unit out on the entire internet to date and would like to base my project on yours and make adaptations. many thanks, sorry for all the questions lol, marc webb
Reply 11 years ago on Introduction
The arduino is based upon the AVR micro controller. This project is achieved via the PIC architecture, which is slightly different, but anything done in this project could be replicated in principle by an AVR micro controller.
The PIC is programmed via a PicKit2. You can google that to see what it means. As for layering, it would require memory that is twice as fast and twice as long, but it would be possible with a faster PIC. I don't know what overdubbing means.
Preamplification is achieved by a two stage operational amplifier design, pretty straightforward. Actually the design presented here is terrible, but any operational amplifier when used correctly would suffice.
The cost I don't recollect, I imagine it was less than $40.
Reply 13 years ago on Introduction
How about the PIC itself (aside from the ADC sampling resolution)--is it a 16-bit uC, or an 8-bit?
Sometimes you can hide low res sampling by piping into reverb, etc., but this really does sound great...
Reply 13 years ago on Introduction
The PIC itself is actually an 8-bit microcontroller.
I never considered the reverb idea, perhaps I should think about that. Thanks for the advice!
Reply 13 years ago on Introduction
Wow-excellent for an 8-bit banger...
12 years ago on Step 7
This is pretty impressive! Have you considered using the dsPIC family, as they're built for this kind of digital signal processing? I am not entirely familiar with them, but they're inherently more powerful, and you'd be able to build yourself at least a 16 bit DAC…
Well done, I look forward to seeing more of your work!
Barnaby