If you've ever recorded audio on your computer, you may have seen it represented as a waveform like the one in fig 1. If you zoom in on this wave (as in fig 2) you will see that the shape is made of thousands of tiny oscillations
back and forth. This is called an audio signal
and when we are dealing with audio signals in electronics, these oscillations represent oscillating voltages over time.
When we look at an audio signal with an oscilloscope
, we see a similar picture (fig 3). Notice how the audio signal in fig 3 oscillates around a center voltage of 0V; this is typical of audio signals. The amplitude
of an audio signal is the distance between its center voltage and its high or low peak. The amplitude of the wave in fig 3 is 2V: it reaches a maximum voltage of +2V and a minimum voltage of -2V. This is a problem if we want to measure the audio signal with one of the Arduino's analog inputs because the Arduino can only measure voltages between 0 and 5V. If we tried to measure the negative voltages in the signal from fig 3, the Arduino would read only 0V and we would end up clipping
the bottom of the signal. In this Instructable I'll show you how you can amplify and offset audio signals so that they fall within this 0-5V range. Ideally you want a signal with an amplitude of 2.5V that oscillates around 2.5V (like in fig 7) so that its min voltage is 0V and its max voltage is 5V (see the calculations below).
Min voltage = Center Voltage - Amplitude
Min voltage = 2.5V - 2.5V = 0V
Max Voltage = Center Voltage + Amplitude
Max Voltage = 2.5V + 2.5V = 5V
Fig 4 shows the signal coming straight out of the microphone on an oscilloscope. The signal is relatively weak, with an amplitude
of only 200mV, you may find that signals from other sources (ipods, guitars, record players...) also produce audio signals with small amplitudes. These signals need to be amplified to get them up to the amplitude we want (2.5V). Amplification
means increasing the amplitude (distance between the center point and max or min) of a signal. Amplification also buffers the audio source (in my case this was a microphone) from any loads that you may put on it later in the circuit, which is a good thing because it prevents distortion.
Fig 5 shows the same microphone signal after amplification, you can see how the height of the peaks has increased so that the wave has an amplitude of 2.5V. But since the center voltage of the wave is still 0, the wave is oscillating between -2.5 and +2.5V. It will need to be DC offset to correct this. DC offset
means changing the center voltage that the wave oscillates around (the average voltage of the wave). Fig 6 shows the signal after it has been DC offset; it still has an amplitude of 2.5V, but the center voltage is 2.5V instead of 0V, so the wave never drops down below 0V. (Note- the slight change in shape between the signals in figures 5 and 6 is dues to changes in my voice between the two pics, it has nothing to do with the circuit). The signal in fig 6 is ready to go to an Arduino analog input pin.