DIY ACV/DCV calibrator with AD5791 - Page 1
Forum section: electronics / general

author: Micke
author_rank: Regular Contributor
timestamp: June 04, 2020, 09:39:51 am
content: Just wanted to share my latest project!(Thought of putting thread in Projects section, but thought it belongs better here, if not, please move!)It is a Precision voltage source with AD5791A/B.Feel free to copy or just get inspiration from! (I include Gerbers, Schematics and source code)Output max +/- 14V or 10VAC Sine wave (20Hz to 2kHz in 7 steps)Maximum load is 150mA.My version has three boards:1) 10V Voltage reference LTZ1000A (1k/13k) [2-layer 100x160mm] (pictures before anti-air draft caps on LTZ1000 in place)2) CPU board with dsPIC33EP512MC506-I/PT running at 128MHz (64MIPS) [4-layer 100x100mm]3) D/A board with AD5791B and LT1010 output buffer [4-layer 100x160mm]Source code is compiled with Hobbyist version of CCS C ($99, then I added support for 33EP512MC506 for additional $20).http://www.ccsinfo.com/product_info.php?products_id=c-workshop-compilerA dsPIC33EP128MC202 (narrow 28pin DIL) can also be used, this is supported in the Hobbyist compiler, just change pin definitions and recompile!Go easy on me, I am a HW guy, not a programmer!There is a pin header on D/A board that connects directly to BusPirate, I used a BusPirate to get familiar with AD5791 before writing the PIC program.http://dangerousprototypes.com/docs/Bus_PirateFor generating ACV, a 128 points sine wave table is stored in ROM and scaled down to get arbitrary voltage, and then a copy is put in RAM. At the moment the frequencies supported are 20Hz, 50Hz, 60Hz, 100Hz, 500Hz, 1kHz and 2kHz. Generating higher than 2kHz is not possible right now with 128 points sine table and 15MHz SPI.SPI data speed is getting high, every voltage change requires 24 bits of data being sent, multiplied with 128 voltage levels for one period, multiplied with the wished frequency...My first test version was with a less performing AD5791A and AD581LH reference instead of LTZ1000A. Luckily there were no errors on PCB and the D/A worked directly, puh! To be easy to solder, 0805 size SMD components are default.To control it, just connect a serial cable with settings 115200,N,8,1 and use HyperTerminal, TeraTerm etc. Menu system will show up in terminal.There is also the possibility to add a 4x20 VFD/LCD display, program is outputting display data as default. Serial and/or parallell display can be connected.On the D/A board, the only connection between Analog and Digital ground is underneath the D/A, there is no soldermask on PCB to be able to solder a wire. There are strict zones between analog and digital, no wires or components in wrong zone on any layer. There is also galvanic isolation of the SPI-bus (which runs in 15MHz on the dsPIC33).

author: Micke
author_rank: Regular Contributor
timestamp: June 04, 2020, 09:47:57 am
content: D/A Board

author: Micke
author_rank: Regular Contributor
timestamp: June 04, 2020, 09:48:44 am
content: CPU Board

author: Micke
author_rank: Regular Contributor
timestamp: June 04, 2020, 09:49:22 am
content: LTZ1000A VREF BoardYes, it is Precision Wire Wound Ultrohm Plus 802 resistors from Edwin Pettis!Put copper tape around the critical resistor dividers, LTZ1000 temperature setpoint and 10V stepup.

author: Yansi
author_rank: Super Contributor
timestamp: June 04, 2020, 10:07:04 am
content: Very nicely done project. I love it!Just a stupid question: Why 82.5nF? Or is the frequency compensation that critical to achieve something?

author: Micke
author_rank: Regular Contributor
timestamp: June 04, 2020, 10:43:36 am
content: Thanks Yansi!The reason for 82.5nF was as simple as that I had many on handBut I did calculate that I should be in that neighborhood according to a formula I found somewhere on the Internet...

