Analog-Digital: SAR

A successive approximation register (SAR) is a register that repeatedly makes “guesses” and records the results of those guesses. In an A/D, the SAR is driven by a clock signal, and is n bits wide (where n is the digital resolution). The SAR is accompanied by a D/A, which reads in the bits of the SAR. The D/A produces an analog value that is compared to the analog input, as can be seen below: 

This implementation of the A/D takes a certain number of rounds to complete. Recall that the SAR records the results of each guess it makes. How the SAR does this is by going bit-by-bit when making guesses, hence successive approximation. The SAR operates similarly to a binary search algorithm. A binary search is an algorithm that continuously divides a sorted list into halves until the desired value is found. For example, if we had the following (sorted) array: {7, 6, 5, 4, 3, 2, 1, 0}, and we wanted to find the value 1, we could use a binary search to find the value. First, we find the middle value (which could be 3 or 4, but in this case, will take the higher of the two values for reasons that will become apparent later) and compare it to our target. 4 is greater than 1, so that means our target must be in the lower half of the array. We can then reduce our pool to {3, 2, 1, 0}. The middle value of this array is 2, which is still larger than 1. We then divide the array again and look at the lower half: {1, 0}. The middle value of this array is 1, which is greater than or equal to our target value. Thus, the target must be in the upper half. We divide the list once more and are left with {1}. The sole element in this array is the target value we were searching for.


Notice that the array in the example contained all possible values for a 3-bit number. Also notice that the middle value of that array was chosen as 4, which is also the weight of a 3-bit number’s MSB. When we divided the array once, the middle value of the array became 2, which is the weight of a 3-bit number’s second bit. Finally, dividing the array one more time resulted in a middle value of 1, which is the weight of a 3-bit number’s LSB. Indeed, this is how an SAR makes guesses toward the correct analog value: by comparing the input analog voltage with the MSB, recording which is higher, then making another guess with the next bit in tow, recording the result again, and so on until all bits have been determined.


For instance, let the digital resolution be n = 4 and Vin = 10 V. The SAR first makes a digital guess of 1000 and feeds it to the D/A. The D/A produces an analog value of 7 V, which is lower than Vin. The SAR records the MSB as 1 and makes its next guess: 1100. The D/A produces the value 12 V, which is greater than Vin. Thus, the SAR records the second bit as 0. The next guess made is 1010, which the D/A converts as 10 V. This is equal to Vin, so the SAR registers this bit 1. Although we could theoretically stop here, the SAR is designed to keep guessing until the LSB is determined. As such, the SAR makes its last guess: 1011. The D/A converts this value as 11 V, which is larger than the target value. Thus, the SAR records the LSB as 0, leaving the SAR with a digital value of 1010.


What we can note from this example is that the SAR takes n amount of rounds to complete its successive approximations, no more, no less. As a result, the SAR has a consistent conversion rate, regardless of the value of the input voltage. In other words, converting any voltage value within the full scale voltage range will take the same amount of time as any other value. Thus, we can establish a conversions-per-second rate for a given SAR A/D. To do so, we have to determine the total amount of time it takes to complete a single conversion.


Let’s take an A/D with a digital resolution of 8, where R = 100 kΩ, C = 47 pF, and one SAR round takes 4 µs. Conversion can be broken down into two components: acquisition and successive approximation (which we’ll refer to as SAR for simplicity). So we can say that the time it takes to convert an analog value is the acquisition time plus the SAR time. Acquisition time is calculated by (n+1) * R * C * ln(2) = 9 * 100,000 * 47e-12 * ln(2) ≈ 29.3 µs. Each SAR round takes 4 µs to complete, and the SAR takes n amount of rounds, so the total amount of time would be 4e-6 * n = 4e-6 * 8 = 32 µs. In summation, the conversion time is 29 µs + 32 µs = 61 µs. To find the conversions per second, we simply take the reciprocal of the number, or 1 / 61 µs ≈ 17,393 conversions per second.


SARs have a good balance between speed and cost, being relatively quick to convert but also cheap to build. However, it does have a notable flaw when we compare it to our conventions of analog-digital conversion. Suppose we had an A/D where n = 3, Vref- = 0 V, and Vref+ = 14 V. What would be the digital conversion of 9.5 V? First off, the LSB Voltage would be (14 - 0) / (2^3 - 1) = 14 / 7 = 2. Knowing this, we can calculate the digital approximation. D = floor((Vanalog - Vref-) / LSB Voltage + 0.5) = floor((9.5 - 0) / 2 + 0.5) = floor(5.25) = 5. So we know that the digital output must be 101.


Now, let’s use successive approximation to determine the digital output. We start with 100, which is equivalent to 8 V, which is less than 9.5 V. Thus, our MSB is 1. We then compare the value of 110, which is 12 V, to the input, where the input is less than the guess. So the second bit must be 0. We then guess 101, which is 10 V. The guess is greater than the input, so the LSB must be 0. We end up with an answer of 100 instead of 101, as we previously determined. Indeed, in cases where the analog value must be rounded down to get the digital value, the SAR produces no error. However, when the analog value should be rounded up, the SAR produces an error of D-1 (where D is the correct digital value).


The following Matlab script shows the process of SAR. You can change the variables to see a different outcome. The screenshot below shows how the Matlab script works. You set the Vref_minus and Vref_plus as Vrefm and Vrefp and set the digital resolution n. In the below example, these numbers are 0, 14, and 5. Then, you set the vin, the analog input. In this example, it is 11.5V. The Matlab script first calculates the LSBVoltage, which is the 1LSB (shown on the right). It then shows for each bit index (starting from MSB, here i = 4), what the sar (digital guess), and guess (analog guess) until it discovers all the bits. Lines 34 to 39 show the heart of the code, where the new guess is generated based on the old guess depending on if the guess was too high or too low. 

You can also take a look at this google spreadsheet that implements a full SAR process. If you hover your mouse on the top right corner of the below spreadsheet, you should be able to click on an arraow that says "open spreadsheet". Once in the form, you can download it as an excel file and change the parameters in the top row to experiment with different scenarios.

SAR