# Superimposed analog sine wave A/D conversion

Hi,

I am trying to read an superimposed waveform ( sin(2pi*ft) + 0.5sin(2*2pi*ft)+...+ ...) generated through matlab and outputted through my laptop soundcard into the arduino uno microprocessor. I would like to use the A/D convertor to convert the signal to digital values of 0-1023 and then use FFT algorithm to diplay the harmonic components of the waveform. I am very new to arduino and have several questions.

1) Since i will be having multiple sine waves in one waveform, how do I convert the entire waveform to a digital output. Will its give me a list of digital values? I know that there is an analogRead function that reads the analog value but am not sure how the actual a/d conversion is done.

2) If I do get a list digital values, how am I supposed to input them into the FFT algorithm.

I am just trying to understand the processes of the microprocessor so bare with me :).

I am just trying to understand the processes of the microprocessor so bare with me

Never on a first date.

How are you going to offset the output of the soundcard,so that you don't present the A/D witha negative voltages?

I am going to offset by adding the waveform to a constant number like 4.

( sin(2pi*ft) + 0.5sin(2*2pi*ft)+...+ 4)

2) If I do get a list digital values, how am I supposed to input them into the FFT algorithm.

So I tried to add dc offset and tested the voltage level on oscilliscope. For some reason the offset is not working. Is there any other way we can modify the wave to allow it to pass into a/d convertor

Link, that shows how to create DC offset: http://interface.khm.de/index.php/lab/experiments/arduino-realtime-audio-processing/ Link, that shows triple sine wave recognize by arduino: http://fftarduino.blogspot.com/2011/06/redisignupgrade-software-as-standalone.html

Yes that is my goal. Use matlab simply as a function generator and learn about the arduino + fft implementation.

but I would like to analyze harmonics, hence the complex waveform. I will be outputting the waveform through the soundcard. I have already ran and tested tat piece of code via matlab. I checked the voltage level for the first few frequency levels (using oscilloscope) and they seem fine. I am just not sure how the a/d conversion is supposed to work

akaballa: So I tried to add dc offset and tested the voltage level on oscilliscope. For some reason the offset is not working. Is there any other way we can modify the wave to allow it to pass into a/d convertor

Probably not in software - the soundcard is likely to be outputing through a capacitor (to remove DC component). You'll need to level shift the signal somehow in hardware. Audio hardware is usually careful to remove DC bias because it damages loudspeakers.

One way is to couple the signal via a capacitor (1 to 10uF or so) to the junction of two 10k resistors, one to ground and one to +5V - this junction is then connected to an analog pin. The positive side of the capacitor goes to the resistor junction if it is an electrolytic.

May need to add offset and gain to take full advantage of the ADC 0-5V sampling. I think sound cards only put out line level signals, +/1V or so.
So maybe set up for gain of 2, with offset of 1.25V so output ends up at 2.5 with no sound card input.

http://www.electronics-tutorials.ws/opamp/opamp_4.html

Hi,

I was wondering what is the limit for taking negative voltage on the ADC converter or digital input pins on the arduino board. I know it clips the negative part of the ac waveform.

Thanks,

The lower limit is simply 0 volts.

Well not quite the data sheet says:- Voltage on any Pin except RESET with respect to Ground ................................-0.5V to VCC+0.5V