author: jbb
author_rank: Super Contributor
timestamp: June 04, 2020, 09:27:38 pm
content: Oh nice.Not too complicatedandin a nice box.I have a couple of questions / comments:What's the main power supply? Mains frequency transformer? (Sorry if you already said...)You've got a few precision resistor stages in there (7V->10V, 10V->-10V, output amp). Would it make sense to use a +-7V reference for the DAC to avoid one set?The AC output seems to have some glitches on DAC update. Are these glitches in line with the DAC spec, or is it something else? (e.g. opamp slew, ringing in DAC or opamp supply rail ferrites+capacitors)The proposed 14V output buffer (LT1010) might clip against +15V rail. You should check for dropout specification, and have a look at supply rail tolerancesMaybe - maybe - consider separate regulators for the output buffer. That way the external load current won't perturb the internal supply rails.I'm not sure how important AC generation is to you, but I have some thoughts:Looks like some filtering is required :-)For spectral purity, you want very good timing of the DAC update. At present, I guess that timing comes from the SPI transfer. If the SPI transfer is started by software, you could get jitter. Driving the LDAC pin from micro controller timer output (via isolator) could be a very effective way to tighten that up.At lower output frequencies you should be able to do >>128 samples per period. In fact, I think you want to, so that the noise inherent in the sampled sine wave is pushed up to a higher frequency and easier to filter out.Some kind of Direct Digital Synthesis (DDS) might be good here: you can get adjustable frequency with fixed update rate.

author: Yansi
author_rank: Super Contributor
timestamp: June 04, 2020, 10:02:05 pm
content: I have also couple other stupid questions:I see the analog opamps in there (AD867x) have 12uV Vos. What is the specific reason for using these, instead of a chopper amp, that should have much less drift and offset? Is the 1/f corner noise the issue or what? I am certainly no precision instrumentation designer, so trying to figure out.Would be interesting to see if a less-precise version with LM399 could be made similar way, with cheaper components. (I happen to have couple of those references) and already thought about making a portable calibrator, but with high voltage output capability (with HV amp on the output).

author: jaromir
author_rank: Unknown
timestamp: June 05, 2020, 08:51:50 am
content: Absolutely lovely project. It's obvious you spent your time spit-and-polishing the thing.What I really appreciate it's finished, working and documented project, being of rare occurrence here. Well done!I have some additional questions, to clear up some design particularities:1, The most obvious one - did you measure the linearity and stability of your calibrator? I know this task is non-trivial, but still, design verification is part of the design. Also, it could be interesting to compare AD5791A and AD5791B.2, Could you, please share internal view of the enclosure? For precision stuff, thermal design is quite critical, even for "low power" devices like multimeters or simple reference sources; when dealing with power stage it's even more prominent - that's why I'm curious.3, The enclosure looks really good - is that custom made enclosure or you repurposed existing one? Googling for "xflash max" logo visible on front panel didn't bring obvious results.4, What connectors have you used for voltage output?5, LT1010 does have 2,5-3V of saturation voltage at output current 150mA (both polarities), supplying it with +15V may not be enough to get +14V of output at 150mA. It should be fine at lower output currents. How does your prototype behave in this aspect?

author: Kleinstein
author_rank: Super Contributor
timestamp: June 05, 2020, 09:43:00 am
content: Quote from: Yansi on June 04, 2020, 10:02:05 pmThe offset of the AD867x is not that critical. If at all it is about the offset drift and low frequency noise. For much of the range the reference would have considerably more drift and noise. A reason to use a BJT based OP here could be the higher frequency noise and also the speed, so that the settling after DAC steps is fast. AZ OPs produce quite some higher frequency spikes. Without filtering these may get to the output. A high BW for the AC function limits the filtering, even if using only some 2 kHz. Chances are a modifies software could get a little higher frequency (e.g. maybe 10 kHz) with less sampling point.Cost wise the LTZ1000 reference is only one part. The AD5791 DAC tends to be even more costly.So a lower cost version would probably also use a cheaper DAC (e.g. maybe AD5781 - still not cheap).

author: Micke
author_rank: Regular Contributor
timestamp: June 05, 2020, 10:59:32 am
content: Quote from: jbb on June 04, 2020, 09:27:38 pm

author: Kleinstein
author_rank: Super Contributor
timestamp: June 05, 2020, 12:16:04 pm
content: Using the DDS principle (fixed sampling frequency and calculating the phase in steps) can give fine control over the frequency, but it can also effect the amplitude stability. For higher frequencies one would still need filtering. So for a calibrator the way with fixed table with an integer number of points per period and repeating the table is probably better. The 128 samples sound like a reasonable compromise, though 64 or 30 points could still be OK if higher frequencies are more important.Skipping the 7 to 10 V step and use a single amplification behind the DAC is an option. This way one could also skip the extra buffer for the 10 V. The extra buffer for the 10 V it only needed to generate the -10 V, with the 7 to 10 V amplifier and 10 to -10 V stage on different boards.In principle the LT1013 from the LTZ1000 circuit could directly drive a 7 V to -7 V stage.

