Certain types of low-level DC signals can present a challenge when trying to digitize using the internal analog-to-digital Converter (A/D) commonly found on many microcontrollers. These A/Ds typically have limited operating range and reference selection, which forces designers to condition the signal prior to digitization.
As an example, consider an input signal that has a range of 0 to 500mV. Most microcontroller A/Ds cannot accurately digitize all the way to zero volts, and have limited references which do not allow full A/D resolution over such a small input signal swing.
One technique for conditioning such a signal can be designed using a voltage to drive a simple resistor bias network, thereby offsetting the signal from zero. If this voltage can be provided from the same circuit that provides the reference for the A/D, then stability can also be improved.
In some cases, simply biasing the signal off of zero may be sufficient. However, in the above example, additional gain is clearly needed. The problem we will encounter is that any gain we apply will also act upon the offset voltage. With such a small full range signal, applying large gain will not spread-out the signal range enough to sufficiently utilize the A/D range. The following is an example of how to remedy this situation.
By using a Differential Amplifier that is referenced to VCC/2 (AGND) and has one input driven by our biased DC input, and its other input driven by a Digital to Analog Converter (D/A) which is also referenced to AGND. By carefully adjusting the D/A and the gain of the Differential Amplifier, we can cause the overall signal range to be amplified such that the maximum, or at lease larger, range of the A/D can be used.
The following figure shows the circuit connections and basic equations to implement this type of design.
Another possibility is to use a second D/A to produce a variable voltage that drives the bias network. The advantage to having the D/A(s) in the circuit is that the entire system can then be calibrated to compensate for slightly different inputs.
Depending on the specific input signal and range, it is also possible to replace the Differential Amplifier with a Single-Ended Programmable Gain Amplifier (PGA), referenced to either AGND or GND, again depending on the input signal. This allows the D/A to be eliminated. By changing the reference of the A/D, you can shrink its operating range, thereby making your input signal consume more of the active region of the A/D. The specific application will determine the best combination.
The obvious concern with all of the above techniques is that it would normally require external, active components. However one of the most interesting things about these techniques is that they have all been successfully implemented in part, and in entirety, using a programmable mixed-signal array from Cypress MicroSystems, and two external resistors. In fact, everything shown within the dotted-box in the figure, has been implemented in a single device as small as 8-pins.
This device can run without CPU intervention. In this instance, the D/As are essentially static and the CPU processing overhead is non-existent (after initialization). Processing the output of the A/D will of course consume some CPU time. This can be controlled by the sampling rate that you select. Nevertheless, there is still significant processing time remaining, thereby leaving the CPU free to easily perform other functions in the design.