el cheapo reference generator - Page 1
Forum section: electronics / projects

author: dannyf
author_rank: Super Contributor
timestamp: April 07, 2015, 01:16:52 am
content: Finally decided to test out various ideas for a reference generator.It is fashioned after the Linear AN86, closed loop reference generator corrected via an adc.Wanted to try out the use of pwm as dac - but the code should be written so it is easy to switch to a real dac.The main control unit is a mcu - PIC24F, with its four pwm output channels -> so I can output deferentially, both positive and negative, under unipolar power source.Here is the conceptual drawing.

author: dannyf
author_rank: Super Contributor
timestamp: April 07, 2015, 01:20:49 am
content: Here is the refgen, running open loop and outputing 200 -> 20 bit total, 10bit lsb @ 3.3Vcc-> we should be getting 639mv output, vs. 624mv.

author: dannyf
author_rank: Super Contributor
timestamp: April 07, 2015, 01:28:06 am
content: I only generated one channel of 10-bit pwm output.Next:1) combine two channels of pwm output to form a high resolution output;2) explore higher order pwm filtering.

author: dannyf
author_rank: Super Contributor
timestamp: April 07, 2015, 01:30:36 am
content: BTW, the output is very stable -> even at 0.1mv (smallest that my meter can go), it barely moved a single digit.The low-pass filter has a very long time constant - the readings stopped moving after 30 - 45 seconds -> this is the price to pay for a pwm dac.

author: AlfBaz
author_rank: Super Contributor
timestamp: April 07, 2015, 01:41:08 am
content: Seeing you can change the duty cycle between pulses have you tried increasing resolution using this technique?

author: Kalvin
author_rank: Super Contributor
timestamp: April 07, 2015, 07:37:11 am
content: Dithering might provide few extra bits. "PWM resolution enhancement through dithering technique"http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00119042.pdfDual PWM and higher order PWM analysis:http://www.openmusiclabs.com/learning/digital/pwm-dac/dual-pwm-circuits/

author: dannyf
author_rank: Super Contributor
timestamp: April 07, 2015, 10:44:17 am
content: QuoteThat's an interesting circuit. I don't quite buy its argument (for the error cancellation part) but will give it a try. The use of digital gates vs. opamps is helpful.

author: macboy
author_rank: Super Contributor
timestamp: April 07, 2015, 02:20:25 pm
content: If you use PWM for the upper range, you will always have problems with the PWM noise. Remember that you are shooting for a resolution 10 bits (1000 times) better than a single step of your (upper) 10-bit PWM signal. A better idea is a 'real' DAC for the upper x bits and PWM for the lower x bits. Then the residual PWM noise will be down hopefully well below the least significant (20th) bit. The real DAC can be a simple one, just 12 or 14 bits. Make sure it is monotonic and you probably want to use an external reference (or use one with a really good stable internal reference and a ref out pin).Speaking of the reference, I get the impression that you are just using the 3.3 V supply of the PIC as the reference (filtered PWM output is some % of the supply). This is fine to begin with when playing with code, but when you are serious about making a stable accurate DAC, you will need to use a real, stable reference, and use the PWM signal to switch that reference.In your first schematic, don't forget that you need to scale the LSB DAC output down by a factor of 1000 or so. You also need some overlap so that you can set and forget the MSB DAC, and adjust only with the LSB one, so for 20 bits of resolution, you probably want two 12 bits DACs giving 4 bits of overlap, or a 14 bit DAC for MSB and 10 bit (PWM one) for LSB. You need that overlap.Don't forget that the PWM signal will be controlled according to feedback received from an ADC measuring the overall output, so you can't make the RC time constant of the PWM filter too long, or the control loop will need to be made to be horribly slow. You don't want to have to wait several minutes for the final value to settle, and you also need to be able to respond to variations thatwillbe caused by small temperature changes, drafts, etc.This is not impossible but you are far from it. Fluke used PWM techniques to get down to ppm accuracy in the 5440A/5440B and other calibrators.

author: Kalvin
author_rank: Super Contributor
timestamp: April 07, 2015, 02:36:19 pm
content: A cheap Microchip Dual 12-bit DAC might be sufficient for a 20-bit design. For example, 8-bits for MSB and 12-bits for LSB. Anyway, PWM solution is an interesting one and worth testing.

author: macboy
author_rank: Super Contributor
timestamp: April 07, 2015, 02:42:55 pm
content: Quote from: Kalvin on April 07, 2015, 02:36:19 pmNo, you must have significant overlap. For 20 bit resolution, use a total of at least 24 bits worth of DACs.

author: Andreas
author_rank: Super Contributor
timestamp: April 07, 2015, 08:01:15 pm
content: Quote from: dannyf on April 07, 2015, 01:30:36 amnot really, it needs only some 10 ms when using a integrator:http://www.edn.com/design/other/4326640/DC-accurate-32-bit-DAC-achieves-32-bit-resolutionhttp://m.eet.com/media/1133099/14856-figure_1.pdfWith best regardsAndreas

author: Kalvin
author_rank: Super Contributor
timestamp: April 08, 2015, 12:40:33 pm
content: Just for a reference, here is one thread discussing high resolution (not high precision) PWM DAC:https://www.eevblog.com/forum/projects/general-purpose-power-supply-design-7488/135/Discussion starts somewhere at page 4 and continues well beyond page 10.

author: dannyf
author_rank: Super Contributor
timestamp: April 08, 2015, 04:45:29 pm
content: Thanks. Nice find.

author: Marco
author_rank: Super Contributor
timestamp: April 24, 2015, 10:34:38 pm
content: Could you do something analogous to Kelvin Varley with PWM? Have 2 16 bit PWMs with R-C filters, add two series resistors and then select between those outputs with a multiplexer to a capacitor with a third PWM signal?PS. I guess in a much smarter way this is what the EDN "32 bit" PWM DAC does ... calibrators like the Fluke 57LFC seem to just add two PWMs together with resistor dividers instead though, I just don't understand how they can get good monotonicity like that, won't that introduce errors when the LSB PWM DAC ticks over between FFxxFF and 00xx00? It seems to me this can't be linear by design but relies on the quality of the resistor networks and calibration. Or am I not thinking it through right? (I never understood how the EDN circuit worked either, so I probably am.)PPS. the low pass filter in the 57LFC is painfully clever ... look upon it and despair.