author: Micke
author_rank: Regular Contributor
timestamp: June 05, 2020, 05:05:45 pm
content: Quote from: jaromir on June 05, 2020, 08:51:50 am

author: SilverSolder
author_rank: Super Contributor
timestamp: June 05, 2020, 07:51:32 pm
content: Looking at your work, @Micke, is like admiring art at an exhibition! Thank you for sharing & inspiration.

author: jaromir
author_rank: Unknown
timestamp: June 05, 2020, 08:56:44 pm
content: Thanks for clarification and some more pictures.Also, I took a look at your sources and found similarity to my programming style. You decide whether it's praise or insultWhen testing the load regulation, apart from short test you may want to try power dissipation/temperature stability test. Set output to something like 10V, so you have a lot of headroom from 16,2V. Load it with maximal current and log the output voltage (HP34410 should be OK for this test). I guess you may expect two processes to happen - first is fast voltage sag, caused by uncompensated internal resistance of your circuit (ground lead) or voltage drops on PCB traces. Notice that at 10V and 150mA, every 66 microOhms of path resistance will cause 1ppm error. 10cm of 1mm diameter (approx. 0,8mm cross-section, 18AWG) copper wire has resistance roughly 2mOhms.That is the part that is somehow easier to remedy by having two separate force and two differential sense terminals. On the other hand, the heat dissipated (from linear output stage of LT1010 plus losses in power supply) will also warm up your circuit and possibly cause voltage drift (drifting resistors in voltage dividers, reference or offset voltage of opamps, thermal EMF). This may take minutes to hours to stabilize. You may also insert temperature probe inside and calculate the temperature coefficient. At this point, one may be tempted to do temperature compensation, but it may be tricky thing to do properly.I don't know how much of a drift you'll observe, perhaps this is non-issue, but I think it's interesting experiment to do with tools you have on hand.Fortunately, usually one don't need much of a current from a voltage calibrator, so this may be not a problem for usual mode of operation, though useful to know.

author: Micke
author_rank: Regular Contributor
timestamp: June 05, 2020, 09:38:00 pm
content: Quote from: SilverSolder on June 05, 2020, 07:51:32 pmThanks SilverSolder! I have myself got lot of inspiration of people sharing things, hopefully someone get some inspiration from my project!I thought of adding extra features, like an extra resistor divider to have like a 100mV range, but wanted to try basic functionality first...But I am very happy it worked straight away, even if buying the "cheaper" AD5791A it would have hurt if destroying it due to an "upps" in schematic or layout...

author: Micke
author_rank: Regular Contributor
timestamp: June 05, 2020, 10:05:44 pm
content: Quote from: jaromir on June 05, 2020, 08:56:44 pm

author: jbb
author_rank: Super Contributor
timestamp: June 06, 2020, 12:46:41 am
content: Quote from: Micke on June 05, 2020, 10:59:32 amYeah, it's quite a lot of updating.Maybe you could use DMA transfers to send the SPI updates? That way you could calculate the appropriate sequence of raw DAC words (i.e. sinewave sample * calibration gain * desired output voltage + calibration offset)once, place them in RAM and use DMA to transfer them to the SPI port on timer pulses. Also frees up a lot of CPU time...Quote from: Kleinstein on June 05, 2020, 12:16:04 pmThat's true. In almost all cases, the DDS phase increment and truncation will not reliably hit the top & bottom DAC values every cycle. It seems like DDS is often used for RF applications where frequency and harmonic control are more important than amplitude control.However, it might be possible to use special cases to achieve good results. I.e. if the master clock falls at a convenient frequency, we could get an exactly integer frequency word setting which also happens to be an exact fraction of the phase length...Hmm. For 50 Hz output, how about 204,800 Hz update rate with 4096 steps per cycle? For 60 Hz, a 245,760 Hz update rate also with 4096 steps per cycle. Oh, that leaves us needing a variable frequency update rate, which could be done but might be annoying...Maybe a separate wave table for different output frequencies would work better?(I think that some of the really special equipment these days generate precisely adjustable sample clocks by chaining up an RF DDS generator (for variable frequency) with an analog phase locked loop (for jitter removal). Seems like a lot of work...)Quote from: jbb on June 04, 2020, 09:27:38 pmOn second thought, this might not help as much as one would like, because there is still the matter of providing stable Zener (and temperature sensor / buffer transistor?) drive currents, so benefits may not be as much as one would hope. I'm absolutely not an expert here...It seems to me like you can at least relax a bit on absolute resistor ratios as long as they are stable. Stable gain errors can be calibrated out.

