Go Down

Topic: Creating a tuner..... Begginer! (Read 7879 times) previous topic - next topic

satercito


Hi everyone!

I've already started doing a tuner for the guitar.
First step was get an arduino duemilanove from the university and a designed preamp for electric guitars.

Im a begginer so.. I've conected the preamp to the power, plugged the jack of my guitar to the preamp and the output to of the preamp to arduino. The thing is... just correct me if im wrong. The max ouput of the preamp its 2V  and arduino in the analog will show values from 0 to 1023.. so 512 should be like 2.5V in arduino.. the output max of the preamp its 2v max(like 400aprox from 1023) , that means I shouldnt see values highers than 400 or 500... and im watching more than 600 on the screen.. can you help me or correct me!  thanks!!

tmd3

First things first:
The preamp output is probably centered at ground, meaning that it's negative with respect to ground some of the time.  A negative voltage on an analog pin can damage your Arduino.  You'll need an input circuit to offset the input signal so that it doesn't go below ground.   We'd need to know the output impedance of your preamp to describe an appropriate input circuit; maybe that's listed in the specs somewhere.

janost

Exactly how did you connect it?

satercito

The preamp output impedance is 1K... 


this way!



All the conections are in their places..


satercito

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

DVDdoug

#6
May 01, 2014, 12:06 am Last Edit: May 01, 2014, 12:19 am by DVDdoug Reason: 1
Quote
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!  ;)   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.

tmd3

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.



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. 

satercito

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.

tmd3

These statements -

  • ... 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?

satercito

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

satercito

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.

tmd3


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?

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

tmd3

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.

Go Up