﻿ THE PULSAR Engineering
Published: 2011-11-25 | Category: [»] Electricity & Electronics.

Analog-to-Digital conversion is frequent in electronics and a lot of specialized hardware has been designed for it. One of the properties of ADCs is their resolution, usually expressed in bits. An 8 bits ADC code the voltage on an 8-bit integer which ranges from 0 to 255 or -128 to +127 depending if it is unsigned or signed respectively. As a consequence, the smallest readable signal is of 1/255 (or half that for signed version which gains the sign +/-) for 8-bits ADC. 8-bits, 10-bits, 12-bits and 16-bits ADC are common although other resolution may be met with some devices.

It might be tempting to systematically choose the ADC with the largest resolution but it will not always be possible nor even desirable. For example, most [∞] Microchip PIC microcontrollers have 10-bits ADC so wanting more resolution means investing in (sometimes expensive) hardware which also make the circuit design more complex. Also, not all process requires a high accuracy in their measurements and other features such as read-out speed, voltage span at input, noise levels etc. becomes more important.

Input voltage span is one of the most annoying issues when working with ADCs because some have severe restrictions on it. For instance, many PIC microcontroller limits their input voltage to 0...Vref with Vref tuneable but usually restricted to the range 2.5-5V. With these devices, measuring negative voltages or voltages above 5V is troublesome and requires op-amp to adapt the voltage range to suit the microcontroller need. To illustrate this, imagine a process which outputs a voltage going from -10V to +10V. To use it with an ADC that requires the input to be in the 0...5V range, you first have to divide the input voltage by 4 and to offset it with 2.5V. Then, in software, the resulting read-out should be multiplied by 4 and 10V subtracted from it. Concerning the resolution, it is equal to the voltage span (20V) divided by 2n where n is the bit resolution. For a 10-bits ADC, it would have been about 20 mV.

But what if we are not happy with this 20 mV resolution? What if we want more? Should we exclusively buy an ADC with more bits?

The answer is no. There exists a simple trick to increase the resolution of an ADC with a few cheap components. It allows adding 1 bit to the conversion per stage but I would not recommend using it for more than doubling the ADC capacity. Also, it is best used to increase a positive-only voltage ADC to a positive-and-negative voltage input.

The concept is to use a full-wave rectifier and a voltage comparator to first know if the signal is positive or negative and then get the absolute value of the signal (that is, a -V...+V signal is reflected back to 0...+V). Obviously, this requires using one I/O pin from the microcontroller as input to read the voltage comparator output. The overall concept is shown on Figure 1.

An interesting note should be made on filtering. All filters should be put before the rectifier circuit because the latter introduces non-linearities and hence high spectral content. Imagine a signal slightly going from +15mV to -15mV that we would be filtering with a low-pass filter placed after the rectifier. When the signal goes into the rectifier, it abruptly switches of behaviour when it reaches 0V and the filter would react to this by slowing the behaviour down. The output would then accumulate some kind of lag and the result would be a complete mess-up! This is why it is important to place your filter before the rectifier, just like if our added circuit were part of the ADC hardware.

Still, all this hardware will introduce a bit of noise that will reach the ADC. This is why I placed a second low-pass filter (a simple RC system can do the trick) to cut-off noise. Feel free to adapt the cut-off values depending on your specs!

The complete circuit (without the low-pass stages) is given on Figure 2. It is composed of three blocks, namely a full-wave rectifier, a 0V comparator and a 0V tuning unit. The 0V comparator simply uses an op-amp with high gain and a classical NPN transistor to adapt the output voltage for the microcontroller. Because the comparator might have a small dc offset voltage, it is important to be able to tune the 0V position through the 0V tuning circuit which is a simple potentiometer connected to a regulated 5V input with an inverter to create a -5V at the opposite side of the potentiometer. Finally, the full-wave rectifier takes the absolute value of the input voltage to send it to the ADC. All resistors of the rectifier should be matched to a 0.1% to avoid distortion in the output (use an ohm-meter to match resistors from a large batch so you don't have to buy expensive 0.1% resistors). The resistor marked with a * can be changed to set the gain of the circuit. Using a 10 kΩ resistor will set the gain to unity. Apart from the resistor-matching process, it is extremely simple to build and is cheap with its sole TL084 chip.

[⇈] Top of Page