author: Kleinstein
author_rank: Super Contributor
timestamp: June 06, 2020, 07:41:50 am
content: Quote from: jbb on June 06, 2020, 12:46:41 amDirectly using a +-7 V (e.g. 2 x LM399 in series) reference is not that easy. One would still need to have a 1:1 divider for the center to fix the zero. With LM399 references 3 in series to get some +-10.5 V may be possible and save on the amplification.One can combine the 7 to 10 V and +10 to -10 steps in a way to avoid ground current and have one precision resistor less, but a little more influence from one OP. Another downside is that one has no longer 2 equal resistors to set the zero.Anyway the boards are beautiful made, so why redo it just to save a few parts.With just 2 terminal output there will always be some sag if there is heavy load. So the heavy load case can not expect the highest accuracy, but it can still be useful if just a low noise source is needed. In this sense one may even consider to optionally enable some filtering (switch in a capacitor for C33) to choose between low noise and high accuracy for the AC part.For the output stage it may help to add some constant current load to the output of U6, so that it's output stage is in class A mode and avoids cross over on transients. This may help a little with the ringing, so that at least the ringing would change less with direction and step size. With the LT1010 as power stage a much faster OP would be problematic.

author: Micke
author_rank: Regular Contributor
timestamp: June 07, 2020, 06:22:12 pm
content: Quote from: Kleinstein on June 06, 2020, 07:41:50 am

author: jbb
author_rank: Super Contributor
timestamp: June 07, 2020, 06:45:51 pm
content: Erm, before going to town on the output buffer stage, have you checked the VOUT_DAC waveform? The buffer stage might be carefully amplifying a real signal...

author: Kleinstein
author_rank: Super Contributor
timestamp: June 07, 2020, 06:58:06 pm
content: The response to the steps has 2 parts: a fast one with quite some overshoot an likely ringing and a considerably slower approach to the final value, more like an exponential.The slow part is probably due to C31. Here one could get away with even less to get a faster approach and could get less amplitude if there is some additional capacitance (e.g. 30 pF) at the other half of R30 too.In any case a fast amplifier with feedback directly from the output and thus low output impedance is tricky. To make it tolerate some capacity at the output one kind of needs some impedance, at least at the higher frequency end. There is a reason why higher frequency AC usually has some 50 Ohm output impedance and not near zero impedance.

author: Micke
author_rank: Regular Contributor
timestamp: June 07, 2020, 07:55:26 pm
content: Quote from: jbb on June 07, 2020, 06:45:51 pmDid some measurements like a week ago, was curious as you say if the buffer introduced garbage or was happily amplifying garbage...Will continue with more measurements...Blue trace is before LT1010 (TP26), and Red trace on J6 connector.

author: RikV
author_rank: Regular Contributor
timestamp: April 30, 2021, 03:40:48 pm
content: Are there some evolutions in this project?I am considering building it. Is there any more recent Gerbers? Bill of material (for LTZ1000)? Firmware?Any test results?

author: Micke
author_rank: Regular Contributor
timestamp: April 30, 2021, 09:13:50 pm
content: Hi!No more evolutions so far, I did though plan for an add-on with a resistive divider to give more accurate results in the hundreds of milliVolts range...Bought some resistors from Ebay:https://www.ebay.com/itm/111726905871https://www.ebay.com/itm/111928514332https://www.ebay.com/itm/121841204486Plan is to use an output from MCU to enable a bistable (latching) relay when wanted output is under like 100mV, the resistive divider with a chopper opamp will be enabled dividing 10V to like 100mV (depending on resistor ratio).No more recent Gerbers, the ones I posted are more up to date than the ones I ordered, for example the pinning for LT1010 was wrong on my boards, but is corrected in the attachments.Have not done a BOM for LTZ1000 board, please see schematics, but is according to LTZ1000 datasheet, nothing new really! Any 10V reference can be used.Source code for PIC MCU is attached in my second post, source code can surely be greatly improved!jitter when generating AC for example...I have done measurements, unfortunately my best test equipment I have access to is a Keysight 34465A and Agilent 34410A, but test results looks good, can see if I can gather some results and post!

