Instructables
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.
 
Remove these adsRemove these ads by Signing Up

Step 1: Audio-only demo

Picture of Audio-only demo
This is an audio-only demo I recorded.



onowakowski11 months ago
Hi! What relay do you use? Can you give me details?

Regs, Olgierd
lcantarini2 years ago
I've start make digital design about this Colin's job. Due the difficult to make this schema, from the Colind picture, please, feedback me about some mistake.
Thank you
Luca
Did you built it using that schema? Does it works fine??
There's something i tried to understand : Inputs and outputs !

C3(+)Input is the audio input (from guitar)
Out is audio output (to amp)
both jack has to be solder to those input / output and to the ground ! Am I right ?

I think VFF is 12V
What is VEE ?? 3.3V ??

I see 3 potentiometers but not any switch ... Where are they ?

Please correct me if i'm wrong ! thanks
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
dunnos1 year ago
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!
mattomatto2 years ago
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

starguitar2 years ago
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.
Hraaig2 years ago
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
tdavis222 years ago
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.
arik_1232 years ago
Hi Colin
Could you please send the schematic of your amazing project.
I would like to build this effect.
TX
arik_123@walla.com
gmoon4 years ago
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...
colin353 (author)  gmoon4 years ago
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).
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
colin353 (author)  marcjwebb2 years ago
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.
gmoon colin3534 years ago
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...
colin353 (author)  gmoon4 years ago
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! 
gmoon colin3534 years ago
Wow-excellent for an 8-bit banger...
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
anassundala3 years ago
NICE PEDAL BRO...
CAN U SEND TO ME SCHEMATIC PLEASE
IF U WANT,U CAN SEND TO ahmad_dimarzio@yahoo.com
tq b4
lufox153 years ago
Great Work! i have a question which is the sample time that you can get with the pic16f877?.
I was trying to make a similar project but i can only get a maximun sample time of 625Hz.
Thanks.
microman1714 years ago
Hey Colin,

I'm working on my own digital pedal based on the PIC18F26J11 (Just what I had laying around). I'm not sure what effect I plan to try to create, but It's fun to have a go.

At the moment, I am trying to get the chip to act as a buffer, all I want it to do is read the analog into a variable, and then output it to the DAC (Mine uses 4.7k and 10k resistors, which I know gives a lower quality signal). I have a lot of trouble with noise, and have been using 100nF capacitors in places to see what I can do.

I have found I should have one series with the input, series with the output, and then one to bypass the output to ground.

I have tried the opamp circuit you have presented, but I have no idea what it's purpose is, how it works, or if mine even worked the way it was supposed to.

Could you please let me know how it was supposed to work, or even just tell me how the opamp is configured (-ve voltage amplifier?). I guess it is supposed to change the guitar signal into a 0 - 3.3v representation of the signal?


Cheers,

MM
colin353 (author)  microman1714 years ago
Hello microman,

You are correct, the op amp is there only to amplify the input guitar signal to something a little more usable for the ADC, since an unmodified guitar signal usually has a very small amplitude.

From what I remember (this was a long time ago) I just biased the guitar input up to something like 1.7 V, then amplified by a pretty large gain. In this particular configuration the gain is negative, but that's alright, it just changes the phase of the signal.

If you are going to try to do something similar, probably you should design the amplifier yourself though, looking at my old schematic, there are a lot of improvements that could be made to it that would improve the sound quality. Like I said, it was made a long time ago, I didn't understand too much about circuits back then :P

Let me know when you finish your project, I'd love to hear more about it.

Anyway, good luck (and thanks for making your question specific, you wouldn't believe how many people come on here and ask me for "help building the pedal" without specifying what they don't understand about it!)
Hey Colin,

A bias means to set the upper limit right? Sorry, I'm new to opamps. At one point, I was inverting the signal before the output, and found it made no change at all.

I'm looking at building a flanger effect at the moment, as it looks doable. I need about 20mS worth of recording, and then mix that into the live feed.

It's great you posted your instructable, as it has been a stepping stone. A friend suggested I make a digital pedal, and I leapt right in knowing all about ADC and DAC. The problem came with noise, and was solved with capacitors.


Cheers,

MM
colin353 (author)  microman1714 years ago
A bias means a DC voltage added to the alternating signal from the guitar. You have to bias it up to halfway so that you can amplify the negative part of the alternating signal too, since your power supply is probably not bipolar if you are driving digital electronics.

Here is a link to another circuit I designed (much better quality amplification actually) which shows the use of bias:
http://www.getlofi.com/?p=2945

