Sunday, October 21, 2012

A comparison between quality of ADCs: Texas Instruments' ADS1100 16-bit and Microchip's 10-bit ADC

بسم الله الحمدلله والصلوة والسلام على رسول الله

Salam'alaikum guys.
I have collected an incredible amount of documentation for this blog's material to make more articles, but I'll release it slowly, insyaAllah. 

So, as per the title, you may wonder if this is really hobbyist stuff. As a Microchip user, I had a lot of problem using only 10 bits for my ADC, when the last (10th) bit is usually not very useful anyway since it fluctuates a lot due to electrical noise. Now, I'm not going into how ADCs work, since this article will be for faithful PIC users. And just for the record, I'm a PIC fan, and I'm not telling people to criticize Microchip for their features. This is just a not-your-average-academic report on performance comparison.

I obtained a lot of samples from Texas Instruments, therefore I feel that I could express my gratitude by putting this report out. Thanks to all the staff who handled the shipping of TI's products, from Thief River Falls. The ADC of our concern will be primarily by TI, the ADS1100. This chip has 15-bit code output for single ended inputs, communication using I2C, self calibrating, low power consumption, and awesome. The other one will be from PIC184620F's hardware ADC, which is similar for most PIC hardware ADCs.

The one I received is mounted (or wire-bonded) like this:
Figure 1: ADS1100 mounted for 2.54mm receptacles
The chip is an SOT-223 package, a bit small but possible to be mounted on a perfboard. A bit of soldering expertise required but not an issue here. It'll be easier to connect to the main board after you've finished. It's quite easy to solder on a PCB too.

This is perhaps just a simple ADS1100 tutorial:
1. Setup the circuit as shown below: (Remember to add a pull-up resistor for SDA and SCL.)

Figure 2: Single-ended input for ADS1100 (From ADS1100 Datasheet)


2. Connect SCL and SDA to your microcontroller (I'm using Microchip's PIC... they're still cool). You can choose either a hardware or software I2C, but sometimes because of design limitations, a software I2C is much more practical. You need a quick intro into I2C and try to write your own I2C software , but nowadays you can cut to the chase and use libraries which are supported by microcontroller compilers. MikroC is one of those.

The code will be something like this (using MikroC):

///////////////////////////////////////////
  Soft_I2C_Init();               //  Software SPI initializing.
  Soft_I2C_Start();            //  a. Initiate a start 
  Soft_I2C_Write(0x90);   //  b. Sends address to ADS1100 at 0x90. Refer datasheet at address section. 
  Soft_I2C_Write(0x8c);   //  c. Default value (0x8c) to be written to the chip. Refer datasheet for more.
  Soft_I2C_Stop();            //  d: Stop signal
///////////////////////////////////////////

After receiving these commands, the ADS1100 performs conversion and stores them inside its register, with a value from D14 to D00. One bit is lost due to this configuration (can't be helped, there's an extra measure you can take to recover the lost bit as pointed out in the datasheet but 15 bits is enough for me)

3. Now you can retrieve the 15-bit code:

//////////////////////////////////////////////////////     
     Soft_I2C_Start();                    // Start software I2C
     Soft_I2C_Write(0x91);           // Write to threaten the ADC to send the data it's hiding. Gimme gimme!!
     highbyte=Soft_I2C_Read(1);  // Read the seven most significant bits (D14-D08), send an ACK    
     lowbyte=Soft_I2C_Read(0);   // Read the remaining D07-D00 data bits, and send a NACK.    
     Soft_I2C_Stop();                    // Stop or else you'll be desoldered. (just joking guys).
//////////////////////////////////////////////////////

Loop this code for a continuous reading, and send this data to the PIC's GPIO ports with LEDs to see the outputs, let's say portd=highbyte and portc=lowbyte. MikroC's software I2C is rated at 20kHz, which is sufficient for our demonstration. Later, we can manipulate these data for our use.

***********************************  End of tutorial  **********************************

Comparing an ADC chip with an ADC hardware inside a microcontroller might be like comparing apples and oranges since the intended usage of ADCs varies from user to user, and people'll be like, "C'mon! One is 16-bit and the other 10-bit! That's unfair!" But for me, what is interesting is the fluctuation of the least significant bit of both of these ADCs, and we'll see that in a moment through this video: 

Video: ADS1100 demonstration 

So in conclusion, we can see that the ADS1100 gives a much stabler output at a very precarious resolution (i.e. 5V/32767=0.00015V) compared to Microchip's 10-bit output (5V/1023=0.0045V) and we see a lot of noise going on there!

So that's it! If you want the code, please download it here, which shows the output of both the ADS1100 and the hardware ADC output via an LCD display. It's a bit messy and I'm not an expert programmer, but hope it helps!

All the best to everyone.
Vizier87.

Related Posts Plugin for WordPress, Blogger...