Monday, December 14, 2020

DIY 16-bit precision voltage source with MAX5717A DAC

If you need a precision voltage source, you have three options. You can spend thousands of dollars and buy a lab instrument from a reputable company, you can spend hundreds and get an amazing enthusiast-grade device from Ian Johnston, or... If you're a cheap ass like me, you can build your own device that might just be enough for your use case at a fraction of the cost, and with hours and hours of fun included for free. Guess what we're going to do!


Yeah, you guessed it, we're not spending the money.

Before you continue reading, a few words of caution. I have no idea how to build voltage sources, in fact I know barely anything about electronics. What you're about to see is my first ever build of anything that involves a DAC or precision electronics of any kind. If you want to own a properly designed and well built voltage source that you can trust, get the PDVS2mini.

Now, the requirements are simple:

  • The device is a voltage source, not a power supply. It will only be used in ultra-low current situations (driving MOSFET gates, multimeter testing and calibration) and I won't be powering anything with it.
  • It must provide 1 mA resolution with an error of <0.2 mA across a voltage range from 0.1 V to 4.9 V.
  • Long-term stability is not an issue. If needed, I can re-calibrate the device in software.

Hardware components

For this project, I'll use the following components:
  • 9 V battery as power source, but anything between 8 V and 12 V will work just fine.
  • Arduino Pro Mini, 5 V / 16 MHz version.
  • MAX5717A 16-bit digital-to-analog converter from Maxim Integrated (datasheet).
  • REF02 5V voltage source from Texas Instruments / Burr-Brown (datasheet).
  • An OLED display from Adafruit (link).
  • Miscellaneous parts: a rotary encoder, a button, SPDT slide switch, a DC barrel socket, capacitors and pull-down resistors as shown in the schematic below.

For the microcontroller, my choice of the Pro Mini is mostly driven by size and it being "good enough" for the job. It also has a built-in 5 V regulator, which I'll use to power the OLED display and the DAC.

The voltage source of choice is REF02 5 V reference from Texas Instruments. It comes in a 8-pin DIP package readily compatible with breadboards and protoboards. I was originally planning to use a 4 V LM4040 reference from Adafruit, but I found that it's unable to drive a DAC without a substantial voltage drop. The REF02 worked just fine instead.

Regarding the DAC...

Why the MAX5717A

I did consider using other DACs before deciding on the 5717A.

I looked at MCP4725, which is a very popular 12-bit DAC, but it's not nearly accurate enough for my requirements. With 12 bits and a 5 V range, the resolution comes down to 5000 mV / 2 ^ 12 = 1.22 mV: much worse than needed. Not only that, but the INL (integral nonlinearity) is +/- 2 LSB (typical) and +/-14.5 LSB (max.), way higher than what my spec can tolerate.

I then considered the AD5664R from Analog Devices as it's probably the only 16-bit DAC for which there already is an Arduino library. With 16 bits of resolution, a single step is ~0.076 mV at 5 V range, which is just enough for the use case (max. 0.1 mA error). I finally decided against using the AD5664R due to horrible INL of +/- 8 LSB (typ.), +/- 16 LSB (max.).

I finally came across the MAX5717A, which I found to have the following advantages:
  • It's an inexpensive chip (~$10) with 16-bit resolution.
  • The INL spec of "A" grade chips is 0.25 LSB (typ.), which means I pretty much get true 16-bit accuracy out of the box and should be able to meet the ~0.1 mA error spec without issues.
  • It has a stupidly simple programming interface. No modes, no special commands, just send 16 bits  over SPI and you get voltage on the output pin.

Out of the three chips I considered, the MAX5717A ended up as my final choice. This may not be the ultimate chip for this use case, but it more than meets my spec while not being any more expensive than the other two.

Component preparation

The MAX5717A DAC is the only component that needs extra prep work. The chip comes in a SO-14 package with 1.27 mm pin pitch:




Since I'll be using it on a protoboard, I had to solder it down to an adapter like so:



Soldering was easy enough, even using my 2 mm chisel tip. Just tape the chip to the adapter, apply some flux around the pins, and touch the outer end of the adapter trace with the tip until the trace gets hot enough to melt the solder. If you place the solder close to the pin, it'll flow nicely and connect the pin with the trace. For the record, I used a 0.6mm 60/40 solder for this particular job, versus the 0.8 mm general purpose solder I use for everything else.

Board layout

The board layout is designed to meet two requirements. The control components (knob and button) must be convenient for a right-handed person without obstructing the screen, and the analog paths must be as short as possible to reduce noise.

For the DAC side, I'm using the reference design taken from MAX5717A datasheet. The only difference is that I don't use an external op-amp because I won't be powering anything off the DAC and I'm OK with the current capability provided by the DAC itself.

Here's the reference design for the DAC:



And here's the complete diagram for my board:

Schematic created with EasyEDA


The assembled board presents itself as follows. Wiring is sandwiched between two protoboards connected using brass standoffs. I also stuck some rubber bumpers on the bottom so that the whole thing won't slide across the desk. If you're curious about the wet-looking blob in the bottom right corner, it's just silicone-based conformal coating that I applied all over the underside wiring and some IC pins that could potentially cause issues when touched.



You'll notice that there are no proper terminal blocks for the output. I used a 22-gauge solid core tinned copper wire instead, which will resist oxidation fairly well. The hook-shaped connection points are very easy to use with mini-gator or hook clips.


Software and user interface

The device software isn't complicated, but it's a bit too lengthy for a copy & paste. See this  GitHub repo for the complete firmware code with some comments: Arduino_MAX51717A_Vref_Example

The user experience and interface is simple:
  • Press the button to enable/disable voltage output. Note that the DAC is always powered on, so what I mean by "disable" is "set output to zero volts but remember the voltage setting".
  • The device starts in OFF mode with voltage set to 2.5 V.
  • Press the rotary encoder to toggle setting granularity between 100 mV, 10 mV, and 1 mV. The current granularity setting (digit) is underlined on the screen.
  • Turn the rotary encoder left or right to increase or decrease voltage setting by one digit at the highlighted position. Voltage setting can be adjusted whether the output is on or off.



Performance testing

I don't have access to lab-grade voltage references or calibrators, so used my most accurate meter for all tests: the Siglent SDM3055 5.5 digit digital multimeter. This is also the same meter I measured the voltage output of the REF02 voltage reference with, which is then used for software calibration (see referenceVoltage in the firmware code).

I let the multimeter as well as the DUT (device under test) warm up for 30 minutes, then I did a sweep across the voltage range (0.1 V - 4.9 V) in 100 mV steps and recorded the results:





Not bad at all. The performance of the final device is well within my spec (0.2 mA error) and definitely much better than I had expected from an amateur build like this.

This is it, thanks for reading!


1 comment: