A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

Analog to Digital Conversion

A 4 bit SAR A to D convertor.

Today we are making a slight turn from the analog world into the digital world. Computers are nice when it comes to crunching numbers and recording data, but somehow we have to get those real-world values into the computer. The device that does that is called the Analog to Digital Converter, (A/D). We are going to talk about one type of those called successive approximation conversion. However, before doing that I probably need to give a short introduction to simple binary numbers. I said simple, because I am not going to talk about representing negative numbers or floating point numbers.

A four digit decimal number and a four bit binary number.

Like always, lets start with what we know and then make analogies to work toward what we don’t know.  Starting with the decimal number 9876, what does that number really mean?  As we move from the right most digit each digit to the left is 10X more powerful than the one right of it.  This means we could write this number as 6 X 1 + 7 X10 + 8 X 100 + 9X1000.  Another way of expanding this even more is to write  6X1 + 7X10 + 8X10X10 + 9X10X10X10.

If you notice on the picture below each digit I assigned a D with a subscript.  The subscript can be thought of as the number of 0’s in the power of 10 or a better way to think of it is the number of times 10 is multiplied by itself.  (Anything to the power of zero = 1).  This also continues the same way on the right hand side of the decimal point.   For example if the number was 9.876 that would represent 9X1+ 8X1/10 + 7 X 1/100 + 6 X 1/1000.  This numbering system is called the decimal system and is based upon 10 different number values from 0 to 9.   Although I probably just described all of this with more detail than you have heard before, if you spend some time thinking about it, it will all make perfect sense.   The one thing that may bother you is  that we are starting counting at zero and not at one.  That is a little hard to wrap your head around because we are all used to counting on our fingers, but it is an important concept as we move into binary.  The smallest number is zero.

Now we move on to the binary numbers.  In binary there are only two number values, 0 and 1.  *Usually this represents off – on or sometimes high – low.  Since there are only two values, each place of the number represents a power of two. So 1101 represents 1X2x2x2 + 1X2x2 + 0x2 + 1×1 or 1×8+1×4+0x2+1.   If you add all of that up us humans would read the value as 13.  (I am skipping hexadecimal numbers right now, because it is not needed where we are going.)   Just like I did with the decimal digits, the b’s below each place holder have a subscript number.  That number describes the place but it also tells us how many times 2 is multiplied by itself to get the multiplier.

Now, imagine that these digits are to the right of a decimal place.  b3 would represent 1/2, b2 would be 1/4, b1 would be 1/8, and b0 would be 1/16.  Probably an easier way to think of this is to calculate the value of the bits as we did above and then divide it by all by the divisor used for the smallest bit (b0).   So the value for the number would be 13/16.

Now that I have probably thoroughly confused you it is time to start thinking about how the converter works.  Imagine we are playing a game, I am thinking of a number from 0 to 15 and I will tell you if your guess is greater than or equal to the number, (≥) or less than (<) the number.  It is your job to do it in the fewest guesses.  Probably you would start with the number in the middle, 8.  This would divide all the possibilities in half. On the next guess divide the remaining portion in half and guess either 4 or 12.  This would continue on until you got the final value.   That is exactly how a successive approximation A to D converter works.

A 4 bit successive approximation A-D converter

The diagram shows roughly the inner parts of an A/D converter and most of these parts we have discussed in recent posts. The voltage reference is a very accurate voltage, in this case 5 Volts. The resistor “ladder” is our old friend the voltage divider. We have talked about the summing amplifier and the comparator is basically an op-amp without any feedback resistors. It will produce either a full on or full off output. The sequencing part is the only new part to us.

The operation of the sequencing would be:

A “convert command” signal comes in.
Step 1:  Turn off all outputs and open all switches.  Set n= 3.
Step 2: Turn on switch Sn (S3 for 1st iteration) and compare the output of the summing amplifier to Vin.
Step 3:  If Vin ≥ the summing amplifier then leave Sn on and turn on bn.  Otherwise turn off both Sn and bn.
Step 4: n = n-1
Step 5 if n >= 0 go to step 2 and repeat. If n < 0 then set the conversion complete output and stop.

For a real example.  We will make the input 4.1 Volts.
We turn on S3 and the output of the summing amplifier is 2.5V
Since 4.1 > 2.5 we leave S3 on and set b3 to 1.

We next turn on S2 and the output of the summing amplifier is 2.5 + 1.25 or 3.75V.
Since 4.1 > 3.75 we leave S2 on and set b2 to 1

We next turn on S1 and the output of the summing amplifier is 3.75 + 0.625 or 4.375V.
Since 4.1 < 4.375 we turn s1 off and leave b1 at 0.

We next turn on S0 and the output of the summing amplifier is 3.75 +0.3125 or 4.0625V
Since 4.1 > 4.0625 we leave S0 on and set b0 to 1.

We set the conversion complete output.

Our answer in this case would be 1101 or 13 in decimal.

Because the example is only a four bit A/D we were only able to divide the possible answer into the nearest 1/16.  Each additional bit would double the resolution.  A five bit would provide a resolution of 1/32, a six bit would provide 1/64, etc.  8 bit A/D are very common and provide a resolution of 1/256.  Most of the industrial control equipment I worked with had 12 bit A/D and provided a number from 0 to 4095.

So what are the important points to remember?
1st:  The A/D converter has some “graininess” and changes a continuous value signal into a series of stair steps.   This is the resolution of the A/D.

2nd to make the most of an A/D our Voltage in needs to operate as close to possible the full range of the A/D.   A/D’s expect different full voltage values, some are 0 to 1 V, some are 0 to 5 V and some are 0 to 10 V.  Some can handle negative voltages also.

3rd our signal needs to be linear in relationship to what we are measuring.  For example, if we measure temperature and the signal only changes from 0 to 0.25 V from -4 deg F to 50 deg F but changes from 0.25 V to 10 V from 50 deg F to 120 deg F, we are not going to be able to detect the low temperatures very well.  Those will be lost in the resolution of the A-D.

All of the above show why it is very important to get the analog signal correct before going into the digital world.

This post threw a lot at you in one post, take your time trying to understand it all and feel free to post comments with questions or to e-mail me with your questions.




Print Friendly

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>