Changed Op-amp, now signal is not centered

arduinoelectretoperational-amplifier

I'm making a pre-amplifier for my 9mm electret microphone to be read by an Arduino. Here's the schematic:

pre-amp schematic

Note that the resistor I used connected to the output is 1Meg. My supply voltage is 5V.

Initially I used LM358 as the op-amp. When I plotted the output it seems to be normal -centered around 2.5V with a bit of noise (my plot range is 0 to 5V). But when detecting loud sounds, the output gets clipped to ~3.7V.

Because of that I decided to switch the op-amp with a rail to rail AD8051 instead.
Wiring with corresponding pinout from its data-sheet and using the same resistors, capacitor and mic. Now the output I get is somehow centered at 0V and the signal seems to be amplified more than the last time.

Why did this happen and how do I get the output to center back at 2.5V? aren't op-amps interchangeable without having to change resistor values?

Best Answer

The input bias current of the AD8051 might be as high as a couple of micro amps and this doesn't sound much but, through a 1Mohm feedback resistor, this will generate a dc error of 2 volts on the output. Note that with the +input seeing a DC resistance of about 5kohm, the same bias current will produce an error of about 10mV. I would suggest equalizing resistances in both inputs but you are going to start to run into noise problems with so many 1Mohms in your circuit I suspect.

Try something more like and AD8605 (input bias current less than 50pA). Alternatively consider the non-inverting topology: -

enter image description here

Not shown is the electret bias resistor of 10kohms and, also, Rin is not needed. The non-inverting input is biased at mid-rail by the two 100k resistors and these, for a device like the AD8051 can be as low as a couple of kohms thus ensuring bias currents don't create a large offset voltage. RF and R1 set the gain and a gain of 1,000 can be achieved with R1 = 100 ohms and RF = 100,000 ohms - this means the feedback resistance is one-tenth of what you had and the offset it introduces will accordingly be one-tenth at about 0.2 volts on the output. Ci in the feedback area will need to be much bigger than 0.1uF because R1 is now only 100ohms - something like 47uF. Ci on the input leg can be 10uF.