Author Topic: DIY highly linear 12-bit PWM digital-analog-converter, pointers please  (Read 18577 times)

0 Members and 1 Guest are viewing this topic.

Offline RandallMcReeTopic starter

  • Frequent Contributor
  • **
  • Posts: 541
  • Country: us
Re: DIY highly linear 12-bit PWM digital-analog-converter, pointers please
« Reply #75 on: March 25, 2018, 11:00:42 pm »
At long last, I have a tested and working prototype of the PWM Dac. I tested only the IXDD609 gate driver and it works well.

I updated the first post of this series with the schematic and its also on github. Minor changes, only.
https://github.com/RMcRee/12-bit-linear-pwm

Attached is a photo of the prototype which is constructed using a ground plane and wire-wrap. Photo too big--posting separately.


Also attached is a pdf of some preliminary data.
Dac clock is 10Mhz OCXO from HP 5334B counter. Dac VRef input is 10volts from Fluke 731B.

The yellow columns are keithley 2015 measurements of selected codes. Note that, as expected the first code, 1, is 0.002743 as opposed to its theoretical value of 0.00244141. This is the only code that deviates much and is, I guess expected. The other columns calculate the DNL for these codes and show good agreement with ideal. Especially considering that measurements were taken by hand under strenuous conditions: arduino simply output codes sequentially and I wrote them down ASAP. Especially for the higher value codes the calculations are limited by the resolution of the meter.

Have been playing with it and repeatability and stability are excellent. Need to get my GPIB logging going again.
 

Offline RandallMcReeTopic starter

  • Frequent Contributor
  • **
  • Posts: 541
  • Country: us
Re: DIY highly linear 12-bit PWM digital-analog-converter, pointers please
« Reply #76 on: March 25, 2018, 11:03:37 pm »
Photo of prototype....

 
The following users thanked this post: cellularmitosis

Offline TiN

  • Super Contributor
  • ***
  • Posts: 4543
  • Country: ua
    • xDevs.com
Re: DIY highly linear 12-bit PWM digital-analog-converter, pointers please
« Reply #77 on: March 26, 2018, 10:59:40 am »
Cool.
That amount of packages already begging for use of small CPLD instead  ;)
YouTube | Metrology IRC Chat room | Let's share T&M documentation? Upload! No upload limits for firmwares, photos, files.
 

Offline RandallMcReeTopic starter

  • Frequent Contributor
  • **
  • Posts: 541
  • Country: us
Folks,
While working on this 12-bit PWM I saw a lot of ideas around the web for ways to make a high-resolution DAC by combining two PWMs. There is a thread sort of about this here:
https://www.eevblog.com/forum/projects/high-resolution-dual-pwm-dac-with-notch-filters/

The "problem" with virtually all of the ideas I have seen previously are that they rely on a resistor ratio to properly 'mix' the two PWMs in the correct amount.  The design in this thread allows a, different (obvious) way: for exactly one count out of every N (4096, here) mix in the other dac output via a switch. This is nice since when using a counter, the carry out signal of the counter+FF is exactly the switch control.

Advantages:
    No (evil) resistors are needed. You do need a fast analog switch, of course. Seems like the switch tphl vs tplh delta sets the accuracy;
    any sort of other DAC is fine, of any resolution. It could be PWM, R2R, etc.

Hopefully, the description is clear. I doubt that this is original but, like I said, have not seen this documented elsewhere. So here it is. Pretty sure it will work but I have not tested except in my head!

Randall

 
The following users thanked this post: cellularmitosis, montemcguire

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14181
  • Country: de
For mixing in the fine DAC / PWM with an extra switch one would still need a resistor of some kind. It just is a resistor of same size as opposed to one 4096 times larger (or a comparable attenuator). So I don't see an advantage with using PWM type attenuation to set the ratio with resistors.

The scale for the fine corrections only needs to as accurate as the resolution used for accuracy of the fine part. If for example the overall DAC is something like 16 Bit coarse +  12 Bit fine the mixing resistors only have to be stable for 12 Bit accuracy. If the fine part is actually higher resolution and a little larger range this could be used to do the scaling by math and only a stable resistor ratio, but no accurate value is needed. In this case it might help to have a little extra HW to do the adjustment measurement internally. This could be comparing two settings to produce the nominal same value. It is a good self test and would reduce the requirements on the resistors from long time stable to shorter time scale (next "ACAL").

