AC (guitar) signal to Analog Input

Hello,

Can anyone tell me how could I input an AC (guitar) signal into Arduino Analog Input so when strumming the guitar I would see stable data from 0 to 1024 depending on how hard I strum the strings.

Thank you.

PS. I tried to use an Opamp circuit to amplify the signal but I still get an 'AC' data kind of input. Maybe what I need is to write a program that would somehow smooth the data. Does anyone have any ideas or information I could read?

http://us.f13.yahoofs.com/bc/44d01e95m5d3cc9de/bc/PHOTOS/AC+to+DC.bmp?bfJnmrHBHPX1wI0L

So you want a value between 0 and 1023 depending what note your playing?

Very difficult. You need to convert the waveform to something usable.
I dont know how you would do it.

No, I just want a value between 0 and 1023 depending on how hard I strum the strings.

Well, if you sample the signal from the guitar fast enough you should come up with the wave form. I don't know what the frequency of the guitar is but I think human hearing range is up to about 22 kHz. In that case you need to sample at least 44 kHz fast which is possible with the 16 MHz ATmega168 chip. So what you could do is save the last sample. Then get the current sample and subtract the last sample from the current sample to find the delta. Err, also save the last delta. If you notice the "delta" change signs then you know that the sinusoidal wave has just passed a peak or trough? If that's the case then you can take the sample there as the amplitude of the wave. However, this assumes a sinusoidal wave which I'm guessing might not be the case. See if you can just log the data and plot it to see what the wave looks like. If you're crazy enough you could run a discrete FFT... just an idea. Or if anything you could just keep a running max or min of the samples in the past 100 samples or something and use that as your amplitude. Bah, I just realized that the Arduino can't really pick up the negative voltages since the ADC goes from 0V to 5V. Well, you could still do a similar analysis I think.

You would need to rectify that AC signal into a DC signal that the ADC will be able to work with. Then the DC signal will vary in amplitude according to how loudly you strum the guitar.

Try to just pass the signal through a polarized (electrolytic) capacitor on the input pin.

Thats what many sound cards in PC's do.

You might also want to check out these threads - they are all doing something very similar (trying to read volume/sound intensity via the analog pins):

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1202371284

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1201637097

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1202056662

It sounds like once we get some solid solutions, this should go in a FAQ or in the Playground...