Applying gain to differential analog inputs on Arduino Mega

I’m trying to perform acquisition of very small analog signals. I have been using an instrumentation amplifier with a gain of ~500, but I would like to try using the differential gain on the ATmega1280’s analog inputs. The user manual has a table (Table 26-4, to be precise) with details on how to set the register ADCSRB for a particular choice of single-ended input or pairs of differential inputs, optionally with gain.

Normally, to perform ADC on the Arduino, I write:

reading = analogRead(analogPin);

but this is for a single-ended input.

My question is: how do I perform differential amplification and conversion within the Arduino language?

Hmm, I’m surprised there isn’t already a library for using the 1280’s serial ports - I didn’t realize they had an opamp built in! I’d grab the analogRead code from the Arduino source, and just set custom values for ADMUX and ADCSRB.

Hi,

I had the same problem, and before i started creating a new library, i got with this (Someone already did it):

http://sekarlangit.com/arduino-differential-gain.php

Hope it helps.