Higher resolution for the coarse part helps to keep the requirements for the fine part moderate. So it makes sense to use the higher PWM resolution modern µCs offer.
 
The following users thanked this post: cellularmitosis

Offline RandallMcReeTopic starter

  • Frequent Contributor
  • **
  • Posts: 541
  • Country: us
Quote
For mixing in the fine DAC / PWM with an extra switch one would still need a resistor of some kind. It just is a resistor of same size as opposed to one 4096 times larger (or a comparable attenuator). So I don't see an advantage with using PWM type attenuation to set the ratio with resistors.

No resistor necessary. I don't have a schematic at hand so let me just describe this:
The coarse PWM uses a 4053 type switch, say. It has an INH input (pin 6). Hook this up to ~ONE-COUNT. Your new SPST analog switch is just on/off and is controlled by ONE-COUNT signal. The SPST switch output can be directly wired to the 4053 output common since they are never on at the same time. (Of course, depending on the switches chosen you may get away with just one control signal since INH is negative logic and most switches are positive logic, but you get the idea).

Hope its clear, now.
Edit: fix bad signal name.
« Last Edit: May 02, 2018, 01:25:09 am by RandallMcRee »
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14181
  • Country: de
I still don't fully understand the idea with the enable, but I am afraid this would involve rather short pulses and this will be a problem. To get good accuracy one has to avoid anything like a second switching in the time before the ref. buffer and similar have settled after any switching event. So there is kind of minimum length or likely a few µs, maybe 10's of µs if the buffer is not very fast. Using more switches also introduces switch resistance, which is even worse than true resistors as it usually has a high TC.

Anyway I don't see a problem with the scaling resistors - the ratio only needs to be as stable as the extra resolution added by the fine part. With enough overlap (so that the fine parts covers a little more than 2 coarse steps) one could even use some dithering, so that the resistor value would not be relevant over the long time average. Just a minute extra low frequency part with the amplitude of the resistor error: Over a longer scale the coarse part would produce the full resolution with dithering between 2 states. The fine part would correct to the best it can the resulting low frequency contribution from dithering.
 

Offline RandallMcReeTopic starter

  • Frequent Contributor
  • **
  • Posts: 541
  • Country: us

Yes, fast switches will be necessary for accuracy. But switches seem to be getting faster and having lower Ron on a regular basis. So I think this technique will make a lot of sense in the future. At 100 nS it seems marginal today.

But the advantage here that you are not seeing is that the Ron of the switches looks into the low pass filter (we could/should for example set the initial R of the low pass filter to the value R-Ron). So, insofar as overall accuracy the switch Ron and TC as well only change filter characteristics--and not very much at that. Analog filter wizard shows how R and C changes affect overall filter and it is minor. Attached is 5% R/C analysis.

So, again, the PWM accuracy is principally set by the switch speed (not Ron) and frequency stability (orders of magnitude better than any resistor matching).
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14181
  • Country: de
The switches can still have an effect on filtered PWM accuracy. One effect it Ron matching for high and low signal. As R_on is rather temperature dependent, it is difficult to compensate with normal resistors.
The effect is not with changing the filter function (this effect is not relevant), but about a different resistance for the two levels - this would give a nonlinear contribution, as the current flowing during the H/L phase dependents on the average voltage with the normal low pass filter.

Another point is charge injection this will produce an extra spike. In first approximation this will be just a constant offset, but charge injection can depend on voltage / current and thus the level used. Another effect of charge injection it that the reference buffer will show some ringing / settling response. To a small part this can depend on the current flow, which would be bad. So the reference buffers are also important.

The resistor ratio for adding the fine part only needs to be stable to the contribution of the fine part. With sufficient resolution of the coarse part this will be only on the order of 0.01% - so the requires accuracy for resistor stability is not that high.  R_on is more like 0.1% of the filter resistor and thus R_on matching is more critical than this. I would consider a configuration with 12 Bit coarse and 12 Bit fine a poor choice. A better configuration would be more like 16 Bit coarse and 10-12 bits fine with 1-2 Bits of overlap. To avoid interaction between coarse and fine switching it might even be a good idea to use a conventional DAC for the fine part.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf