Thanks for visiting. The purpose of this post is to share with you all a design for a working preamp that will output a guitar signal to an Arduino MCU that ranges between 0-5V.
I explored many options for how to do this, and scoured the internet trying to find a good solution. Finally, with the enlightened help of master circuit designer James T. Hawes, I have solved this problem.
Let me be clear- the circuit is entirely his design. My only contribution was in requesting that he help me solve this problem and then in the final breadboarding of the design. Please take a look at his website for a whole bunch of awesome info on amps, TV's, and a myriad other useful things:
http://www.hawestv.com/
I am quite interested in pushing the limits of what the ATMega328 chip can do for audio processing. There is quite a bit of information on the net, but it is not very easy to access and the 0-5V input issue is a big one.
Basically, the challenge was to come up with a way to input a guitar signal that the Arduino can read at an analog input pin and "do stuff with".
Initially, I wanted to make a preamp that would directly output 0-5V when the electric guitar is played through it, with the silence output at around 2.5V. I am new to the Arduino, fairly new to electronics, and impossibly new to engineering, so my understanding of the underlying principles is very much oversimplified.
With the help of James Hawes, I attempted multiple preamp designs to boost the signal enough to get the Arduino to be able to read it. Unfortunately, I fried a couple of chips because I didn't have enough control over what was happening. I could run the preamp (FET driven, or NPN transistor-driven) off of a 5V supply and lose almost all of the gain, or I could run it off of a 9V battery and put the poor Arduino (UNO) in mortal danger.
Yesterday, James came up with the perfect solution- elegant, simple, readily available and VERY VERY EFFECTIVE.
All parts for this project can be acquired at Radio Shack.
The beauty of this design is in it's simplicity:
The first task was to boost the guitar signal. A standard preamp was used that is copied from James design for an MPF102 (Radio Shack part) JFET preamp. As a standalone preamp, this design is awesome and I have put it to a myriad of uses. It is a very cool trick to have up your sleeve, for both electric and piezo pickups. The standard part if you can't find the MPF102 is the 2N3819 JFET.
The output of the JFET preamp feeds into an NPN transistor circuit that uses the 2N3904 NPN transistor. This part can be found in the Radio Shack NPN switching transistor mix pack- usually 5 are included in the package.
Basically, this entire circuit powers an infrared LED emitter. So, the guitar signal goes in, gets boosted, and outputs at the emitter. This is a 9V circuit.
The emitter is then aimed at the corresponding IR phototransistor which is connected to the Arduino at the analog input. The IR emitter and the IR phototransistor are available as a pair from Radio Shack. What I did was couple them together in the tube of a ballpoint pen, with their very tippy tops facing each other and no light permitted to enter.
The IR phototransistor runs off of the 5V pin of the Arduino and connects via a 10K resistor to the Arduino ground pin.
What we have done is separated the 9V circuit from the 5V circuit in such a way that the Arduino cannot be harmed (no more than 5V can enter the analog pin).
It is important to keep the two circuits separate, as that is the whole point of the project.
I repeat, the only place where the guitar signal interacts with the Arduino is OUT from the IR emitter and IN through the IR phototransistor.
Before hooking it up to the Arduino, I plugged the phototransistor directly into my amp and I was VERY impressed by the quality of the sound. There is a natural warm fuzz that is interesting enough that it is worth exploring as an standalone analog circuit, and the entire sound is shockingly true and clean.
Upon hooking it up to the Arduino, I was amazed that the circuit does exactly what I wanted- namely converts the guitar signal into something that the Arduino can wrap it's little brain around.
So far, I have used this circuit to experiment with the Arduino Realtime Audio Processing writeup that can be found here:
http://interface.khm.de/index.php/lab/experiments/arduino-realtime-audio-processing/
And it sounds MUCH BETTER with this preamp than with the setup that is described on their website.
My hope is that as my technology improves I will be able to use this preamp to record a guitar part using the Adafruit Waveshield, and loop that part so that lead lines can be played over it.
I welcome your feedback, and hope you enjoy this very clever circuit from the genius Mr. James T. Hawes.
Thanks
Peter Laucks
Monk Soundworks
November 2010
No comments:
Post a Comment