ADS1112 is a 16-bit delta-sigma A/D converter. This A/D chip has an I2C interface, a 2.048V internal voltage reference and performs a self-calibration on each conversion. These characteristics make it very easy to work with an MCU such as ATmega328p.

ADS1112 Reference Circuit
ADS1112 Reference Circuit (Courtesy http://www.ti.com/lit/ds/symlink/ads1112.pdf

The Arduino code library I created (download towards the end) is for 16-bit use only, but if you need to use higher data-rate you will have to modify the DR1 and DR2 bits in the register setup in the selectChannel function. The drawback of a higher data rate is the reduced resolution. Using this library, the converted analog value from the selected channels can be read from the ADC using the example code below (this example reads from channel 1 using unipolar mode with a gain of 1):

#include <ADS1112.h>
#include <Wire.h>

ADS1112 ads1112;

void setup()
{
  Wire.begin();
  Serial.begin(9600);
  
  //pin A0, A1 tied to GND. Address: 1001000
  ads1112.init(ADS1112::L, ADS1112::L);
  ads1112.selectChannel(ADS1112::CHANNEL_1, ADS1112::GAIN_1, ADS1112::MODE_UNIPOLAR);
}

void loop()
{
  Serial.println(ads1112.readADC(), 3);
  delay(100);
}

The library itself is pretty straightforward, you can consult the datasheet for more detailed information.

init(byte A0, byte A1)
A0 and A1 are used in conjunction with the corresponding pin wiring to set the device I2C address.

selectChannel(byte channel, byte gain, byte mode)
channel: in uni-polar mode, it can be CHANNEL_0, CHANNEL_1, CHANNEL_2; in bi-polar mode, it is either CHANNEL_0 or CHANNEL_1
gain: GAIN_1, GAIN_2, GAIN_4 or GAIN_8
mode: MODE_UNIPOLAR or MODE_BIPOLAR

readADC()
get the AD conversion result based on the parameters selected using selectChannel

The chip comes in either MSOP or QFN package, which is not particularly convenient for hand-soldering. But the MSOP version can be soldered relatively easily with an adapter board. Since I do not have an MSOP prototyping adapter at hand, I used a SSOP to DIP adapter board instead. From the picture below you can see that the pin pitch is slightly smaller for the MSOP package and I had to bend the pins outwards slightly to solder it onto the SSOP adapter board.

ADS1112 on Protoboard
ADS1112 on Protoboard

Download: ADS1112 Arduino Library

Be Sociable, Share!