if you look at the left/right channel amplification, the 1uF capacitors serve to prevent DC from flowing through from the inputs. Effectively, it just adds a DC voltage to the input signals so that they can be properly amplified.

Anyway, good luck with that. 20 ms of recording time should be totally possible, even at high sampling rates, so looks like you are on the right track. Let me know if you have any other questions.
Hey Colin,

I spent a whole lot of time learning, and in the end I designed my own opamp circuit. There is a 10k input resistor and an 8.2k feedback resistor. The +ve input is at 1.03v through the use of a 10k and a 22k divider. My simulation predicted this will create a 0v to 3.3v wave from a -1.8v to 1.8v input.

I still have two 100nF caps on the output, one to ground and one to output. These seem to cut down on noise dramatically.

It was an excellent experience.


Cheers,

MM
colin353 (author)  microman1714 years ago
I'm glad you managed to make it work! Link me to your instructable when it's done, I'll read it for sure.
Hey Colin353 this is the Rhino, i really want to build this pedal, can you help me with the schematic, and programming. You Rock, Paul Gilbert also
colin353 (author)  Baseball24_74 years ago
I would be happy to answer any specific questions you have about the project.
Do you have a clearer drawing of the schematic.
RogerClark4 years ago
I Colin. I was trying to build a something similar using a PIC16F690. But just to do effects. But I've realised that I don't have enought internal RAM and that the PIC16F690 can't address external ram (easily). So I may need to upgrade to something from the 18F series. Are you getting a fast enough data rate to your RAM using the SPI ? I was hoping to sample at at least 20Khz, and crank the PIC's clock up as high as it would go, but access speed of external ram would be a serious issue for effects like reverb etc which need a large buffer which can be accessed for virtually every output sample. BTW. I don't know if you've seen this article on a final year project at Cornell http://courses.cit.cornell.edu/ee476/FinalProjects/s2003/Gjr8tl74/ECE476FinalProject/Index.html
colin353 (author)  RogerClark4 years ago
Hello, You will definitely need to use external RAM, the PIC has nowhere near the amount of internal RAM you will need. I used serial RAM under the delusion that I could access it arbitrarily quickly. In the end, the time required to access the RAM was the limiting factor in the sound quality of the device. If you used a parallel ram, it might be fast enough to do 20kHz. I was clocking my PIC at 20MHz, but I know for sure there are very cheap PICs that can do 48Mhz. I did a bit of research on 32 bit PICs for a nicer quality digital audio project, you can get ones that go to 80MHz. The other thing to keep in mind is the nyquist minimum frequency that you really need to reproduce the guitar sound well. If you are putting your pedal first in the pedal chain (to minimize weird harmonics), then you only have to sample at twice the maximum frequency of the guitar, which (I believe) is well below 20kHz. Anyway just do the math on the SPI for whatever ram you are looking at. You will probably need an SPI clock cycle per bit and you can probably do your SPI clocking at about a quarter of the clock speed of the device for a standard PIC. Anyway this message ended up being much longer than I originally intended! Haha, I guess I am secretly still interested in this stuff. Keep me posted, and good luck!
Thanks for the reply, I totally agree with all your points. My project started off just being a practice amp that I was going to put inside the guitar (to hook up to headphones), but then I had the idea of using the 16F690 that I had in my box of components, and of course things sprialled on after that. But I can see that the 16F690 is not suited to this application, because it doesn't have lot of intenal ram. I'm still going to carry on with this project as I may be able to do some basic effects without ram e.g tremulo or I may be able to do some FFT stuff that may be able to do some wierd stuff to the sound. I'll also think about whether its worth starting a separate project to do it properly, and whether a PIC microcontroller is the way to go or whether a different one eg AVR would be better. I'll let you know how I get on.
somorastik4 years ago
have you updated the software features echo and delay?
ski4jesus4 years ago
ha! well i have an actual stratocaster! :p lol nice guitar!
colin353 (author)  ski4jesus4 years ago
mine is real too! I love my stratocaster...
yah they rock. i would like to build this project but i dont have the parts. sick guitar!
hahaman84 years ago
can you scan it? its kinda hard to see
or make a digital version of the schematic. Ty!
justine35634 years ago
man what did you attach to the potentiometer above to let it change pitch?capacitor?thanks alot!
colin353 (author)  justine35634 years ago
this is not analog electronics! the potentiometer is wired to a tiny computer inside the pedal that modifies the pitch by playing back recorded samples at different rates.

