I have an Arduino Uno and a guitar pickup. I was thinking I might be able to plug the pickup directly into the analog input, but I'm starting to think it will be a bit more complicated than that. Essentially what I'm trying to do it get the frequency from the guitar pickup.
Is this something that I will be able to do with an Arduino Uno? Is there something better that I should be using? I've never done much analog audio to digital signal before.
Also wanna note that I don't plan to do any signal processing on the Arduino itself. I simply want to read input and then stream it to another device that will handle processing.
The guitar output will be a low level AC signal. You'll want to buffer and add some some DC offset so that you have a 2.5V DC +/- the AC part of your signal.
You could also run the AC into a comparator, the output will be a square wave signal, that might lead to better results using pulseIn() to make timing measurements.
Also wanna note that I don't plan to do any signal processing on the Arduino itself.
But you do want the Arduino to analyze and determine the frequency?
From what I've seen here on the forum, most people trying to make a guitar tuner with the Arduino fail. But, there is a method called "autocorrelation" that's supposed to work the best.
In case you don't know this already, all real world sounds contain multiple-simultaneous frequencies. That's what makes a guitar sound different from a trumpet, etc.
I simply want to read input and then stream it to another device that will handle processing.
Streaming to what? And to what kind of connection? The Arduino will struggle if you're trying to do two audio-related things at once. Sometimes one audio related thing is too much...
The voltage output of guitar pickups is on the order tens to a few hundred milliVolts. The analog to digital converter (ADC) range of an Arduino Uno is 0 to 5 volts, so to use more than a small part of the ADC range will require a preamplifier between the pickup and the Uno in addition to the DC offset. Something like the input stage of this project: https://www.electrosmash.com/pedalshield-uno would do.
I gather that you are trying to use the Arduino to digitize the signal and then send it via serial to a PC or some such. The ADC on an Arduino Uno is fairly limited in resolution and speed. Using a PC or USB sound card will get you a much higher resolution and faster ADC. The ADC resolution on a sound card with a line-in input is probably good enough that you won't need the preamplifier to get started.
That's good to know about a sound card. To answer the other repliers comment about analyzing frequency on the arduino itself, i don't plan on doing this. I plan to do this analysis on a PC.
MrMark:
The voltage output of guitar pickups is on the order tens to a few hundred milliVolts. The analog to digital converter (ADC) range of an Arduino Uno is 0 to 5 volts, so to use more than a small part of the ADC range will require a preamplifier between the pickup and the Uno in addition to the DC offset. Something like the input stage of this project: https://www.electrosmash.com/pedalshield-uno would do.
I gather that you are trying to use the Arduino to digitize the signal and then send it via serial to a PC or some such. The ADC on an Arduino Uno is fairly limited in resolution and speed. Using a PC or USB sound card will get you a much higher resolution and faster ADC. The ADC resolution on a sound card with a line-in input is probably good enough that you won't need the preamplifier to get started.
What type of sound card should i buy for something like this? Also to clarify, i'm just getting the signal from the wires directly from the pickup, not from the quarter inch guitar output.
Some of the Teensy line of Arduino-compatible boards have serious DSP capabilities (much faster
processors, enough RAM for decent sample length), and there is an Audio processing library for
them too, so they are a more natural choice for the more complex audio DSP applications.
Frequency measurement of a complex signal (guitar signals are stacked full of harmonics) isn't
likely to be as trivial as using a comparator and counting zero-crossings.
Having said that there are tricks in the analog domain that can help, such as using an integrator
to reduce the amplitude of harmonics and then passing to a comparator (not perfect and it means
the range of usble frequencies is limited due to the attenuation of the higher frequecies caused
by integration).
For software approaches I'd look to find an existing project that someone's got working and check out
how they did it.
nickboston:
What type of sound card should i buy for something like this? Also to clarify, i'm just getting the signal from the wires directly from the pickup, not from the quarter inch guitar output.
I would start with the microphone input on whatever PC you have on hand. Optimally you probably still like some sort of pre-amplifier to match the pickup level to the sound card range, but any PC sound card is going to have enough resolution that you'll get some signal without it.
What is the end goal of your project, that is, what sort of processing do you have planned?
Microphone inputs are normally low impedance (a few k), guitar pickups require high input impedance or
the treble may be lost. 470k is a common input impedance for a guitar amp, so using a microphone input
is likely to be very unsatisfactory.
A guitar pick up is basically a high value inductor forming a sense coil, several henries. Thus its impedance can be many 100k or more at 5kHz or so, so the amp input should be substantially
higher to prevent loading it down at high frequencies. Obviously less of an issue for a bass guitar!