Microphone amplifier circuit for dsPIC

I described a simple audio input example for the dsPIC30F4011 in a previous post. Here, I’m revisiting the same example, but with modified component values and using an LTspice simulation to investigate the frequency response of the circuit. LTspice can be downloaded free here.

This the audio amplifier circuit:

Microphone amplifier circuit for input to a dsPIC microcontroller

The LTspice schematic file can be downloaded here (in case you want to modify and/or simulate the circuit yourself):

The microphone is modeled in the simulation as a voltage source (labelled “Mic” in the diagram). The output signal (labelled “Vout”) can be connected directly to an analog input on the dsPIC30F4011 (e.g. pin 2, which is AN0).

The following graph shows the frequency response of the circuit shown above, generated using the AC analysis simulation in LTspice, over the frequency range 1 Hz to 10 kHz. The input signal (Vin) and output signal (Vout) are both shown. The solid line shows the magnitude response, while the dotted line shows the phase response. At each frequency in the range of interest, this AC analysis shows the response of the circuit to a sinusoidal input of amplitude 1 mV. Therefore, the magnitude of Vin is constant across the graph. However, the magnitude of Vout varies from 0 at DC to over 46mV at 10 kHz. This high pass characteristic is as expected due to the low-pass input stage (R1, R2, C2) and the series capacitor in the op-amp’s feedback network (R3, R4, C1).


Resistors R1 and R2 form a bias network, setting the DC level of the voltage at the non-inverting input of the op-amp at 3V. The microphone will cause this input voltage to fluctuate a little above and below 3V, but it will remain close to 3V. The op-amp is used in non-inverting configuration, but the inclusion of capacitor C1 gives a gain of 1 at DC. This results in the same 3V DC level being present at the op-amp output, which is ideal for connecting into the analog input of the dsPIC. Although the DC component of the op-amp input remains unamplified, the gain is far higher at audio frequencies. As a result, the small perturbations caused by the microphone at the op-amp input result in much larger perturbations at the output. Again, this is ideal for recording the signal through the analog input of the dsPIC. The gain of the op-amp at higher frequencies can easily be modified by changing the ratio of R3 to R4. For example, replacing R3 with a 100 kΩ resistor would increase the voltage gain by a factor of 10 (approximately) at audio frequencies.

The following graph shows the result of a transient simulation in LTspice in which the microphone input signal was configured as a sinusoid of amplitude 1 mV and frequency 1 kHz. The input signal (Vin, shown in red) is so tiny that its oscillation is barely discernible. Once amplified however, the oscillations are clearly visible in the output signal. Note also that the DC level of the output signal is 3V, as desired.

Response of the amplifier circuit to a sinusoidal input signal of magnitude 1 mV and frequency 1 kHz

In my next post, I’ll provide some simple code for sampling the audio signal using a dsPIC microcontroller.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s