I will say this though, a capacitor would not work at all.
justine35634 years ago
yeah because i would like to make a whammy pedal!thanks
hanley4 years ago
hey, looks great
What kind of DAC do you use?
colin353 (author)  hanley4 years ago
I used the most primitive DAC ever: a resistor ladder! It works great though, suprisingly.
 
Take a look at Step 5 under the DAC section for a link to the schematic I used, or refer to my notes in Step 7 for a poorly-drawn schematic that I put in my notes.
 Hello, I started working on a project like this a few weeks ago. How did you put your PIC ADC into 8-bit mode? Or did you just leave out the last two bits of the 10 bit conversion?   

And how did you write the code so that the playback frequency was exacly the same as the recording frequency?

Thanks!! Awesome stuff
colin353 (author)  Pieter-Jan50004 years ago
There is a flag I passed to CCS (the compiler I wrote my code for) which converts it to 8-bit mode, though you could indeed just ignore the last couple bits. My code is attached somewhere, I believe, you could read it if you want.

I got the playback and recording frequencies synchronized by the use of interrupts and calibration, essentially. Again, read the code if you want an example of how I did it (though I am very confident there are smarter ways of doing it)


oweng40004 years ago
Colin,
 
Would the song be Get Out of My Yard?

From,
Owen
anfegori914 years ago
Oh, this is great¡

how many samples / second?

Maybe I'll make something like this, but using the Btc Alghoritm of roman black to encode and decode audio.
colin353 (author)  anfegori914 years ago
I am not familiar with the BTC algorithm, I will say though that significant processing will reduce the max sampling rate. Initially I wrote my own SPI routines to talk to the RAM, but it turned out that they were much too slow.

If you can encode or decode a byte of audio in under, say, 60 or 70 us, you could make it work though. It probably would have been smart of me to write this whole thing in assembler- it would be much faster code in the end.
Umhh you're right. Since the BTC algorithm is not indeed for recording and play good quality sound, it can be useful when you need to compress audio (1:8) for other applications, like toys¡

www.romanblack.com/BTc_a
alberfilba4 years ago
 Excellent job Collin! But, how many seconds of audio can you store in 256 kBytes (or kBits?) of RAM? What's the sampling rate? It sounds like 44.1 kHz...

Yups! Sorry for so many questions ;)
colin353 (author)  alberfilba4 years ago
I am not entirely sure what the sample rate is, but I am guessing that I am sampling about once every 85 us, which corresponds to 11kHz.

Nyquist says to sample at 44kHz in order to be able to get all frequencies that the human hear can understand, but a guitar doesn't go anywhere near the maximum frequencies of the human ear. I think 11kHz is appropriate, assuming that there are no insane harmonics on the notes going into the pedal, which means that the pedal should come first in your pedalboard (before distortion, etc.)


As for recording time, 32 kB /(11 kHz * 1 byte)  = 3 seconds. I kind of thought it was longer than that, but math doesn't lie :P I guess 3 seconds just seems long enough for a single recording.
 Thanks for the reply. I've been thinking on building my own pedal with PIC too, you have inspired me!

Bye.
jgbrownlow4 years ago
Awesome work!  I am amazed you (or anyone) had the patience for all the point to point soldering (and got it to WORK!).
Any chance for a full, clear schematic (Eagle, MS Paint, etc), including part values? 
colin353 (author)  jgbrownlow4 years ago
http://www.flickr.com/photos/colin353/4385411009/

Contained here are my hand drawn schematics photographed in high quality.

I feel however that this project is not one to be copied, because it is too complicated to try to create, debug, etc without already being able to design it, you know? I would use this instructable as more of a suggestion on how a project could be designed- a list of successful techniques in homebrew digital audio electronics.

Don't get me wrong though, feel free to try and copy it if you are brave enough :P
It seems you have defeated me again. 

I bow to you.  Nice work.
AndyGadget4 years ago
The effect is a bit like the Echoplex, as used by John Martyn in the 70's and 80's.  Brilliant clip of him HERE.  This was a tape-loop device but the initial sound would diminish as it was recorded over by successive repeats.  That would probably be pretty difficult to do digitally but it was a natural consequence of the tape medium.
sethj4 years ago
this is a cool project. can you upload a more viewable schematic?
colin353 (author)  sethj4 years ago
That sounds like a very good idea. I have a higher quality image of the schematic which was kind of murdered when I uploaded it.

I'll try uploading it as an attachment or something, or perhaps linking to it on, say, flickr.