Many times, the need arises to interface single-supply analog-to-digital converters (ADCs) and comparators to real-world signals like 5 V. Of course, it's possible to condition the signal using operational and/or instrumentation amplifiers. But few engineers realize that it's often possible to achieve the level shifting using a resistor network (Fig. 1).
Critics of this technique point out that the resistor network can load the source voltage and cause distortion. We can build this limitation into Microsoft Excel to ensure the resistor values don't overload the input. Another possible concern is that some ADCs won't run properly with a high source impedance, so you would probably have to buffer with a suitable operational amplifier.
To calculate resistor values, we need to use Kirchhoff's Law: The sum of currents into a node is zero. Considering the node at the junction of the three resistors, we can write:
As an example, let us assume VDD = 5 V, VSS = 0 V, VIN = 5 V, and the ADC input must go from 0 to 2.5 V. For VIN = -5 V, we want VAD = 0 V. So we can substitute the values in Equation 1:
(-5/R1) + (5/R2) = 0
(2)
For VIN = +5 V, we want the input to be 2.5 V, so substituting in Equation 1:
(2.5/R1) + (2.5/R2) - (2.5/R3) = 0
(3)
We have two equations with three unknowns, leaving one degree of freedom. Now we can go ahead and solve this. If we reduce the generalization so that VSS is always 0, we can rearrange Equation 1 as follows:
Each time we do this though, it's a tedious process. But Excel has a feature aptly called "Solver," which will trivialize the whole exercise once it's set up. To use Solver, you must enable it as follows:
In Windows, go to Control Panel and select the Add/Remove Software option. Select the Microsoft Office entry, and then opt for changing or updating the installation. Find Excel in the list and for the Solver Add-in, select "Run from my computer." Follow the prompts to complete the installation. Now start Excel. Click on Tools, followed by Add-Ins, and enable the Solver Add-In. Follow whatever installation prompts occur (if any).
After loading the worksheet, ADinput.xls, which can be found at www.electronicdesign.com, open it to reveal Figure 2. The input parameters are in cells B5 through B9. Cell B14 contains Equation 1 suitably modified for the minimum condition as follows:
Cells B20 and B21 contain the formula for the input current. Notice that it sources when the maximum input voltage is applied and sinks for the minimum.
To invoke Solver, click on Tools | Solver and then make sure the entry parameters are as in Figure 3. Solver will modify cells B10 through B12, trying to keep cells B14 and B15 at zero and cells
B20 and B21 below and above predetermined project parameters. In this case, the current is limited to ±0.1 mA. You can modify this by selecting the constraint and clicking on the Change button. Note that you can work with two or more target cells by constructing all but one of the targets as constraints.
Cell B18 is used to prove that the resistor values do, in fact, generate the correct voltage range (Figure 4). By changing the value in cell B17, you can see how the value of Vad changes. Cell B17 contains Equation 4. It's possible to use Excel to generate the standard resistor values as well, but this isn't described here.
Recommended Reading:
1. Kagan, Aubrey, Excel by Example: A Microsoft Excel Cookbook for Electronics Engineers, Newnes 2004, ISBN 0750677562
2. National Semiconductor, Datasheet ADC0801, DS005671, Nov. 1999
The article says ADinput.xls can be found at www.electronicdesign.com. I couldn't find the link to the Excel file.
Philipp V. -August 15, 2007
MANY THANKS FOR YOUR FRUITFUL PRACTICAL IDEAS
DE SANTOS -March 25, 2006
well done article Thank You
Anonymous -March 18, 2006 (Article Rating: )
Your Comments:
Enter the text from the image below
Please refresh the page if you have trouble reading this text.
Search Electronic Design
Email Newsletter
Sponsored By:
Electronic Design UPDATE provides readers with late-breaking news, opinions from industry experts, and timely technology stories. It's a unique opportunity to get your product message in front of engineers, engineering managers, and corporate managers while they're reading about critical information online.