author: RikV
author_rank: Regular Contributor
timestamp: May 31, 2021, 04:16:38 pm
content: Thanks for the response, Micke. I'll keep you informed of my advances. LTZ1000 will have to wait (a long time) but I have a 10V source at hand based on 2x LM399. Tha should work for the beginning.

author: mawyatt
author_rank: Super Contributor
timestamp: May 31, 2021, 07:07:56 pm
content: Micke,Your design is at another level in performance, nice work!! We did a lower performance calibrator based around the LM399 a few years ago, mostly for a learning experience rather than a precision reference. The output was amplified up to 10 volts, then a 6 equal value resistor 10X divider (3 series, 3 parallel, so 3R to R/3 resistive divider) used to get 1V buffered by a unity gain chopper amp, then this output brought down to 0.1V using another 6 resistor divider and chopper amp.Just 3D printed a case, and also did a 3D case for a LTZ1000 & LM399 combined version but this doesn't have a 1V or 0.1V output just zener voltages and 10 volts outputs. Don't have any results yet (busy with other projects), been "aging" the LM399s and now just started on the LTZ1000 "aging", so far seems to be settling in.Anyway, the 6 resistor divider seems to initially work OK with inexpensive 0.1% 15ppm resistors. Will see how these hold up over time once we begin taking data with the KS34465A which is our best DMM.Had you considered using a chopped precision voltage (ideal squarewave) as an AC reference? We did this in another design test concept awhile back and used a FF to assure 50% duty cycle, should give same readings for Average DC and AC and ideally be 1/2 the reference.Best

author: Micke
author_rank: Regular Contributor
timestamp: June 01, 2021, 10:42:29 am
content: Thanks mawyatt!Yes aging LM399 and LTZ1000 indeed takes some time!When I built the first LTZ1000 references I had access to a calibrated 3458A, did measurements every day during workdays, did a "ACAL DCV" before each measurement and logged the measurements in a spreadsheet, voltage dropped every day, but after like 2000h it seems to have settled quite good. I still have them powered 24/7, started March 2017! But unfortunately no 3458A now...Regarding AD5791, did dome measurements with AD5791A+AD581LH with a just one month old Keysight 34470A, below 1V or so the performance is not just that good, so am planning to add extra resistor divider and chopper amp. I attach measurement as xls and a PDF. Might be my AD5791B+LTZ1000 is behaving better, will do similar measurements and compare!Have not yet thought of your idea of chopped precision DC voltage, but good idea to be able to get higher frequency! My limit right now is 2kHz and with jitter as bonus...

author: aronake
author_rank: Frequent Contributor
timestamp: April 10, 2023, 11:05:04 am
content: This looks awesome! I will build one of these.When uploading gerbers to JLCpcb I get errors that board outline can not be identified. It seems by keying in the size of the boards this will be solved.Do anyone know or can find out the dimensions for the 3 boards?Regards,Aron

author: aronake
author_rank: Frequent Contributor
timestamp: April 10, 2023, 11:11:28 am
content: Quote from: aronake on April 10, 2023, 11:05:04 amI opened the gerbers in the gerberviewer in Kicad and could find what seems to be the dimensions. In case anyone else want to know they are:LTZ 160 X 100 mmCPU 100 X 100 mmDAC 160 X 100 mm

author: aronake
author_rank: Frequent Contributor
timestamp: April 20, 2023, 03:38:17 pm
content: Hi Micke,Awesome project! I now have the boards and plan to build one. Any updates since last posts here on firmware etc? Any other considerations or things to think about that has not been mentioned here?Hi all,Anyone else who build this and have experiences to share?

author: Micke
author_rank: Regular Contributor
timestamp: April 20, 2023, 08:45:45 pm
content: Thanks Aronake!No, I have not updated the firmware unfortunately, I have found it to work "good enough" for my needs!I use the unit at work from time to time, very useful device!Have you been able to source AD5791? It has been out of stock for a long time "everywhere"

author: Kleinstein
author_rank: Super Contributor
timestamp: April 21, 2023, 06:34:14 am
content: If availablity is an issue, TI has the DAC11001 as a rather similar alternative, though not pin compatible.

author: aronake
author_rank: Frequent Contributor
timestamp: April 21, 2023, 08:26:55 am
content: Quote from: Micke on April 20, 2023, 08:45:45 pmThanks!Arrow claim to have one.https://www.arrow.com/en/products/ad5791bruz/analog-devicesPretty expensive though.... About same price as an evaluation board with ad5791.....My bet is that by the time I have put most other components in place, they will be more available. This may, or may not be a winning bet....