Creating a tuner..... Begginer!

Is it ok in that way? Do you need more information? So for sure I need another circuit?

The max ouput of the preamp its 2V

Is that peak or RMS? In any case, it's probably an approximation or a "worst case" spec (meaning that the preamp will clip at 2V or more), and it will depend on the power supply voltage to the preamp. Ideally, you could get 5V peak-to-peak (1.77V RMS) with a 5V power supply, but there will be a voltage drop across the output transistors and a real-world circuit will put-out less.

It's the same with a power amp specs.. If the spec says 100 Watts maximum, that means if you drive it to it's maximum, you should at least get 100W. You'd feel cheated if you could only get 90W, but you'd be happy if you get 110W.

Plus, it's an analog signal... Very unpredictable! :wink: The actual voltage will depend on how hard you pluck the string, the sensitivity of the guitar pickup, guitar's volume control setting, and the gain setting of the preamp.

You can get almost one volt out of a guitar pick-up, so the main purpose of the preamp is to present a high-impedance load that doesn't affect the guitar's output level or tone. The Arduino already has a very-high impedance input, but only for the positive half of the waveform, and you are not supposed to feed-in negative voltages.

If you don't care about the tone or sound quality while tuning, you might be able to skip the preamp. If you have a multimeter or access to an oscilloscope, you can check the guitar's output voltage. (A multimeter will be too slow to measure the peak, but you should get a good idea of the signal level.)

There are a couple of ways to deal with AC input. If you are analyzing the waveform with FFT to find the frequency, you need the whole waveform. The simple solution is to add a pair of equal-value resistors to bias the input at 2.5V (and a capacitor to block the DC bias from your preamp.. (That means that silence will read about 512 on the ADC, but that's easy to subtract-out in your sketch.)

If you only need to read the amplitude (maybe finding the zero-crossings to determine frequency) you can throw-away the negative half of the waveform. The easiest way to do that is with a series "current limiting" resistor (to prevent damage to the preamp) and a pair of "protection diodes" to prevent the signal into the Arduino going negative or going above 5V.

I'll leave it to you to research those solutions in detail.

With an output impedance of 1K for the preamp, a simple voltage divider should work as an offset circuit. Here's a way to do it:
http://interface.khm.de/index.php/lab/experiments/arduino-realtime-audio-processing/.
Some things to think about with regard to that circuit:

  • It's not necessary to use a potentiometer to adjust the DC offset level, if you're willing to live with some inaccuracy in your DC offset.
  • This scheme uses 100K resistors in the voltage divider. The ATMega328 datasheet suggests an input resistance of 10K or less to ensure that the input capacitors on the ADC have time to charge fully. The equivalent DC input impedance for this circuit is 50K. There might be some impact on accuracy. You could use lower-value resistors, but not too low - you don't want to load down the output of the preamp. A couple of 20K's would yield an equivalent DC input resistance of 10K.
  • I'd add a high-value resistor - maybe 100K - between the hot leg of the audio input and ground. If the output of the preamp is capacitively coupled, as I suspect, then that point won't have a well-defind DC voltage. I can't provide a good theoretical justification for that, though; my bias is strictly intuitive.

satercito:
So for sure I need another circuit?

Not absolutely for sure. That preamp could be anything; there's no way to guess its output characteristics. It might have a nicely-biased audio + DC output, centered at 2.5V, just waiting to be hooked to an Arduino, but I doubt it - it'd be an odd preamp. I'll go out on a limb and say, yes, for sure you need another circuit. Doing otherwise risks damaging an analog input to your Arduino, or damaging the the IC generally.

Thanks to all!! I really apreciate so much your answers.
The thing is a got this preamp just to not do any circuit by myself, cause my knowledgment in electronic is really bad.
In this proyect the guay allows to use the op Amp of my preAmp (TL071).

which one could be the easiest way ,(no matter if tha final quality is not really good) to get the guitar frecuencys through this preamp I have and something else if needed...

I live in the countryside and maybe I wont recieve any piece I need till next week, and the only thing i have here is the preamp and arduino(Ok maybe I can find any resistor from any old electronic device).. My project should in one moth and Im really am in a hurry!

no worries if you cant help me!

Thank you very much.

These statements -

satercito:

  • ... my [knowledge] in electronic is really bad.
  • In this [project] the [guy] allows to use the op Amp of my preAmp (TL071).
  • My project should in one [month] and I'm really ... in a hurry!
  • make me wonder if this a school project. Is it?

FInal project of my degree! Computer science.. the think is that I love music.. thats why I choosen this project.. but I really know about mobile programming

I think I will talk to my master and coment about your solution tmd3, since I have not knowledgment about electronic, i need to be sure about the circuit you propose.

satercito:
I think I will talk to my master and coment about your solution ...

Please do.

Once you capture the signal, how do you intend to process it? After you process the signal, how do you intend to show the user whether he's in tune, and which way to tune?

tmd3:

satercito:
I think I will talk to my master and coment about your solution ...

Please do.

Once you capture the signal, how do you intend to process it? After you process the signal, how do you intend to show the user whether he's in tune, and which way to tune?

With the Fast fourier transform.. and show in a LCD Screen the note with arrows in each side to say if he has to tune to the left or right

OK. If you don't have the FFT and display program working yet, you probably want to start on them. Eventually, you'll process an array of analog data with your FFT code. You can start now, using test data.

I'd like to know if anyone has built a working tuner on the Arduino based on the FFT.

Good idea! I'll start with FFT test data now! Im not sure if I have bookmarked a page of someone who did the tuner with the FFT, if I find it , I¡ll post it

I did some things this morning in the university laboratory with an oscilloscope, I tried using a offset of 2v, and now I see that im getting 300mv on the input (just noise, unplugged cable) and in the output 3,50V.. so now its centered at 2V nut its losing a little bit. I used a 100k resistor between the ground and the hot leg of arduino as you said. Today I havent had time to try som stuffs and measure from guitar and so..but I will have the whole morning tomorrow to test inputs and outputs...

thanks so!

Just want to add my +1 to the topic.
I'm also a new to hardware but with software development background. I need an input circuit for audio. Then I will do som FFT and beat detection and blink led and lasers until seizure.
Here are link a found so far. You've probably also had.

http://www.instructables.com/id/Arduino-Audio-Input/ - an comprehansive tutorial on how to make a audio input board. It should convert signal to be 5v amplitude with a 2.5V center. But that did not work for me due to probably my curved hands. What I got were only 0 , 1023 and 510-515 values on arduino inputs.

http://macetech.com/store/index.php?main_page=product_info&products_id=11 Arduino input shield. Have not tried yet. Shipment to Germany is more expensive than board itself. But I might buy it in the end.

http://www.andregoncalves.info/ag_blog/?page_id=61 Seems to be the same as previous. I wrote to the man but he just does not reply.

There are few other audio boards out there but they do not provide raw audio data to the board or it is not clear from the description.
Can one suggest a ready to use solution if there is one?

satercito:
I did some things ...

I don't see a description of what you did. A schematic would help.

zallesov:
Can one suggest a ready to use solution if there is one?

Here's what I use: a cheap homemade circuit to connect the audio output of the PC to the Arduino. A schematic is attached. The Thevenin equivalent of the voltage divider is a 10K resistor and a 2.5V DC supply. 10K is suitable for an analog input, as described in the datasheet. Note that there's nothing in series with the analog input. I've verified that my PC won't output a 5V peak-to-peak signal, so I don't worry about overdriving the analog input. You may prefer to use two 10K resistors, and a 5K in series, for an equivalent impedance of 10K, with the 5K providing a measure of protection for the analog input. This scheme isn't really suitable unless the input is stiff enough to drive the equivalent impedance of the voltage divider; otherwise, the signal level will drop.

I added a 100K resistor to ground from the signal input. That's because I suspect that the audio output is capacitively coupled, just like my input. Without the resistor, the DC voltage between the two capacitors is essentially undefined. Because I'm using an electrolytic capacitor, and I presume that the audio output does, too, I add the resistor to keep the DC level between them at ground, and make sure that the capacitor polarities are proper. I can't say that it's necessary; I just like having it in the circuit.

Advantages are that it's cheap, easy to build, and I can define the analog input quite precisely by generating my own audio content. The primary disadvantage is that it doesn't lend itself to real-world inputs: The input impedance is so low it would pull down most guitar inputs, and it has no protection from analog overvoltage, as you might get from an amplifier output intended for a speaker.

Criticism is welcome.

Audio Input Schematic.png

BTW, what is amplitude of a signal from an average cell-phone player? Dow we need to amplify it?

zallesov:
... what is amplitude of a signal from an average cell-phone player? ...

I don't know of any standards. Here's a guy testing the audio output of an iPhone 5: iPhone 5 Audio Quality Measurements. According to him, full output is about 1.4V peak-to-ground, with an output impedance of 4.5 ohms. With a 2.5V offset, that'll give ADC read ranging between roughly 225 and 800, at full output.

Now , with my teacher I did a circuit after the previous preamp and I have in the input of arduino a signal between 1v and 4v more or less because with the picking up of the guitar sometimes if I play hard the string I can have 5v so from 1v to 4v would be enough. Now the second problem is to use a librarie that says me what frecuency is on arduino input. I tried with ArduinoFFT and saw one FIx_FFT..

any help!? thanks!

satercito:
I tried with ArduinoFFT ...

What did you try? What did you expect it to do, and what did it do?

If you answer those questions, and post code and a schematic, it can only help.

I think I understand the way fft works.. I need to read frecuencys from my guitar that are going to be between 1hz and 1kHz so I should use 2khz sample rate. Then I will get 2 arrays one from real number and another with the imaginary , I should do the module from both and get another array, and in this final array I need to look for the maximux(that is the amplitude)) and that maximun I have to divid by the sample number and multiply sample rate, and I have the frecuency of the sine that im looking for..

Am i Right? Or Am I completely lost ? haha

thanks!