Figure 1. Calibrator has simple user interface and requires only 12 I/O lines from the microcontroller
Figure 2 presents the analog section of the calibrator. The key part is LTC2641, a 16-bit DAC from Linear Technology with differential and integral linearity ±0.5 LSB each (typical values). Offset and gain errors are 2 LSB max and ±2 LSB typical, respectively.
The other parts in the circuit are of corresponding grades. MAX6225 is a 5-V reference with 1-mV (0.02 %) tolerance and 2 ppm/oC drift. OPA2277 is a dual high-precision op-amp with a maximum offset of 10 µV and drift of 0.1 µV /oC. The four 20-kΩ resistors are matched with ratio tolerance of 0.01 % and temperature coefficient of 25 ppm/oC. The on-resistance of the analog switches is only 1 Ω, 0.005 % of the value of the matched resistors (important for resistor R4).
The two switches provide four ranges: 0-5; 0-10; ±2.5 and ±5 V with resolution of 76.3 or 153 µV. The micro selects automatically the most appropriate range for the desired output.
Figure 2. Three precision ICs, four matched resistors and a simple micro build a DC calibrator with 16-bit resolution and 70-µV error
Operation is simple and intuitive. The Rst button resets the output voltage to 0.0000 V. The Sel button selects a character (sign or digit) on the display and makes it blink. The Up and Dn buttons modify the value of the blinking character. When the Go button is pressed, display stops blinking. The micro calculates a 16-bit number and sends it to the DAC. It also decides about the logical levels for the analog switches and sends them out. Error messages are displayed when the desired voltage is less than -5.0000 V or greater than 9.9998 V.
Circuit performance is tested with a 6.5-digit DMM from Keysight (former Agilent Technologies). As Figure 3 shows, the maximum error is ±70 µV, half of the 153-µV resolution of the circuit for the 10-V spans (0-10 V and ±5 V). For the 5-V spans, resolution drops in half and the error follows at ±40 µV max. These are the minimum possible values one can obtain with a 16-bit DAC and a 2.5 or 5 V reference. Errors fit well the 100-µV resolution of the display. The AC component for all tested voltages is 0.000 mV.
Figure 3. A 64-point calibration shows absolute error of ±40 µV for the 5-V spans and ±70 µV for the 10-V spans
Calibrator uses the open frame concept to reduce price and weight (see Figure 4). The mother board measures 82 x 67 mm (3.3 x 2.7 in). It carries most of the components and two connectors: a 16-pin connector for the display and a 20-pin connector for the micro.
Figure 4. Calibrator uses open frame design with one mother and two plug-in boards
How to make it
The mother board is designed with EAGLE; design files are available here. If you wish, you can replace the 20-pin connector with a connector that fits the board of your particular micro. You can also remove the connector and place your micro on the mother board. The two options allow you to use any microcontroller you like.
Once you have the board you have to design the firmware. The code has two major sections: initialization and a button service loop.
The initialization stage does the following:
- Set up I/O ports of the micro
- Initialize display
- Put a welcome greeting on the display for few seconds
- Place the value of 0.0000 V on display (it is actually a string you send out to the LCD)
- Generate output voltage of 0.0000 V with the analog section
The button service is organized as an endless loop. The micro scans the buttons all the time. When a depressed button is found, the following actions take place:
The Rst button:
- Place the value of 0.0000 V on the display and generate output voltage of 0.0000 V
The Sel button:
- When the button is pressed for the first time, the sign character on display starts blinking.
- If the Sel button is pressed again, the next character will blink. If the last character is currently blinking, start over with the sign character.
When the Up button is pressed, reaction depends on what character is blinking:
- If the sign is blinking, reverse the sign
- If a digit is blinking, increase the value of that digit by one. If the current value is 9, the new value should be 0.
When the Dn button is pressed, reaction depends on what character is blinking:
- If it is the sign, reverse the sign
- If it is a digit, decrease the value by one. If the current value is 0, the new value should be 9.
The Go button implements the following table.
The steps are:
- Ignoring sign and decimal point, convert display string into a number NLCD
- Based on the sign of the display string and the value of NLCD, define the range number presented in the second column of the table.
- When the range number is from 1 to 4:
- Calculate NDAC (the number to be sent to the DAC) using the formulas in the third column of the table.
- Send out NDAC to the DAC
- Send out control signals to the switches as presented in the last two columns of the table
- Return to the beginning of the button service loop
- When the range number is 5 or 6, display error message and return to the beginning of the button service loop
You can use either C or assembly language to write the code. With C language calculations are easy and development time is relatively short; however the machine code can be quite large. This means larger program memory for the micro and higher price. Assembly language goes the opposite way: small machine code and easy communication with the I/O devices, but hard calculations and longer development time.
Keep in mind that the DAC is very linear, but offset and gain errors are relatively large. To get the best performance from your calibrator, check it with a good DMM (6.5 digits or more). If errors are larger than 38 or 76 µV (depends on the range), adjust the numbers you send to the DAC. Simple offsets can do the job.
Just as a reference, I used a MicroStamp11 microcontroller from Technological Arts and wrote the code in assembly language. The machine code requires 1550 bytes of EEPROM and 34 bytes of RAM. Due to the long numbers, multiplication and division are emulated with shift–add and shift–subtract instructions. Small offsets had to be included for three of the four ranges to minimize the error of the generated voltage. The SPI interface to the DAC is also emulated using the general-purpose I/O mode of the output ports of the micro.
This paper was previously published by EDN in May 2017