I'd like to put an extra pickup on my guitar to provide an analog signal into my arduino to run some LED's. I bought a pickup to play with. I hooked it up to my oscilloscope on measuring current and can see it change when I strum the strings. Now how do I get this into the Arduino?
I'm trying the analog input program under Examples but it's looking for changes in voltage not current. I'm assuming that I need a current sensor that will convert the variations in current to voltage? And if so, is there one you can recommend?
If it is a standard magnetic pickup, you will need an amplifier. There are some Arduino guitar projects on the web that will give you some ideas.
Your oscilloscope is looking for changes in voltage as well.
No you do not need a current sensor.
What voltage were you reading on your scope? The arduino will only measure large voltages, so if it is less than a few mV it will need amplifying.
You are right, it was a pretty small voltage. I did some looking and found some instructables for making an audio input circuit. I'll start digging into that.
I appreciate the direction.
found some instructables for making an audio input circuit.
The normal quality of instructiables is somewhere between very poor and crap so mind how you go.
The Arduino's ADC reads the voltage... (Ohm's Law defines the relationship between voltage, resistance (or impedance) and current. If you "load" the pickup with a lower impedance/resistance, voltage will drop (it will get quieter), current will rise (not directly noticable) , and the "tone" will be affected.)
You shouldn't need a 2nd pickup. If your Arduino-related preamp has a high input impedance (more than 1 Megohm) it you can use a Y-Adpater/Splitter and the Arduino circuit will have no effect on the sound.
A standard non-inverting op-amp amplifier* (an op-amp and two resistors) has very-high input impedance and will work fine. How much voltage are you reading on the 'scope? Typically, a gain of 1 - 10** is enough to get a guitar up to line-level, so those numbers should be a good start for experimentation.
There is also the issue of negative voltages. You can't put negative voltages into the Arduino*** and audio signals are AC, so they swing negative and positive. The most common approach is to bias the input at 2.5V (half of the 5V range) with a pair of resistors and a capacitor to block the DC bias from your source. Or for lighting effects (where you don't need the actual audio, you just need the moment-to-moment loudness) I use a peak detector circuit (another op-amp and a few other components).
- Most standard op-amp circuits require positive and negative power supplies. Or, you'll have to look for circuits designed to operate from a single supply.
** A gain of 1.0 means zero gain (the voltage is multiplied by 1), but since the guitar pickup needs a high-impedance load, Ohm's Law comes into play and you need to boost the current to drive a line-level input. An op-amp is capable of boosting the current to drive a lower impedance load, even with no voltage boost.
*** The Arduino ADC has a very high impedance input, but only for positive voltages. A guitar pickup (without a preamp or effects pedal) doesn't provide enough current to damage the Arduino, but but the negative half of the wave form will be clipped and you'll get distortion (if you are using a splitter from the same pickup and running the shared signal to an amp.)