EEVblog Electronics Community Forum

Electronics => Metrology => Topic started by: Kleinstein on May 27, 2019, 08:12:53 pm

Title: DIY high resolution multi-slope converter
Post by: Kleinstein on May 27, 2019, 08:12:53 pm
Here in the forum I already showed some ideas and parts of an µC controlled multi-slope ADC.
https://www.eevblog.com/forum/projects/multislope-design/ (https://www.eevblog.com/forum/projects/multislope-design/)
So here I finally show my multi-slope ADC version as a "complete" project in a separate thread. The hardware side is essentially finished, with still a few resistor/capacitor values to tweak. The board is a little more than just the pure ADC. It also includes the reference (LM399 or LM329), a buffer amplifier and MUX for the input. So it is a limited (only 10 V range with little protection) voltmeter without the display part. Currently a PC is used for display and saving the data. Power is from a 2x18 V (2x15V is likely better) transformer. The 5 V part could use a lower voltage (currently just series resistors).

The software is currently supporting the basic functions including the MUX and a few debugging function. The ADC part sends out raw results via optically isolated UART and the ground referenced side (PC) is doing the conversion to the final result.

The hardware side is relatively simple, with an µC (Atmel Mega48) for control, xx4053 switches and 7 OPs. For the performance mainly 1 OP and 6(7) of the resistors are important. However even with simple parts (e.g. TL072 OPs for the integrator and 100 ppm/K resistors) the circuit works surprisingly well. The OPs given in the plan are the ones currently used.

The circuit shown is a slightly simplified version of the test board - leaving out alternative and optional parts and the ISP connector. I know the plan is not easy to read - sorry for that.

The optional extras on the board are other resistor / reference foot prints, alternative canned oscillator, a few more caps, a LM393 comparator to detect overflow, an input buffer before the MUX for 1 channel, a simple current source and an optional buffer for the ground return current at the ADC.

From the hardware side the ADC is a little similar to the HP 34401:
- switching via xx4053 at the integrator input. Here using 74LV4053 as a slight upgrade.
- a 2 OP integrator (essentially standard), but with more modern OPs.
- using a µC for the auxiliary ADC, though a more modern one with integrated memory.
- using continuous integration instead of a reset of the integrator. Instead of starting from zero the initial and final charge is read by the µC internal ADC.

Different from the 34401, there is no ASIC and the control is directly from the µC. The main difference is that my version also includes a more classical rundown phase and this way reaches a higher resolution and in part due to the more modern OPs a lower noise. So the ADC is in between the classical multi-slope ADC like used in the Keithley 2000 and the continuous integrating variation of the 34401.

The software side is a little tricky, as the program uses the program speed for timing and thus is written in ASM with careful check for the timing. However it is only the actual conversions that are so time critical. So the time critical parts are essentially ready.
Besides the actual ADC conversions, quite some code is there for 2 internal calibration measurements. One is to measure the ratio of the reference currents. The other is to measure the scale of the µC internal ADC relative to the reference currents. With measured ratios there is no need for special and accurate resistor ratios, except 3 reasonable (e.g. 1%) equal resistors for the integrator input.

The PC side program is currently written in Turbo Pascal. The software assumes a build in RS232. So for modern PCs it would need to be rewritten, e.g. to support an USB to UART bridge. The functions are not that complicated, and even a simple µC like the AVR should be able to do the job (though it would help to have a 2nd UART or USB interface).

Despite the simple hardware (about as simple as a good multi-slope ADC can be) the noise of the ADC itself is quite low. Currently I get a little below 1 µV RMS for 1 PLC auto zero readings, good enough for 7 digit resolution and often more limited by the reference.

Compared to a normal DMM the input MUX (DG408, optional DG508) has quite some leakage currents and there is not much protection. A practical voltmeter would need either a lower leakage mux, an amplifier instead of the buffer and more protection. An alternative extension is an additional amplifier (AZ) and protection stage in front of the board - this is more like the intended extension of the board. The ISP connector could also be used to control such a front end.

So far I have only done a partial linearity test. The result looks promising, with low local linearity errors. However the test does not include all INL sources (especially thermal effects) and is not sensitive to a more smooth background, e.g. a square or cubic contribution. A full INL test is still open.

So far I don't see a reason why linearity should be much worse than the 34401, except for the resistors currently used.
So the choice of resistors can be a topic if really good linearity and stable gain is wanted. The test data shown below are with not so good resistor matching, leading to a gain drift of some 12 ppm/K. I consider this bad luck for 15 ppm/K class resistors - it was better before, with simpler resistors.
 
The current board has a few bodges, but not that many.
While basically running there are still a few parts unfinished or open to improvements:
- better decoupling / ground routing (especially better EMI tolerance)
- optional parts on the board (e.g. comparator for overflow )
- speedup of the rundown from currently some 200 µs to maybe some 60 µs.
- use better resistors for low INL (U³ part) and gain drift
- faster conversion mode like 1 ms (needs fast UART interface, maybe shorter data format)
- accurate adjustment of integration time for better hum suppression
- control for external front-end
- PC software: change to C (with a µC) or Python (for the PC or Raspberry)

The attached files are:
1) Circuit diagram (simplified)
2) ASM code for the AVR + Pascal code for the PC (ziped)
3) Plot of data: relative size of reference reading versus diode voltage as a temperature sensor.
The data are dots with 20 ms integration each, during warm-up for some 15 minutes. 
4) Head of sample data file (with some added comments)
Title: Re: DIY high resolution multi-slope converter
Post by: SilverSolder on May 28, 2019, 12:58:12 am

Awesome project.

How do you perform an INL test?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on May 28, 2019, 07:01:22 am
The INL test is a difficult part. For the final test I would have to send a unit to someone with suitable high end gear (calibrator and 8 digit DMM).

The tests I can do are in 2 steps. The first part is testing for possible fine wiggles in the INL curve: I have programmed the ADC to use 2 different versions of the run-up, by using a different modulation frequency. This shifts most of the short range INL errors to a different voltage level. Than a slowly changing voltage is measured with both modes. Ideally both versions should give the same result. Due to charge injection from the switches and similar effects, there is a small difference, that should be constant. So the different of the 2 modes is a good and quite sensitive test for those possible fine wiggles in the INL curve.  I did quite a few such test, especially with an older version that had a not so good run-up part and here the test did show some problems over a rather local range. The newer run-up version essentially solved that problem.
This test is a little unusual and requires the direct control of the ADC, but it is fast and low noise, so it can resolve even small errors (e.g. < 0.1 ppm range) without special gear. As both readings are with the same reference, it is not sensitive to reference noise and drift.  I still have to repeat this test on the new version with a little more resolution / averaging and over a larger range.
A crude first test of this type could also be done by just looking at the discharge curve of a large cap: while not always perfectly following an exponential, it should be reasonably smooth, and local INL errors or DNL errors would show up as deviations from a smooth curve. Attached is such a measurement: the horizontal axis is the voltage with some -400 mV offset and 42 µV steps (ADC internal units = clock cycles worth of the negative reference), the vertical scale is µV.  These are raw data in an non AZ mode. The voltage range  (around 1:1 PMW) is where the older run-up version showed errors in the 50 µV range. In this range also DA related errors would show up, as the average integrator voltage changes quite a bit. So DA is not a significant issue here. :-+

The second group of tests to do is still open. The main INL part to look for is the smooth long range part, like U² and U³ contributions. A first test is the so called turn over test, using an external isolated reference and measure this with both polarities. This kind of tests the even powers. For the odd powers one would need to add an offset, or use more test points and measure differences, checking that the sum of 2 voltages is measured right.  This test requires stable and low noise reference for both the ADC board and the external ones and also thermal EMF can cause quite some extra errors. So while only a few test points (e.g. 10) are needed, this test is not easy and fast. Here a high end calibrator would really help.

Before doing the INL test I have to fix the drift problem - so replace the resistor(s). It looks like one is bad (too high TC).
Title: Re: DIY high resolution multi-slope converter
Post by: jbb on May 28, 2019, 07:57:34 am
I've been following the other thread, and I can see that a lot of work has gone into this.  It's very cool to think that we could build our own equipment to this level of performance, especially if we have a task which requires extreme precision but not the full gamut of a high performance multimeter.

Do you think you could make a brief comment about which parts of the circuit do what?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on May 28, 2019, 09:51:44 am
A few comments on the circuit parts:

The upper left corner part (OPs IC8,IC9) of the circuit is the reference part, with amplification to some 14 V and -13.3 V. The circuit has not much special. Different from many DMMs, there is a little filtering for the reference, as higher frequency noise (some 50 kHz) can contribute to the noise. It is a little unusual that the voltages are not symmetric - both references together are used as an effective 0.7 V level for a smaller slope rundown step.

The power supply part is just normal +-15 V and +5 V from linear regulators, for dual 15-18 V / 10 V AC (mains or maybe switched mode).


The OPs IC11 and IC2 form a 2 OP integrator, to get a really low voltage at the input.  The 2 OP integrator is pretty much standard.
Here IC11 (OPA1641 used, could be OPA145 later) is responsible for the low frequencies (up to some 1 MHz). This OP is the one that needs to be low noise, as the noise of this OP is about amplified by a factor of 2.
The OP IC2 is responsible for the higher frequencies and less critical, it just should be fast. C17 and R20 are there to help with settling of the integrator - the suitable values depend on the OPs used and maybe the parasitic capacitance. C37 is there in commercial circuits - I did not find it helpful, so not populated, but I kept it there just in case. It may be needed if IC11 is a BJT based OP. R10/R11 are effectively reducing the speed of IC11, the right value depends on the OPs used.

The supply for the integrator is isolated via R31/R32, so that at least the AC current flows back mainly through C6 and C14 and thus a controlled path. As an alternative to C6/C14 I have tested a ground buffer (a little like used in the Keithley 2002), that is also powered from the same supply island - but it did not give much difference. So c6 / c14 are just the simpler way. 

The 4053 switch, very much like in the 34401 switches the currents to the integrator. They go either to ground through R35 (ferrite bead) or the integrator. Different from the 34401 I have separate control for the 3 switches and make use of it. As the input current is send to ground or a virtual ground at the integrator, there is no problem to use a low voltage (5 V) CMOS switch even with +-14 V of input voltage and reference. The switches work essentially at zero level. The resistors R1,R2,R3 are the ones I had bad luck with (R1, which is the most critical one has to high TC). Self heating of R1 can be one of the major factors effecting the INL. So in the final version this would need to be a good one (e.g. wire wound or foil or resistor array with R2,R3).

An amplifier like IC4 (NE5534) is called slope amplifier and usually has only 2 diodes (no D10) in the feedback. It amplifies the integrator output voltage around zero and has the diodes for clamping the voltage. The output of IC4 is between some -0.6 V and + 1.2 V. D10 and R23 result in a relatively linear range from about 0 to + 500 mV.
The output of IC4  goes to the µC internal comparator with R40 and R34 for level shifting. This is the "zero-crossing" comparator used for run-up and run-down.
R15 sets the actual trigger level for the comparator.

The OP IC13B gives another amplification of about -20 and has an output limited to 0-5 V that goes to the µC internal ADC.
As the µC internal ADC is slow, it is used with the integrator in stop mode. So IC13B does not have to be very fast - the limited BW may even help.

IC12 with the transistors is an buffer amplifier with bootstrapped supply (currently the bootstrapping part is not yet used). The circuit should work this way, but it might be better to change the lower side of D9 a little. The bootstrapping helps to get very good linearity from a buffer, as the OP sees an essentially constant common mode voltage. The OPA145 was chosen here because it is low noise, reasonable fast and still low current consumption. The heat from the buffer amplifier is a possible source of INL.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on May 28, 2019, 11:19:26 am
Could you elaborate a bit on the mechanism with the rundown and residual ADC measurement, plz?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on May 28, 2019, 05:00:27 pm
A few more details on the control-sequence:

Besides the classical multi-slope with rundown, there is the continuous integrating ADC variation (e.g. 34401 and newer), see US Patent 5117227 (1991).
These ADCs don't use a rundown and integrator reset. Instead they measure the charge in the integrator with an auxiliary ADC, both at the start and at the end of a conversion. The net charge added during the phase in between is proportional to the difference. This avoids the time lost in the rundown, so it can be a good idea at high speed. If the initial charge is sufficiently accurate measured, there is no need to reset the integrator.

The scale factor for this auxiliary ADC depends on the value of the integration capacitor and resistor and is thus not very stable. This limits the useful resolution for the auxiliary ADC to some 8-12 Bit. For high resolution more resolution is needed before reading with the auxiliary ADC. Classically this is with very high modulation frequency, but this path is kind of limited and difficult.

My ADC uses an additional rundown phase to get the extra resolution. This is much like in the classical MS-ADC: the input is disconnected and the references are controlled (still through the µC) from the comparator signal. In my case it is first the stronger, positive reference (for at least 1µs, even if the integrator is already negative), than the negative reference and finally both reference together for a smaller slope. After these 2 steps of classical rundown, the small rest is than read by the µC internal ADC.
So the auxiliary ADC is not to replace the rundown, but only to support it and replace the reset phase.

As the resolution is very good (1 LSB corresponds to some 10 µV at the integrator), there is no more need for a reset. As only the difference between 2 readings of the auxiliary ADC enters the amplifier does not have to be DC stable. Even if one would use a reset (e.g. for a triggered measurement), one would still use the initial reading as the zero-point of the auxiliary ADC.

The rundown and ADC reading can still be reasonably fast: some 60 µs for the actual rundown, some 20 µs waiting for amplifier settling and some 20 µs for the ADC sampling are really needed. Currently there is a separate reading for the end and start and sometimes additionally an auxiliary reading from a different channel (e.g. for temperature). In the classical form the reset phase often takes quite some time - often more than whatI need for the ADC reading.

Overall the resolution is about 10 bits from the run-up, 10-11 bits from the run-down and some 7-8 bits from the µC internal ADC. So there is plenty of nominal resolution so that quantization-noise is not an issue, even down to some 1 ms integration time. It is normal that the final reading of the µC internal ADC is a little noisy - the full resolution is for the internal calibration and possibly future short integration time.

For the run-up part I now use a simple 3 step pattern, a positive, a negative and a variable (depending on the comparator) phase. This is a little like what is used in the 34401 and 3458. The early version with a 4 step pattern (2 variable phases like in US 5200752) did not work well. For some reason there is a tiny difference between the 2 variable phases and in the center of the range this difference really piles up. The basic error behind it is likely still present, but it does not come up over such a short range, but now comes one by one as tiny (e.g. 0.01 ppm range) steps. So it's more like a gain contribution and a little DNL instead of a INL problem from hundreds of such steps at once.
Title: Re: DIY high resolution multi-slope converter
Post by: jbb on May 29, 2019, 05:41:44 am
Thank you for the extra info.  I was wondering what the bootstrapped amplifier was for, and 'getting the best possible input common mode to reduce distortion' makes a lot of sense.

I noticed that some photos in the Projects thread appeared to show a CPLD, but you're now using an AVR and Assembly code to do the timing.  I totally accept that careful assembly code will provide accurate timing, but I wonder whether the reduced latencies of a CPLD offer any benefit?

Also, it looks like you're using the internal bandgap reference inside the AVR for the auxiliary ADC (and maybe comparator?).  These can be quite poor performers, so have you considered the pleasantly ridiculous notion of deriving a reference from the LM399  :-/O?  Or is the drift small enough that it doesn't matter?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on May 29, 2019, 02:02:14 pm
I am currently using the 5 V regulator as reference for the µC internal ADC.  However this µC internal ADC is only good for the lower 7-8 bits (noise wise only 4). So the drift is not that important and for the longer term there is an extra measurement for the scale factor anyway. On the board I have resistors to set the µC reference from the LM399, but not yet populated.

The comparator is using the 5 V for level shifting only, so ideally the effect on both sides would cancel. In addition the comparator is only for the first approximation. A small error from the comparator will be corrected by the ADC reading. The actually used part from the µC internal ADC is only some 7-8 bits, so there is some head room for corrections and comparator drift and noise. The µC internal comparator works surprisingly good, so the first 21 bits set by the classical part with run-up and rundown show very little noise at the edge.

A CPLD could offer a faster reaction to the comparator and thus less latency. This would help a little by reducing the time for the small slope rundown part from currently some 20 µs to some 10 µs, or possibly avoid the slow phase all together.  However the gain cal may still need a fine reference level, this could be through the normal input path. It could also provide a little more resolution from the rundown. However the ADC part can make up for this. The noise limit is at some 24-25 bits, so it does not matter if the nominal resolution (before noise) is at 28 , 29 or 30 bits. On the downside a CPLD would need an external comparator and ADC.  The µC is not that bad with latency (some 6 cycles). The µC does not even need a very high clock - the external clock unit I currently use just happened to be 16 MHz. It also worked Ok with a 8 MHz crystal (going to the faster canned oscillator did not really help much - just a little fast rundown).  The comparator itself can have some extra delay.

For very fast conversions the part of controlling the UART in the background can be a little tricky, so the modulation speed is limited with the µC. Though using quite fast (10 MHZ GBW) OPs the analog integrator seem to be still the limit and I don't see a need for super fast modulation with my ADC.  I currently use some 40 kHz and could go to about 200 kHz - with a faster integrator possibly some 500 kHz. However faster modulation can also cause extra noise and INL. For precision I more prefer a slower modulation.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on May 29, 2019, 04:16:48 pm
Despite the simple hardware (about as simple as a good multi-slope ADC can be) the noise of the ADC itself is quite low. Currently I get a little below 1 µV RMS for 1 PLC auto zero readings, good enough for 7 digit resolution and often more limited by the reference.

Could you please explain a bit more in detail how the noise of ADC was measured?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on May 29, 2019, 05:10:50 pm
Noise is measured with a shorted input (select the zero input or input at GND). The noise is than calculated from the standard deviation value over some 100-1000 samples.  It can be done for a few different cases, that give slightly different numbers:
1)  just simple readings (non AZ). This adds 1/f noise, so noise gets higher with longer time window. One may have to subtract the drift for longer windows.
 
2)  use the difference of 2 consecutive readings (simple auto zero case). This corresponds to the Allan deviation for 20 ms. Ideally 1.4 times the RMS value of single readings, if there is no 1/f noise.

3)  use 3 readings as   U2 - 0.5*(u1+u3) , as a kind of auto zero with a little filtering for the zero (u1 and u3). This should be about 15% less noise than the simple AZ case.

When reading the ADC's own 7 V reference the noise is slightly (some 20%) higher - not sure why. When reading an external voltage the reference noise adds quite a bit of noise.
For a quick estimate 1/6  the peak to peak value can be used for the RMS noise. So one can get an estimate from the curve before that shows the difference to an exponential decay.

So far the readings are usually with 20 ms (1 PLC) integration. If there is not much correlated noise after AZ, the simple AZ reading are independent and thus the noise is expected to go down with the square root on the integration time. So about 1/3 the noise for the average of 10 and 1/10 the noise for the average of 100 conversions. Due to temperature fluctuations and similar there can be slightly higher noise (added 1/f type noise) over longer times. 
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on May 31, 2019, 07:49:34 am
I definitely have to look at better resistors. Currently I have cheap 15 ppm/K class thin film resistor for the 7(6) critical ones. I had hoped for better performance, as the 100 ppm/K grade ones I had used before where about as good. I probably just got lucky there.  Besides the gain drift with external temperature, there is another related problem: the input current heats up the resistor R1 and this changes gain.This gives a u³ contribution to INL.  So the resistor R1 can be quite important, it just has to be linear.

For the resistors at the input, there are resistor arrays (e.g. 4 x 50 K or 8 x 20 K / 50 K) as a good option. However the reference amplification gets a little tricky, as here I need something like 5 K - 5 K and 9.5-9.7 K (or 10.5 K). This is not a standard array, and combining the array and an extra resistor is also not that good.

There is a work around for the resistor effect. One can measure the ADC gain in real time. So the sequence is not just 0 V and signal, but 0 V  - signal and 7 V (raw ref.). This is not a new idea: old DMMs like the Keithley 19x series (and likely the 2001 too) have used this. The down-side is it slows down the measurement and adds some noise. As my ADC is low noise to start with and with only a LM399 reference, this option is not that bad, especially for slower measurements (e.g. > 10 PLC). It essentially doubles the ADC noise contribution for  a measurement at 10 V, but here the LM399 is usually more noisy than the ADC anyway, especially at longer integration when 1/f noise from the reference plays a big role.
Besides the external temperature effect this could also correct for some of the self heating of the input resistor.

The µC part already includes such a mode with a 3 conversion sequence. This mode was already used for the plot in the 1st post. Attached is a curve showing the heating effect. The sequence is  signal - 0 - ref, with the signal either at 0 or 7 V. Plotted is the relative change in the difference ref-0.  Even with a slightly better resistor, there is quite some effect (some 5-6 ppm).

It turned out that the bootstrapped supply for the buffer amplifier is not as simple as it looks. As shown in the plan, it's just at the edge to oscillation (a few more pF of parasitic capacitance can make a different). For stability something like 150 Ohms+1 nF from the OPs supply to ground helps. However this reduces the slew rate the supply can follow and can cause little spikes of current at the input on larger jumps (e.g. 0 V to 7 V).
Title: Re: DIY high resolution multi-slope converter
Post by: jbb on May 31, 2019, 10:58:23 am
The way the +ve and -be resistors are held at constant V / constant I is a really nice feature of this ADC architecture.  If cost were no object, one could buy excellent Vishay resistors...

Is it effective to simply use a larger package to reduce self heating?

Alternatively, is there any mileage in thermally compensating  the R1 temperature rise? Maybe fitting a dummy resistor either side (Rx and Ry) which is driven so that P(R1) + P(Rx) + P(Ry) is constant? Or is that crazy talk?
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on May 31, 2019, 12:56:45 pm
Q1: Do you mean R3 or R1 heats up? R1 is wired to Vref+, R3 comes from input buffer (referring your schematics above).
Q2: why the R1/R2/R3 are of the same value?
Q3: do you use 1n4148 in the power source (graetz)? Those diodes are pretty fast and without parallel caps (ie. a few nF) they may create emi mess in delicate circuits.

Bootstrapped opamp oscillation - in my  "simple AFE" (https://www.eevblog.com/forum/projects/simple-dc-afe-for-adc-chips-with-unipolar-diff-inputs/msg2143462/#msg2143462) simulations I saw the oscillation too. Not always, but at specific input voltages. My AFE has got an opamp to deload the input buffer (low value divider follows). What helped in simulation was to wire a few nF from the Q1/3 base to respective power rail. It could be it is the same in the end effect as you have proposed.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on May 31, 2019, 03:55:30 pm
The self heating problem is with R3 of cause / mixed up the number, sorry for confusion.
It can help to have a larger form factor to reduce self heating. My current board has enough space to use precision wire wound resistors (e.g. Ultra Ohms). One could also use 4 resistors as 2 parallel and 2 in series for R3.  R1 and R2 see an essentially constant current and this way should have no heating problem. The constant current also helps with the reference amplifier / inverter, so the slow OP07 should be good enough.

I also though about power compensation as a last resort, especially with resistor arrays like NOMAC. One could use 2 resistors (e.g. 20 K) in series each for R1-R3 and have the last 2 resistors in parallel for power compensation from a 5 V DAC. The ADC could calculate (use a table) the suitable power based on the measured voltage. Also using the AZ phase gives enough power from a 5 V source.

The input part uses fast diodes, to keep the option to use a high frequency transformer instead of 50 Hz. I don't think fast diodes are a special problem - it is more that slow diodes can under certain conditions cause trouble with reverse recovery spikes in some cases. Currently with a 18 V transformer I have extra series resistors at the transformer to reduce the voltage a little, so no sharp current spikes.

R1,R2,R3 are of the same value, so that the switch resistance (some 70 Ohms with HC4053) has the same proportion to the total resistance. This helps to keep TC matching, otherwise the high TC of the on resistance of some 6000 ppm/K could become an issue. With same resistors the switch parts cancel out to a large part.

In my simulations the buffer problem did not show up, it only happened with the real thing. Loading the output too much is definitely a factor.  For just -11 V one could still use the OPA145 or OPA1641 directly from the +-15 V - they are not that bad with linearity, tough both at different points (the OPA145/OPA140 have higher gain and the OPA1641 has better CMRR).
Title: Re: DIY high resolution multi-slope converter
Post by: magic on June 01, 2019, 09:06:01 am
The PC side program is currently written in Turbo Pascal. The software assumes a build in RS232. So for modern PCs it would need to be rewritten, e.g. to support an USB to UART bridge.
You can read from serial port by opening a pseudo-file named "COM1"/"COM2"/... and reading like any other file. That ought to give you access to all serial ports supported by Windows, including USB.
Baud rate would need to be set manually with the MODE command or Device Manager.
Title: Re: DIY high resolution multi-slope converter
Post by: jbb on June 02, 2019, 05:00:58 am
I remembered an interesting part which could be useful for the input resistor: a SMT chip ceramic thermal jumper (https://www.electronicsweekly.com/news/products/passives/chip-component-gets-heat-tight-spots-without-leaking-electrons-2019-04/).   Maybe sucking some of the heat away from the resistor into the ground plane would help.  Or use them to thermally bond the three integrator input resistors together?
Title: Re: DIY high resolution multi-slope converter
Post by: 3roomlab on June 02, 2019, 05:45:06 am
I remembered an interesting part which could be useful for the input resistor: a SMT chip ceramic thermal jumper (https://www.electronicsweekly.com/news/products/passives/chip-component-gets-heat-tight-spots-without-leaking-electrons-2019-04/).   Maybe sucking some of the heat away from the resistor into the ground plane would help.  Or use them to thermally bond the three integrator input resistors together?
I tried to google thermal jumper, doesnt look like its in production  :-//. not on digikey too
otoh, I remember a vishay article about smd resistors. a 1206 has about 157C/W. so there is no way around this (even with thermal jumper) unless the part is parralleled on a larger copper plane.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on June 02, 2019, 08:23:21 am
For the self heating problem I see several  solutions:
- using precision wire wound resistors with a lower TC and there relative large form factor. I have space for these on the board.

- use a resistor network with good thermal coupling and TC matching. Due to thermal coupling it's TC matching that matters
  I currently have a footprint for a NOMCA resistor network on board - just forgot to order them  :palm:.
 However this still leaves the reference scaling.

- with a resistor array there is the option to use power compensation via software: a 4 th resistor is used to keep the total power per array constant. The µC can calculate the needed power and output that via a 8 bit DAC.

- measure the ADC gain for every conversion, like the old Keithly 19x did. This is especially a low cost option. Due to the very low noise of the ADC the extra noise is not that much compared to a LM399.
 This compensates both the self heating and changes due to external temperature changes, not just for the integrator input, but also the reference scaling.  This option can still be used with better resistors.

For the time being I go for the last version. So just the extra measurement and math.

With separate resistors the thermal coupling tends to be too slow to be really helpful. The thermal time constant is just a little too large to ensure the temperature is the same, not only over a long time. The resistor arrays tend to be small enough to get thermal time constants of less than 1 second for the internal coupling. So the small size of the resistor element also has advantages. It is still not perfect, but should be good enough for the slower measurements where ppm matter. The fast response can be a slight problem for the correction method however, that has a delay of some 40 ms.

There may be an option to use a symmetric reference (so no more odd +14 and -13.3 V) with not much extra noise. With good timing and adjustment of the pot the smaller slope is not really needed.
This makes it possibly to build a next version with just 2 (or maybe 3, as LT5400 is not available in 50 K) resistor arrays of 4 equal resistors each for all the critical resistors.
Title: Re: DIY high resolution multi-slope converter
Post by: razvan784 on June 02, 2019, 10:35:13 am
Quote
I tried to google thermal jumper, doesnt look like its in production  :-//. not on digikey too
They are "on order":
https://eu.mouser.com/Thermal-Management/Thermal-Cutoffs/_/N-5gfz?Keyword=tjc&FS=True
These should be very useful for other things such as thermally equalizing input pads or switch pads.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on June 02, 2019, 11:33:08 am
It had been discussed in the Multislope topic some time back, but let me kindly ask whether the runup is still as follows:

You do 20ms long measurement, 800 phases, 25us each (==40kHz modulation)

Pseudocode:

pos_phase = 0;  // positive REF counter

// do 800 loops, 25us each == 20ms

for (phase_num=0; phase_num<800; phase_num++) {
   
  1. set REFP for 2.5us long;
  2. based on comparator output set REFP or REFN, if REFP then ++pos_phase;
  3. wait 10us;
  4. set REFN for 2.5us long;
  5. based on comparator output set REFN or REFP, if REFP then ++pos_phase;
  6. wait 10us;

}

result_POS = pos_phase;
result_NEG = 800 - pos_phase;

The Comparator output synced with rising clock edge (ie clock = 2.5us period)

Is that somehow correct?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on June 02, 2019, 01:07:12 pm
It had been discussed in the Multislope topic some time back, but let me kindly ask whether the runup is still as follows:

You do 20ms long measurement, 800 phases, 25us each (==40kHz modulation)

Pseudocode:

pos_phase = 0;  // positive REF counter

// do 800 loops, 25us each == 20ms

for (phase_num=0; phase_num<800; phase_num++) {
   
  1. set REFP for 2.5us long;
  2. based on comparator output set REFP or REFN, if REFP then ++pos_phase;
  3. wait 10us;
  4. set REFN for 2.5us long;
  5. based on comparator output set REFN or REFP, if REFP then ++pos_phase;
  6. wait 10us;

}

result_POS = pos_phase;
result_NEG = 800 - pos_phase;

The Comparator output synced with rising clock edge (ie clock = 2.5us period)

Is that somehow correct?

The run-up phase was like this before. The loop with 2 variable phases looks attractive and there even is US patent US5200752 on this. However it caused INL problems, that took me quite some time to find out. For some reason the two variable phases have not exactly the same effect (though the difference is likely more in the short positive and negative rest). The difference is only minute, so it would not matter for a single period, but it does matter in the center of the range when there is a change over from  + - to - + for several hundred patterns over a very small voltage range.

The runup is now a little simpler, with only 1 variable phase and shorter fixed phases:

1 µs  fixed negative reference
25.125 µs positive or negative depending on a comparator reading
1 µs fixed positive reference

So it's only 795 loops and close to 40 kHz. I may have to adjust it a little to get closer to 20 ms integration time to improve on hum suppression. I have not looked at the exact numbers after making it slower and the 25.125 µs are a poor choice, as it would take nearly 796 loops to get 20 ms.

There is still unused code for a version with 4 comparator tests - it likely would not work well for the same reason as the failure of the 2 test version.

I just saw the comments and constant names are a real mess (I used a rename on the constants and that did part of the mess renaming a part that should not be changed  :phew: :palm:) . Some confusion in the comment comes from changing from a stronger negative to a stronger negative reference, when going from the bread board to the PCB version.
So I have to give an updated (mainly improved names and comments) version of the ASM program.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on June 02, 2019, 02:26:52 pm
..
The runup is now a little simpler, with only 1 variable phase and shorter fixed phases:

1 µs  fixed negative reference
25.125 µs positive or negative depending on a comparator reading
1 µs fixed positive reference
..

Ah, ok. So, today, the best result would be with following runup:

You do 20ms long measurement, 800 phases, 25us each (==40kHz modulation)

Pseudocode:

pos_phase = 0;  // positive REF counter

// do 800 loops, 25us each == 20ms

for (phase_num=0; phase_num<800; phase_num++) {
   
  1. set REFN for 1us long;
  2. based on comparator output set REFP or REFN, if REFP then pos_phase++;
  3. wait 23us;
  4. set REFP for 1us long;

}

result_POS = pos_phase;
result_NEG = 800 - pos_phase;

Ok?

BTW, the simulation shows a 60mVpp ripple after REFP/N switching at the integrator's input, which settles in ~700ns, so 1uS is the max I would go. Have you seen something similar in your hw?

The rundown: now, except various ADC measurements you do at various stages, could you describe - in a similar way as we did above - the rundown phase, for example from the point you have passed the above runup and..

1. you switch the input off
2. you ..
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on June 02, 2019, 04:24:16 pm
At the integrator input I get a switching peak of some 50 mV that decays in some 500 ns, so maybe a little faster than the simulation. The 1 µs min pluse ,length may in deed be at the lower end, but so far is see not much INL problems even with only 750 ns.  For a linearity check I compare the result of 2 rundup versions, the second one is faster with 1/3 the total loop length and some 750 ns for the fixed parts. Ideally the difference is only due to charge injection and constant. This test revealed the problem with the 4 step pattern, just it did not directly show what the reason was.

The run down is relatively simple. A µC timer is used as a clock, so that I don't need to count during waiting times. The sequence is as follows in a pseudo code:

set switches to input off and positive reference
start timer from 0
wait a little to get min lenght (min 1 µs)
wait for comparator positive (integrator output negative)
set switches to input off and negative reference
T1 :=  read timer1
wait for comparator negative
set switches to input off and positive + negative reference
T2 :=  read timer1
wait for comparator negative
set switches to input off and no reference  (hold state)
T3 :=  read timer1
Wait for fixed timer value (via OC1A value)
start µC internal ADC
wait for sampling time of ADC (1.5 +1 ADC clock cycles)
Send run-up data to UART buffer
T_pos := T1 + T3-T2    to UART buffer
T_neg := T3-T1 to UART buffer
read old ADC value (before conversion) to UART buffer

In the current form I do 2 more conversions of the µC internal ADC: First the conversion started at end of rundown is waited for. This way the data are already there and the data format can be simpler. Than another conversion for an auxiliary channel is done, to read the average integrator voltage - this gives a hint on possible DA related error. This part is no longer needed (but still left there), as the test showed essentially no DA related error.
Than the ADC is started again for the conversion before the next run-up.

A weak point of the AVR is that the ADC clock runs through and there is no easy sync with this clock. So the constant waiting time does not make that much sense, unless one would make sure the timing a multiple of 64 cycles. It may be an option to simple start the ADC from scratch (with some extra delay for init). The waiting time is needed for the relatively slow amplifier at the ADC to settle and also the fast part of the DA has time to settle. This could be a small advantage over the classical multi-slope ADC.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on June 02, 2019, 05:00:53 pm
This is a typical ripple I see on the integrator's input.
It is with ferrite beads and C17 ser R20.
I updated the .asc in Multislope thread.

Syncing an MCU's ADC with such external events is difficult. Therefore I used to use an external 12bit SPI ADC (MAX...) with its own Vreference, while the ADC was driven directly from FPGA. The actual ADC verilog code and FPGA resources are pretty small.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on June 02, 2019, 07:04:03 pm
The exact timing of the ADC start is not that important. At least with a low bias OP there is not much drift in the hold state. I see about 3 LSB (with 133 LSB corresponding to 250 ns of the slow slope or some 12 ns of the -13.3 V reference) of drift over the time for 2 conversions (a little more than 100 µs). So an uncertainty of some 4 µs is not a real problem.
If really needed, one could start the ADC from a could start (e.g. ADC off during the end of run-up) thus would give a reading some 56 µs or/and some 110 µs from the start.

The waveform shown looks a little better than what I got without C17/R20. With the give C17/R20 and OPs there is a peak, but only little overshoot. So I think a had some luck finding good values with just my 3rd tries. The OP models may not be that accurate in all respects. For the very fast part the open loop output impedance could have some effect - so the TLE2071 may behave quite different from an OPA172, despite of similar GBW. Different OPs (the precision OP is less critical) may need different compensation. Another point can be the switches - LTspice is know not to accurately model switch charge injection. The Ferrite beads I use now are 300 Ohms - my first try after THT types with no data.
Anyway measuring at the integrator input can be tricky - the probe might effect the settling. For this reason i have the test point (LSP6) at the output of IC11 (currently OPA1641) that also shows the settling (as a square wave - more or less the integral of the peak at the integrator input), but with much less sensitivity to load.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on June 08, 2019, 05:14:15 pm
A few more tests on the ADc circuit:

To get even lower noise I added resistors in parallel to the integrator input (R1,R2,R3), now with 2x 50 K in parallel. The Integration cap is increased to some 3.2 nF to stay in range. This comes at the price of possibly higher INL error, but for an linearity test less noise and more INL is a good thing.
The INL test is like before, using 2 different run-up versions, one with 40 kHz modulation and one with 120 kHz modulation to measure the same slowly varying voltage. This is a test mainly for the shorter range INL errors, like errors in the slow slope contribution or switching artifacts.

The first 2 graphs show the data for the linearity test. Each point is from the average of 25 conversions of 40 ms each. So slower conversion and thus less noise.  The result looks promising: the more periodic part is likely to a large part (> 2/3) from the faster mode, that also uses rather short switching times. For the longer range drop one has deviations of some 1 µV so something around 0.1 ppm FS. Here it's not sure this is actually an INL error - it could still be some variation in the 5 V supply, that effects the charge injection. In normal operation the auto zero would take care of most of this.

Again with the smaller integrator resistors I also ran a noise test with a short over a longer time. Attached is a report from the Alavar software. The vertical scale / units are  µV.  The horizontal scale is at some 70ms for 2 conversions and sending the data separately.  So the short time noise (1 st point of Allan dev. curve) is at some 560 nV reaching the level of the 8 digit meters.
For longer times the noise is not going down, as this test is without auto-zero and thus has quite some 1/f noise from the OPA145 in the input buffer and OPA1641  (amplified 2 times) from the integrator.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on June 29, 2019, 08:49:56 pm
A small update on the ADC with a few crude INL tests:

The early test here showed quite some self heating effect. So directly using the current ADC would result in rather poor INL (expect some 10 ppm of INL error). To circumvent the self-heating effect I use a fast gain measurement. This is not a new Idea, but was already used in old DMMs like the Keithley 19x series. So the ADC measures a sequence of input signal, zero and 7 V reference (LM399). The result is than
U =  (U_signal - U_0) / (U_7 - U_0)
This improves the gain stability and INL, but adds a little to the noise, effectively adding the ADC noise to the reference. Because the ADC itself is very low nose this is not much compared to the LM399.

For INL-tests I use a simple LM399 based reference source with an amplifier to some 9,3 V, divider with 12 equal resistors and buffer. So there are 2 buffered outputs: one at 9.3 V and one selectable voltage from some 0.775 to 9.3 V. The reference is powered from a separate old style 12 V wall wart.
 
For choosing the signal voltages a simple mechanical SPDT switch for one side (ground of the ADC) and the MUX on the ADC board for the other side are used. A sequence consists of 4 voltage readings, that includes 1 or 2 zero readings. Ideally the sum of 2 readings minus the 2 other readings should be zero if the ADC is linear - a deviation indicates an INL error.

The first test is the classical turn over test, measuring the external reference in both polarities and 2 zero readings to compensate for possibly input dependent offsets. At 9,3 V and 7 V the turn over errors turns out to be small somewhere in the 1 µV range.

The next INL test is measuring 2 voltages that in the sum make up the fixed 9.3 V level.
Andreas describes such a test here:
https://www.eevblog.com/forum/metrology/dmm-linearity-comparison/msg1351979/#msg1351979 (https://www.eevblog.com/forum/metrology/dmm-linearity-comparison/msg1351979/#msg1351979)
So far the tests show an error of some 5-15 µV for the sequence (tested at 4.65 V, 3.88 V and 3.1 V so far). This corresponds to an INL error of some 0.3 - 1 ppm. This is not as good as hoped for, but still good for a low cost ADC.

There still seem to be some EMI issues, as the exact position of the cables and shielding makes a difference. Offsets of the nominal zero readings (up to some 6 µV) seem to be more due to higher frequency effects effects than thermal EMF. Also the bootstrapping of the buffer is not yet working well and loading the inputs quite a bit on switching. Before more INL tests (more points and more repeats to get lower uncertainty) these 2 weak points should be addressed first.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on June 30, 2019, 08:38:05 am
Schematics..
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on June 30, 2019, 09:33:08 am
The reference unit is similar to the schematics shown: the feedback to the OP is one step further up the chain and thus only 9.3 V. My resistors are 1.91K (some NOS I had laying around with reasonable good matching, though only marked 100 ppm/K grade).

For stability check I also ran the usual reading of the external reference. The curve shows visible popcorn-noise and also a few outliers towards the low side.  I am not sure what causes the outliers  - they are even more obvious in the raw data, only effecting the external readings.
The noise is visibly higher for reading the external reference compared to the ADC internal one. So most of the noise is likely due to the 2 references (LM399 AH and LM399H). The jumps from the popcorn noise are at some 3.5 µV (better visible from averaged data) - I think this is about normal for LM399.

Due to the background zero drift it is a little hard to tell which of the 2 reference is causing the popcorn noise.

There is some filtering for the reference at the ADC, though currently not much (only 1.5 K and 1 µF). There may be a chance to use more filtering (e.g. some 5 K and some 10 µF).  Usually reference filtering is not considered that effective, but it may be worth it to have the same reference level for all 3 conversions that make up a reading.
Title: Re: DIY high resolution multi-slope converter
Post by: Andreas on June 30, 2019, 12:55:21 pm
Hello,

You could put a 1-10nF capacitor across external input + GND of the DG408 (IC7) to see wether the voltage drops are EMI-related or not.

with best regards

Andreas
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on June 30, 2019, 05:25:57 pm
I changed the buffer amplifier supply from true bootstrapping form the output to a system with an extra OP buffer (OPA172) to drive the supply voltage center from the input signal. This seem to have improved on the possible EMI issues. At least it does not seem to be that sensitive anymore. There is still some effect from switching, but it got significantly better (e.g. 1/4 the size) than with the old bootstrapped version.

One input was fitted with 1 nF (towards signal ground), but no difference visible. It's more like the cap could increase the effect of switching related charge pulse. Maybe I may have to add a kind of pre-charge phase, so that sensitive inputs don't see the full switching spike.

However at the currently rather high temperatures (some 27 C room temperature) the leakage current (likely from the DG408) is rather high: I measured some 250 pA (some 85 µV extra offset with a 330 K resistor) for one input. So the offset voltages could have been just input current and the 22 K resistors at the inputs. So far I have not cleaned the flux - so it could be some leakage from there too.

The next test would be using DG508B (with lower specified leakage) instead of DG408.
Title: Re: DIY high resolution multi-slope converter
Post by: Andreas on June 30, 2019, 05:38:47 pm
I changed the buffer amplifier supply from true bootstrapping form the output to a system with an extra OP buffer (OPA172) to drive the supply voltage center from the input signal.
Interesting. Any schematics available?

One input was fitted with 1 nF (towards signal ground), but no difference visible.
Where exactly did you place the 1nF? before or after the 22K (across the input protection diode).

with best regards

Andreas
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on June 30, 2019, 07:35:14 pm
The cap is directly at the DG408 mux, so behind the resistor. My external reference source is not made to drive a capacitive load (just the OP output)  so I could not have the cap directly at the input.

Attached is the schematics part of the new buffer. The green  (old type) LED is replacing a 2.7 V zener. The zener diode is 5.6 V.
I could build the modified circuit on the board, because there is a footprint for an optional OP (for a totally different option)- so I was lucky to have option with just a few short bodge wires and the LED at an angle.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on July 02, 2019, 03:56:32 pm
Why do you connect pin 3 of the OPA172 to the input via 12k? I would wire the pin 3 directly to pin 6/2 of the OPA145..
Why 5V6 only?

Quote
There is some filtering for the reference at the ADC, though currently not much (only 1.5 K and 1 µF). There may be a chance to use more filtering (e.g. some 5 K and some 10 µF).  Usually reference filtering is not considered that effective, but it may be worth it to have the same reference level for all 3 conversions that make up a reading.
What would be max acceptable thermal noise of that resistor?

Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on July 02, 2019, 05:08:59 pm
The 12 K resistor is a little on the high side and one may not even need a resistor.  I added the OPA172 as a kind of after-though / bodge and I needed some distance for the resistor anyway. The exact resistor value should not matter as the OP172 is only good for a first approximation.

The OPA145 is only powered with some 5 V so that the total output range is large - some -14 V to about +11.5 V despite the limited supply (+-15 V). The purpose of the driven supply to the OP is to improve linearity. The OPA145 is quite good for a normal OP, but it is still not sure to get better than 1 ppm INL. The driven supply should ensure very good linearity for the buffer.

The resistor in the filtering adds noise (thermal noise and resistance in combination with the OP's current noise). The noise has to be compared to the reference noise. For the LM399 this is some 100 nV per square root of Herz. In addition there could be some drift from the OPs bias. I consider up to about 10 K practical. For the very low frequencies filtering is not really practical - I see the main gain in the range up to a RC value of some 100 ms. This is to average over a measurement cycle of some 20 ms zero, 20 ms the external signal and 20 ms of the reference. The reference value is only important for the signal conversion and thus only 1/3 the time. Also using the other 2 thirds of the time should help reducing the noise. Lower frequency filtering is less effective as there is the time for the conversions doing averaging anyway.  In stead of very low frequency filtering (e.g. 20 K and 500 µF (low leakage)) I would prefer a 2 nd LM399.

The other point would be filtering of the signal itself - this would be filtering before the MUX - again mainly to bridge the 60 ms measurement cycle. However this would effect the settling at the input. So one would still need the choice of the direct signal or the filtered signal.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on July 06, 2019, 03:52:06 pm
Don't suppose you would have an image of the current PCB? Trying to understand a few of the things you are facing in hopes to improve this project.

I've redrawn the schematic as it makes sense to me, to unwrap a lot of the crossing connections, (If a component is in the 200 range, I added it, If its in the 300 range and not 381, then I was not able to read the existing reference, and IC3 became U1, because there was a conflict in names when renaming then to U instead of IC, and TC became Q for transistors)

Also while copying out the existing one, Caught some things that I don't quite follow?

1. R23 connects to normal ground, not the Analog ground, Is that intended, or ignored in your current layout?
2. Your +15V rail does not have a 100uF output capacitor like the other rails?

And finally, I can see a number of values have changed since your initial schematic based on the bootstrap supply, any chance of an updated schematic?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on July 06, 2019, 05:09:54 pm
The buffer amplifier has changed and seems to work much better now.  It may be possible to simplify it a little (e.g. only using a current source from the positive side and the OP directly to drive the negative supply of the OPA145). For the MUX I have tested both DG408 and DG508 with not much difference. The extra offset with an additional 330 K seem to be more due to a transient effect, and not just a simple bias current. So there still seem to be some smaller issues with the input buffer / mux.

For the rest of circuit there are no larger changes. R1,R2,R3 where changed to some 25 K (2x50 K in parallel), though the 46 K version was about as good (slightly higher noise, but possibly better linearity). With only 25 K the integration cap also got larger (now 2.2 nF (PS)+1 nF (NP0) in parallel).

The board now actually has the LM399 reference as in the plan (before only a LM329 was populated).

C24 (100 µF at the LV4053) is no longer used - it did not help.

R23 goes to the normal ground. This is intentional not to send modulated current to the analog / signal ground. The exact level is not critical anyway as the main purpose of this resistor is to keep the voltage across D2 small and send the current from D10 to ground. Ideally the voltage over D2 should still be small in the critical final phase, like less than 100-200 mV. The normal GND and AGND are connected with a wire bridge (red bodge wire on the bottom) anyway. So the difference is small, more like possible spikes and maybe a few µVs.

The redrawn schematics looks good in most places, but has a few quirks:
Pin3 of U2 going to the point between R10 and R11.
R13 should be larger - I think some 47 K.
The reference signal to U9 pin3 is coming from the capacitor C13.  C13 will likely soon change to 4.7 µF for more filtering of the reference.

For the inputs, I have only one of the input with an extra filter cap - the cap is not working really well, as it take quite some time to charge. So the 1 nF cap(s) at the DG408 will likely be reduced - more like 100 pF.

The picture from the bottom side is not very sharp, but it is very difficult to read the OP labels anyway.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on July 07, 2019, 09:32:32 am
Found an error around U13 on my old schematic, and implemented the changes you mentioned.

Simulating the integrator section seems to show a null point around -9.78mV, was that intentional? (the integrator voltage when the comparator toggles)

When the integrator gets above about +0.5V U13, mcp6002 is outside of its common mode range (vss - 0.3), It does not exceed the maximum spec, just leaves the common mode, and left wondering if that unused amp in U13 could be used as a workaround

When your down to nV from null on the integrator, does U13 actually perform usable amplification, e.g. does adjusting the 10K trimpot effect anything, as if so you could change the trimpot to AIN0 and use an ADC pin to directly measure this pin if that would help any part of the calibration, and leave it connected via the ADC mux for normal operation. (right now it seems its output would represent about 0.8uV on the integration capacitor at the null point)


Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on July 07, 2019, 12:07:47 pm
A small offset at the integrators output, when the comparator switches is not a problem, as only differences matter. The exact trigger point is set by the 10 K trimmer.  U13 sometimes goes into output saturation, but should not go out of common mode (as the + input is always at some +150mV). The inverting input voltage could reach slightly negative voltages, but this is only during phases when it does not matter.  So there is no need to work around this, just slightly different resistors could probably avoid it. The DC level is more adjusted to stay in the linear range of the slope amplifier (NE5534 with the diode feedback).

The 10 K pot does change things: it sets the trigger point for the comparator and thus the typical offset the ADC in the µC sees and which part of the slope amplifier is used. However the setting only needs to be inside a rather large valid range, the exact setting does not matter. So using a multi-turn trimmer is over-kill. Currently I have something like 1 turn of the pot that only changes the part of the ADC range used, but not the final result.  The right setting of the pot can change a little with software changes or a different capacitor so for development the pot is good. A final solution might get away with fixed resistors or maybe 1 or 2 bits of R2R DAC. There is no real need to trim the pot for calibration -  mainly avoid the limits of the µC internal ADC.  With more gain to use more of the µC internal ADC resolution the setting would get more critical. This could be the case in a version without the slow slope (e.g. symmetric reference).  This could be an option as it would allow to use a standard resistor array for the reference amplification.

The 2nd half of the MCP6002 is currently used to measure the average integrator output voltage  (3 bodged in resistors and the yellow cap on the bottom). An alternative use (planed on the PCB) is to use it to read the temperature - though at a position that is not that good.

LSP6 is a test-point to check the integrator settling (C17, C37, R10, R20), the resistor is there to reduce a possible probe effect.

C17 is  not at 2.2 nF but 220 pF , and C37 is currently not populated.
There is another mistake in the redrawn schematics: R24 is between U4 and U13B, not in series to R40.

To an earlier question: The actually is a 100 µF or similar cap at the positive supply - it's bodged in, near U6.
Originally I only had the capacitor at the negative supply, as some 7915 do like capacitance with ESR, the 7815 don't need it.

Another bodged in change is a ferrite bead in the VCC supply to the µC. This also feeds the DG408 5 V supply.
The current board uses a boxed oscillator, but just a crystal at the µC should work too and was tested before (the boxed oscillator did no give a significant improvement).
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on July 07, 2019, 12:09:54 pm
The input buffer - while simulating it the output voltage is not positioned in the middle of the OPA145 Vcc/Vee, something I would expect..

PS: maybe a "typo" in your above schematic??
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on July 07, 2019, 12:37:00 pm
IMO, that is because he us using a LED and a zener, there combined voltage drop is what sets the supply voltage for the op amp, but as each contribute a different amount of voltage while being biased at the same center point results in the output being more towards the LED biased rail.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on July 07, 2019, 12:47:15 pm
I would plead for a symmetrical version, for example this one creates 3.9V at ADA4528 (for example).
PS: the current via the LEDs is aprox 175uA..
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on July 07, 2019, 12:55:23 pm
while you have that loaded in your simulator, could you see if there is any better linearity or voltage headroom gains from altering any of the 7 main resistors (parametric analysis)
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on July 07, 2019, 01:04:15 pm
The sim files..
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on July 07, 2019, 01:18:44 pm
The slightly asymmetric supply to the OPA145 is intentional: The OP145 is single supply ann can work well with low voltages, but not well near the positive supply. In the current circuit only the 5.6 V zener - VBE set the supply. The LED sets the common mode voltage seen by the OPA145 - the point in the center is not that special. At the lower limit the OPA145 can this way go lower (and turn the LED off) and still have a 5 V supply and give a good output. In the circuit with 2 LEDs the working range is a little smaller, as the supply voltage would drop low.   

The other point  for this choice was just parts available: I have plenty 5.6 V zeners (hoping for a lucky low noise type), but not many low voltage zeners, suitable LEDs to get a sum of some 6 V. I may test a slightly high voltage zener, just in case I run to close to the positive limit or low in supply.

For the reference popcorn noise I did another test, measuring a 9 V battery. As expected there is popcorn noise too - so chances are both references contributed to the popcorn noise. At least the LM399 at the ADC is no exceptionally good.

Another test is more confusing: The ADC is programmed to make 4 conversions  for 4  MUX channels in a cycle. Two channels are reading zero, one with a 22 K resistor and one without (the internal zero) . The 3 rd conversion is the internal 7 V reference. The 4 th conversion in the cycle is varied to different voltages.

Ideally the 2 zero reading should give the same result, maybe a tiny offset from bias current times 22 K. However the difference does depend on the 4 th channel, which is also the reading before the 2 zero readings. So there seem to be some kind of memory / spill over from one reading to the following conversion(s). The test was done with with 1 PLC and 2 PLC conversions and than averaging over some 100 cycles to reduce noise. A seen in the graph the difference is about proportional to the 4th reading voltage, at some  1 and 0.5  µV/V. So the effect is larger for the faster 1 PLC conversions, which is not such a surprise.

The change in MUX setting is at the beginning of the rundown phase. So there are some 200 µs (relatively long because of the aux reading) for the input buffer to settle before the next conversion starts. Usually there are no specs for settling to the ppm level, but I don't expect the buffer to be that slow.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on July 07, 2019, 02:02:54 pm
With your buffer schematics (opa140+opa171, post #33) the settling from 7V to less than ~1uV takes aprox 360us with 1nF and 37us with 100pF C16 cap.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on July 07, 2019, 08:40:36 pm
There is some drain capacitance on each switch, I would imagine this is what is causing the transition your seeing. so there is essentially 40-80pF per switch if I am reading this correctly.
Title: Re: DIY high resolution multi-slope converter
Post by: splin on July 07, 2019, 09:50:48 pm
How come for your linearity tests that you used a seperate reference to feed the divider generating the test voltages rather than using the ADC's reference? Instead of adding the noise from the two references it should eliminate most, if not all, the reference noise when measuring the test voltage? Obviously the ADC's transistion noise would still exist during the signal and zero measurements.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on July 08, 2019, 06:45:22 am
I have done 3 types of linearity tests so far. The first was using 2 modes with different run-up to measure the same voltage - here only the very short time variations of the reference enter here and these are not that large and could be filtered. This test is mainly for the fine wiggles, a little more than DNL and no including some effects
The 2nd test  The linearity test is as suggested by Andreas. This test needs an isolated reference (e.g. some 10 V)  and 'divider', so that one measures 2 voltage that in the sum make up the '10 V'. Having the reference isolated is essential here, as the ground connection is moved.
The 3 rd test is the classical turn over test. So measure a voltage positive an negative, by reversing the leads. This also needs an isolated reference.

I had planed another test test in the ohms mode - however I reused the part planed for the current source for the 2nd OP at the buffer. So I will probably not do this test with the current board.


For the odd carry over/slow settling problem, I did a few more test: Changing from DG408 to DG508 makes little difference. Also removing the 12 K at the OPA172 input has no effect. However additional capacitance (or just a cable) at the mux output makes things worse.

The capacitance of some 60 pF due to the MUX itself should not produce a significant delay with the 22 K series resistors. That's only some 1.2 µs time constant and thus much shorter than the 200 µs delay (rundown with auxiliary reading). If it is just a simple exponential decay it would take an RC of at least some 20 µs and no more than about 5 ms (as the slower conversions are less effected).
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on July 08, 2019, 09:28:51 am
https://ez.analog.com/switches_multiplexers/f/q-a/77203/dg408-address-switching

Apparently the digital IO can also cause some coupling. It may be required to fit some inline resistors in the address lines near the avr to reduce the slew rate.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on July 15, 2019, 10:35:03 am
for D10, exactly how does its linearity effect the measurement, and could this be worked around by using a NPN transistor with Base and collector tied? (Routing out, but not so fond of possible injections into the signal path)

As the purpose of the slope amplifier is not making much sense to me? could the same not be accomplished with a gain limited comparator and an output divider?

Edit: could R23 not be put in parallel with D2?
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on July 15, 2019, 02:32:07 pm
As the purpose of the slope amplifier is not making much sense to me?
The value of the feedback resistor in your schematics is 5k - it should be 100k (or something like that).

The slope amp works for input voltages < +/-0.6V as an amplifier with gain=20, for larger as limiter (it is a "log" amp) thus the output voltage will be always < +/-0.6V. 
That works for 2 anti-parallel diodes in the feedback.

It simply amplifies the voltage transition around zero (at the integrator's output) such there is none "slowish" voltage at the input of the comparator, generating mess.

Enclosed you may find the "Multislope simulation" I did in past in the Multislope thread, you may play with the elements (it includes the composite integrator and the slope amplifier). Not exactly Kleinstein's version, however.

Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on July 15, 2019, 04:13:01 pm
for D10, exactly how does its linearity effect the measurement, and could this be worked around by using a NPN transistor with Base and collector tied? (Routing out, but not so fond of possible injections into the signal path)

As the purpose of the slope amplifier is not making much sense to me? could the same not be accomplished with a gain limited comparator and an output divider?

Edit: could R23 not be put in parallel with D2?

The normal purpose of the slope amplifier is to help the comparator, as a kind of first amplification before the comparator. This can help with the speed, especially if very small slopes are used. The NE5534 (a common choice for this) as defined low noise and reasonable good DC stability compared to the usual comparators (e.g. LM311 or similar).

In my circuit the slope amplifier also serves to limit the amplitude to some -0.7 V to +1.4 V. This helps as the following amplifier is powered from 5 V. As it is not only used for the comparator, but also send to the ADC, it should be linear at least over a range of some 400 mV or so. Due to residual current through the diodes even at low voltage the linearity is not fully guarantied and the parallel resistance of the diodes is temperature dependent. So the early 2 diode (and also with 3 diodes and too large a value for R23) version had a slightly temperature dependent gain and limited linearity.  An error in the gain or nonlinearity of the slope amplifier causes an error in the contribution from the residul charge ADC and thus some DNL errors (e.g. < 0.1 ppm of FS range) and noise (as the DNL error has a random component).
 
The extra diode D10 and R23 keep the voltage over D2 low for the first about 400 mV of output voltage. The initial current through D10 is send to ground through R23 and not yet working as feedback, as D2 does not conduct much at below 100 mV. This way the linear range for the amplifier should be larger by about 400-500 mV. The curve is than more like logarithmic - linear with a gain of about 20  (from about -200 mV to +700 mV at the output) and than approximately logarithmic (near twice the gain) again.
Title: Re: DIY high resolution multi-slope converter
Post by: SilverSolder on July 15, 2019, 05:24:24 pm
Does the INL actually vary significantly over time?  Is it possible to store the parameters and remove the error mathematically in the CPU and expect that to keep working for a reasonable amount of time?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on July 15, 2019, 06:26:45 pm
Much of the INL is expected to not vary much over time, but nothing is for sure. Some errors may also be more like history dependent, not just a simple function of the reading.

Except for self heating of the resistor(s) at the integrator input I don't know a significant INL source.  I have a good idea of the INL effect expected due to DA of the integration cap. If my calculation is right and from the measurements so far it looks like DA related INL errors are at <10 ppb level and thus not a real issue.  It is really hard to tell how those still unknown INL sources would change with time etc.

It may be possibly to remove some errors numerical, if the error is actually known. At the current level it can be quite demanding to measure the INL to a high accuracy.  At least for the more short range wiggly part (e.g. due to combination of run-up and rundown) the self test shows that there is not very much of this shorter range INL to be expected (it still only cover some 90% of the sources). So the main INL part to look for is a more smooth background more like a lower order polynomial.

The self heating effect on the input resistor and thus ADC gain is actually corrected by the extra reference measurement. For the stability tests with the external reference one can see that the measured ADC gain before the correction is changing quite a bit,  much more than the stability after the correction. So this part works very well and is also expected to correct much of the self heating part to the INL. So a possible major INL source is  already corrected - not from pure math but with the extra measurement. This slows down the readings (3 PLC instead of 2) and adds a little (as the ADC noise is low) to the reference noise. At least with just an LM399 reference or not so good resistors it is worth it. It may be different with a lower noise reference (e.g. LTZ1000) together with much better resistors.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on July 15, 2019, 08:55:58 pm
So to clarify, R23 must be outside the feedback network in order to not upset the linearity your trying to accomplish. equally a transistor could not act as a more ideal diode to replace it?
Title: Re: DIY high resolution multi-slope converter
Post by: SilverSolder on July 15, 2019, 10:52:45 pm
We could create a profile of how much self heating there is...   current^2 * resistance * time, minus losses to the environment...   so depending on what you have been measuring recently, the CPU would make different adjustments to the numbers, with a time decay factor...   with a bit of care, and perhaps a heat sink on the resistor to better control its ambient temperature, we might achieve extremely good INL numbers out of the modest hardware...

There could be a calibration cycle built into the software that builds the profile by measuring the device's own reference.

It would not be simple software, necessarily, but it would be beautiful!  :-)

Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 22, 2019, 08:04:04 am
I did some updates to the hardware. The main change is changing the critical resistors at the integrator input and for the  7 V to +-14 V amplification to NOMCA resistor arrays: 50 K for the integrator and 10 K (2 in parallel each) for the reference amplification.
This gives a big improvement in gain stability. In the initial version the gain drift was really poor (see first post) - the gain is now very stable, now in the 0.2 ppm/K range.  The other point that improved is the offset drift before auto zero mode. This is now at some 7 µV/K. This is not impressive compared to OPs, but the main part likely comes from resistor matiching. The 7 µV/K correspond to a relative TC of some 1 ppm/K.

Another point I found was that there seem to be some thermal EMF right at the DG408 MUX. Inputs on different sides of the chip show an offset (some 2 µV, but constant in my case). This may be relatively high because the chip is relatively close to the warm LM399 reference  :palm:.

The odd "after-effect" is still no fully understood  :-//.  Testing with different frequencies of the modulation (26 kHz and 78 kHz) show very little difference. This pretty much excludes DA as the cause, as DA effects should change by a factor of 3 in this comparison. The effect depends on the resistance at the input - so it looks like a transient input current pulse. So my suspicion is now back the to buffer amplifier, maybe the MUX chip. With now less drift is should be easier to check.

Attached are 2 plots for a drift measurement. The temperature changes by a little over 2 K over the measurement. At the end, the cover / shield was removed, so not just a temperature effect.

The gain over time shows some noise, that looks a little like popcorn noise. With closer inspection also the offset part seems to have some step functions (not related to ADC internal coarse steps).  The step like noise can also explain that in the AZ mode there are some points off the normal distribution.

The step like changes in the gain (reference read back by the ADC) make me suspect that this effect could be resistor excess noise. The NOMCA arrays a specified as < -30dB  and that is about the order of magnitude noise I see.  So for lower noise it may need better resistors, though the NOMCA arrays are still not bad - noise wise comparable to the thin film resistors I had before. There drift just obfuscated the jumpy part.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 07, 2019, 09:17:41 am
A small update:

I did some linearity test with an external reference, based on an LM399. The first and probably simplest test is the so called turn over test. An external reference is measured both as a positive and negative voltage. In my case the polarity change is done with a simple mechanical switch at the reference (choosing one end between the positive and negative side) and the MUX at the ADC, also switching between the positive and negative side.  For a turn over test, there are 4 voltage readings: the positive and negative voltage reading and 2 readings that should normally give zero, but do measure residual offsets (e.g. thermal EMF) at the switches. The resulting turn over error is the sum of the positive and negative reading minus the 2  "zero" readings.  The zero readings are relatively stable a about -1 µV in my case.

The graphics shows the measured turn over error for a few voltages:
[attach=1]

The error of some 5-10 µV is larger than hoped for, but not so bad either. It is a little surprising that the error is larger for the smaller test voltages. The test at 1.5 v was done twice, at the beginning and at the end (lower error). Each of the tests showed relatively low drift,  more like suggesting an uncertainty in the +-1-2 µV range. So the difference between the 1 st and last test is more like a question of the warm up time, not noise.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 11, 2019, 09:19:26 am
I think I found the reason behind the rather large turn over error:  Adding some small bias current to the output of the buffer amplifier improves things a lot (have to improve my external reference to see things different from zero)  for small voltages. So it seems the output cross over distortion of the OPA145 in the buffer was the weak point. Chances are a little more current would also improve things at higher voltage.

Using the supply bootstrapping essentially remove the errors from limited CMRR and limited gain, but it does not help with the effect of loading the output. The OPA145 is a low power OP and thus likely runs the output stage with low current and is thus relatively prone to cross over distortion. It looks like my OPA145 needs some extra 7 µV at the input when going from sinking a small current (e.g. 50 µA range) to delivering a similar current. Chances are the output impedance is highly nonlinear, with most of the voltage change at low currents.

The turn over error getting better at high voltage is probably a compensation of 2 effects: the rather constant part from the cross over distortion and a conventional square law part, e.g. from thermal effects at the resistors, that happens to be negative here. So with a fixed buffer I have to expect something like -5 µV turn over error at 10 V.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on October 11, 2019, 09:32:04 am
how did you implement the bias, just a resistor to the op amp bootstrap supply, or something different?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 11, 2019, 09:43:40 am
The bias is just a resistor to the bootstrapped supply, so easy to implement.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 16, 2019, 07:45:28 pm
A small update:
I did a new measurement on the turn over error with a little high bias current (some 600 µA). The result was not as good as hoped for an at first looks odd. The turn over error is roughly proportional to the voltage used for the test.
If one uses a polynomial representation, the turn over test is sensitive to the even powers. So one would expect contributions proportional to the square , 4 th power and maybe 6 th power. So this would be an error more at higher voltage. However the polynomial form is only one possible form and other shapes are possible, e.g. with 2 nd, 4 th and  6th order parts compensating to large parts.

As seen in the plot there are different values for some voltages and there is some scattering due to drift and noise. At the low µV level the LM399 reference starts to show it's limits.

With the same reference circuit I also did a few INL tests with looking at 2 voltages in series and the sum.  Tests with some 4.6 V + 4.6 V , 3.8 V + 5.4 V and 3.1 V + 6.1 V showed rather little (some 1 +-3 µV) linearity error for positive voltages. The measurements are essentially limited by the drift and noise of the references. Also thermal EMF and EMI may cause a µV or so.

The main troublesome part is that for some still unknown reason the input voltage not only effects the current reading, but also the next few conversions a little. The effect did not change noticeable with the better resistors.  So it is likely no linked to heating in the resistors. The effect is also quite fast and large, so it likely is not a thermal effect on the buffer amplifier. Here it helps that the bootstrapped supply of the critical OP reduces the power consumption of that OP. So the main heat sources (transistors in TO92) are some 1 cm away.
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on October 16, 2019, 08:24:29 pm
I know very little about your project and this may be a stupid idea, but your diagram looks to me like a "diode" acting above a threshold of 1 or 2 V. And the diode effect is about one ppm - difficult to discover.

Maybe also precision resistors need to be qualified separately for both current directions.

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 16, 2019, 10:01:52 pm
The resistor arrays are NOMCA type. AFAIK they are TaN on an alumina substrate. So I don't think they should have a problem with current direction.  This could be a problem with resistors on a silicon substrate (e.g. MORN or LT5400 series).

So far my suspicion is that short pulses of the reference could be part of the turn over-error. Ideally at 0 input, there are no short pulses. At positive input there is an linear increasing number of short negative pulses. With a negative input the pulses are negative. If for some reason the short (1 µs) pulses behave a little different from nominal, this could result in a small difference between the both polarities. For test I may just extend the min. pulse length to maybe 4 µs  (at the cost of a reduced input range).

Anyway the turn over error is not my main concern. Ideally the voltage reading could combine a positive and negative reading to remove this error. This may be the best way for a voltmeter anyway, as it would give a larger input range (e.g. +-20 V +some over range).
My main concern is the slow "settling" or delayed effect from the input. This may even effect my external reference.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on October 17, 2019, 08:55:56 am
The resistor arrays are NOMCA type. AFAIK they are TaN on an alumina substrate. So I don't think they should have a problem with current direction.  This could be a problem with resistors on a silicon substrate (e.g. MORN or LT5400 series).
Could you advice us how to wire the LT5400 as the feedback resistors in the the 7V->10V opamp booster (regarding the potential issue with the substrate influence), plz?
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on October 17, 2019, 09:52:17 am
The thermal output of the input buffer is not static, it does vary with input voltage, which could in turn cause offsets that scale with input voltage, Its small, but may help account for what your seeing if its response changes at different ambient temperatures. It also changes which output transistor is heated on the op amp die, which could move the offset.

Equally does the offset remain the same if you perform the turn over a third time?

https://www.eevblog.com/forum/projects/multislope-design/msg2585700/#msg2585700 (https://www.eevblog.com/forum/projects/multislope-design/msg2585700/#msg2585700)
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 17, 2019, 11:05:47 am
There is a possibility for some thermal effects in the input buffer. With the bias current, the OPs output stage only uses essentially only one transistor - the other side should be off at some 500 µA. With only some 200 µA and only a 5.x V supply (some 4 V for the output stage), I would not expect that much thermal effect. The OPA145 is made to be low drift.
The buffer version from the link may need a slight adjustment (e.g. R27 smaller) to stay in the input common mode range of the OPA145.

The turn over tests are already done with multiple repeats. Usually some 2-4 times reading each polarity for something like 5 seconds. The difference usually stays the same and settling  is fast (not visible from the data). However there is some low frequency noise in the references, especially popcorn noise. So ideally one gets about the same reading after polarity change, but sometimes there is a considerable jump of some 2-5 µV, likely popcorn noise from the references or resistors. As expected these jumps are larger at higher voltage. It takes some tries to get data without much jumps in between to get good data for the higher voltages. The switch / mux related offsets are read less frequent, but these do not change much over time and are low noise.
Doing the test again later, there is same scattering. However it is not clear if this really the errors getting smaller or just noise or different EMI effect.

@IMO:
The 7 to 10 V step is a little off topic. This is just a static divider and any possible substrate leakage should not be so critical. I have not found specs for this for the LT5400, but I don't expect this to be a problem for the lower resistors and normal temperature. I may be an issue for the 1 M version at high temperature. The 7 to 10 step could be done with 2:1 resistors from 7 to 10.5 and as a separate less critical step  10.5 to 10 with some 1 K and 20 K. The exact ration also depends if one starts at 6.9 V or 7.1 V.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on October 17, 2019, 11:16:27 am
@KL: my question is not about how to do 7->10V, but "how to wire" the 2 or 3 LT5400 resistors in regard to the "current direction" because of the silicon substrate (as you mentioned above).
Imagine the 4 resistors inside the package and 10k+10k/10k divider (A=1.5). Now how to wire those three resistor to minimize the potential current direction issue.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 17, 2019, 11:57:36 am
With 10 K resistors I would not worry so much about the substrate leakage.
For the resistor sequence I see 2 logical ways to chain 3 resistors. One is the simple sig-zag like form with short connections on both sides.
The second form is the same current direction and thus longer connections.

I expect both ways to be about same quality, as it is symmetric.  So I would prefer the simpler layout. 
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 27, 2019, 05:41:38 pm
A small update on the choice of capacitors.

With slower modulation (some 27 kHz). Some DA effect gets visible - kind of intentionally. The final version would likely use faster modulation, which reduced the effect of DA about proportional, as less charge is stored in the cap.

So I did a few measurements on the DA for different capacitors. The same ADC HW is used, but with an extra SW part for the DA test. The test is one a different time scale from the normal data-sheet numbers, more closer to the time scale relevant for the ADC.
For the test the capacitor is charged (to around 5 V) than hold for some 32 ms and discharged by the normal rundown procedure. From than on the µC internal ADC is used to measure the reappearing charge due to DA at a few times. To get a larger range a 2nd rundown is used after some 20 ms. The total time to watch the recovery is some 42 ms. The same procedure is than repeated with opposite polarity. For noise reduction readings from some 100 cycles are averaged.   The start of the time scale is a little uncertain due to a variable length of the rundown.
The result is the difference between both polarities: this way a constant drift of the integrator and the zero point of rundown is removed. Even at the end (some 41.5 ms) the DA effect dominates of the drift rate of the integrator.

The absolute numbers are different from the standard values because of the different time scales. The standard test uses much longer times (1 hour charge, 10 second discharge and looking the the charge after 15 min).  My test is more like 30 ms charge some 100 µs discharge and looking at the recovery after that up to some 40 ms. So the standard DA vales would be the rise happening some 3-4 decades to the right.

The capacitors tested so far are:
1) 2.2 nF PP capacitor 400 V from Kermet
2) 2 x 1 nF NP0  THT MLCC capacitors with epoxy coating
3) 2.2 nF PS capacitor (old (1980s ?), used in most of the early tests)
a second PP cap (Wima MKP2  630 V)  was tested with an earlier SW and was similar to the other PP.

The NP0 cap is surprisingly similar to the PP cap in performance. The old PS cap turns out to be slightly better - though not very much.
The leveling off to long times is likely due to the limited charging time, not necessary a property of the capacitors.
Title: Re: DIY high resolution multi-slope converter
Post by: ogden on October 27, 2019, 06:22:10 pm
You may want to check Polyphenylene-sulphide (PPS) film capacitors as well. Wima (https://www.wima.de/en/our-product-range/smd-capacitors/smd-pps/comparison-of-dielectric/) manufacture such, Panasonic (https://industrial.panasonic.com/ww/products-ec/smd-film-capacitor/smd-film-capacitor/echu/index) as well. Those are used in high performance PLL/VCO (fast lock) applications that require as low DA as possible.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 27, 2019, 06:59:00 pm
From what I have read so far and the datasheets PPS caps are good (similar to good PP) at the long time scale, but more on the poor side at the short time scale (higher loss factor at 10 kHz already). So I may give it a test, but I don't have very much hope that they are really good.

I have more hope in high quality NP0 caps. There are quite different versions of NP0 caps - NP0 only specifies low TC ceramics not the material. I still have 2 different types there to test. The problem is that not all caps specify DA and often it is something like < 0.1%, so not really specific.

Also PP caps can vary between types and brands. Not all PP are the same.

PS:  I just got data from another NP0 cap:  about in between the PS and PP caps , but likely some out-layers. So I have to remeasure / check.
Title: Re: DIY high resolution multi-slope converter
Post by: SilverSolder on October 27, 2019, 09:04:49 pm

Perhaps it is possible to improve performance with compensation in this application?  (attachment)
Title: Re: DIY high resolution multi-slope converter
Post by: MegaVolt on October 28, 2019, 11:16:06 am
Can take a capacitor that is used in 3458a?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 28, 2019, 04:21:09 pm
The modern DMMs usually use some kind of NP0 caps. The caps in the 3458 are quite small. I want to avoid a modulation that fast and thus need a larger capacitor, more like 1 - 2.2 nF. 

There are many different flavors of NP0 and it is hard to find a good type, as the relevant parameters are usually not given in the data-sheets. It is about isolation resistance that should be high, preferably > 100 G.  The other point is loss factor or DA for a time scale of some 20 µs to 100 ms - here one may find tan delta or Q for some 1 MHz and DA for times in the 1000 seconds range (the standard DA test), but data for the 10-1000 Hz range are rare. From what I have read so far some low loss NP0 types (usually specified for even higher frequencies)  could be a good bet. However they tend to come in small form factor (e.g. 0402). I prefer 0805 or 1206 to have a guard trace under the cap. At least some of these specify parallel resistance > 100 G.
I prefer NP0, as they have a low TC and thus less effect on the scale factor for the residual charge reading with the ADC.

For the film caps there seem to be quite some variations too. Compared to the classic article given, the PS and PP caps I have tested are about in the same ball park. In my case the PP caps with higher DA and the PS cap better than in the article. I don't think this is a problem with the measurement, more like having different brands and types. For the PP dielectric there are different purities of the material that can make a difference.  The other point can be the cleanness when making them (this could especially effect the slow end). The typical processes may have changed over the last decades.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on October 28, 2019, 04:42:33 pm
People say the resistance of an FR4 (perfectly cleaned) for couple of mm distances is like ~10G.
You want >100G.
Would PTFE standoffs help?
Edit: ok, the guard ring under the cap (between the pads) helps?
Title: Re: DIY high resolution multi-slope converter
Post by: MegaVolt on October 28, 2019, 04:45:08 pm
Here are my archives.
Comparison table of dielectrics.
And also a series of capacitors where the insulation resistance is prescribed. But unfortunately there is no 100 T Ohm. 1 ... 10 T Ohm
Title: Re: DIY high resolution multi-slope converter
Post by: MegaVolt on October 28, 2019, 04:49:28 pm
I found one: file dsc03028.pdf and dsc03029.pdf
Title: Re: DIY high resolution multi-slope converter
Post by: SilverSolder on October 28, 2019, 05:54:13 pm

[...] I prefer 0805 or 1206 to have a guard trace under the cap.  [...]


I read somewhere that the commonly used FR4 PCB material has very significant dielectric absorption...   it might be worth running some tests where the capacitor is in free air?  This could include considering the traces that lead to/from the capacitor...

Perhaps the teflon stand-off suggestion is worth a try, at least as an experiment?
Title: Re: DIY high resolution multi-slope converter
Post by: jaromir on October 28, 2019, 06:33:34 pm
What particular problem of this ADC has solution in form of teflon standoffs?
Title: Re: DIY high resolution multi-slope converter
Post by: SilverSolder on October 28, 2019, 06:56:20 pm
What particular problem of this ADC has solution in form of teflon standoffs?

Possibly none at all!   -  the standoffs are perhaps addressing the question,  "How to minimize DA"  (assuming the PCB is a significant contributor, which has not been shown)
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 28, 2019, 06:59:45 pm
I know that FR4 has quite some loss, compared to low loss dielectrics. However the good thing is that there is not much field in parallel to the capacitor. The integrator input is a virtual ground and largely surrounded by guards. The other capacitor side is kind of avoiding close neighborhood .  I could check the effect of the board by testing with 2 caps in parallel - this should reduce the relative effect of the board or other parasitic capacitance.

I don't think I would need Teflon standoffs at the ADC. There should be reasonable low leakage, but in my version with reading the residual charge at a fixed time, leakage is only a 2 nd order problem. The switch chip is not really specified for low leakage anyway - in the current setup I still get an effective bias current to the integrator in the 5-10 pA range - so must be some luck there. As am still doing quite some changes I have not even cleaned the flux (no clean type).

I still have a few C0G types caps to test. From a quick look at the data-sheets something like Vishay  VJ0805D102KXAAJ  (1 nF) , a low loss 0805 cap is my current favorite.  They are specified for >100 GOhms and  < 0.05% dissipation at 1 MHz or 1 kHz (for 1.5 nF).

To avoid the small, hard to clean area under the chip, I consider mounting the cap upright standing with an extra bodge wire.

The Bob Pease article on DA  has a nice graph. My measurements contain data for some 30 ms of charge, some 2 ms effective discharge (use this time as zero point) and 20 ms recovery. So I can show the approximate data on the graph. The red circle is for the PP caps and THT NP0, the green is about the SMD NP0 (Vishay VJ1206A...) and yellow is the PS cap. The graph is a little confusing in using the discharge time for the scale.
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on October 29, 2019, 04:08:10 pm
Interesting discussion!

The russian teflon capacitors really seem to be much better, please have a look here:
https://www.eevblog.com/forum/testgear/hp-3455a-last-digit-jitter-in-hi-res-auto-cal-mode/msg967855/#msg967855  (https://www.eevblog.com/forum/testgear/hp-3455a-last-digit-jitter-in-hi-res-auto-cal-mode/msg967855/#msg967855)

Today i ordered some 3.9 nF parts fit for our HP3456A DVMs. Before using them i would try to reproduce the scope measurements linked above.

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 29, 2019, 06:53:28 pm
Needing 3.9 nF in the 3456 suggest a relative slow modulation and thus relatively high sensitivity to DA.
On the positive side a relatively long time spend for the rundown and especially the slow slopes acts a little like the time the cap is shorted in the DA test. Relevant is the charge reappearing after the last rundown step. So a slow run-down (e.g. with some waiting before the final slow step) could help reducing the effect of DA.
A good quality cap can definitely help.

So far I have no luck for me to find a really good one, my best one is still the old PS one, about as good as the cap in the scope test (regaining some 160 ppm from 5 ms to 100 ms)  In my test it is 160 ppm from 2 ms to 22 ms.

The scope test looks reasonably simple, and the result may be easier than checking INL of the DMM.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on October 29, 2019, 07:42:05 pm
OT
I've read this pdf on Multilayer Organic capacitors with DA smaller than teflon in SMD..  :clap:
https://www.mouser.com/pdfdocs/DielectricAbsorptionofMLOCapacitors.PDF (https://www.mouser.com/pdfdocs/DielectricAbsorptionofMLOCapacitors.PDF)
Why OT? The largest cap value I've found is 5.1pF  :palm:

Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 30, 2019, 08:44:50 pm
I added another NP0 SMD capacitor to the list of tested DA caps, with relatively poor performance. To get a really poor cap I tested a parallel combination of 2.2 nF NP0 and a 1 nF polyester cap. In the DA test it goes partially off scale for my setup. The DA effect is about 5 times worse than the PP capacitor. So for the polyester cap alone this would be some 15 time higher DA than the PP one.

The main purpose of the test is to increase the DA related errors so far that they are easily visible. Due to the low modulation frequency my linearity test already shows some errors with a relatively good cap. The same test with the intentionally bad cap shows an largely amplified error.
This test shows that DA can be a major error source - at least for the relatively slow modulation in run-up.  The curve with the bad cap reproduces most of the details of the other curve - so most of the error with the good cap is also due to DA. Looking at the individual data sets shows that the main effect is taking over charge from one conversion to the next. The main effect is thus from the relatively slow DA part.

To reduce the error there are mainly 3 ways: reduce the change in average integrator voltage (e.g. better feedback algorithm), increase the modulation frequency and get a better capacitor.

The intentional bad cap also amplifies the delayed effect seen before - so at least some of this is also due to an DA effect. It is still odd why faster modulation did not help here. It could be the slightly different time when the comparator is checked that makes the fast modulation not so much better.
Title: Re: DIY high resolution multi-slope converter
Post by: ogden on October 30, 2019, 09:55:23 pm
Seems like you need to test "Teflon" (PTFE) capacitor as well.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on October 30, 2019, 10:48:49 pm
https://exxelia.com/en/product/detail/362/ta-72-ptfe

Interestingly they rate PolyStyrene 0.001% DA, while Teflon 0.006%..
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 31, 2019, 08:27:00 am
I am considering PTFE caps. Some NOS (likely Russian milliary left over) are available at a reasonable price (some $15 for a set of 8 or 10). However they are quite bulky and thus possibly more parasitic coupling.
Looking for low loss caps, I found a hint in an Murata appl. note that type CH ceramic (slightly positive TC, low µ dielectric) may be a good choice.  I still have hope to get away with a better C0G maybe CH version and a faster (e.g. 5x, maybe 10 x) modulation in the run-up. The faster version could use a smaller cap, like 1 nF or even less.

So after testing a few more caps I have at hand, the next point would be faster run-up.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 31, 2019, 09:43:18 am
No more need for a PTFE cap: I found a good ceramic one:  TDK C2012C0G1H222J
In the DA test it is much better than the other (about a factor 5 from the PS). With a slightly faster (e.g. x 2) run-up the DA error should than be really small (e.g. 0.1 ppm Level).

So there is quite some difference between the different type of NP0 caps.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on October 31, 2019, 10:04:27 am
I think the rule of thumb I found was higher voltage, larger package size NPO has less DA due to thicker sheets of material,

Still if you want a good read, this is probably the most detailed study into DA that exists for the public

https://nepp.nasa.gov/files/25847/2013-Taverovsky-paper-NEPPweb-MLCCsVabs-n264.pdf
Title: Re: DIY high resolution multi-slope converter
Post by: Alex Nikitin on October 31, 2019, 10:25:31 am
No more need for a PTFE cap: I found a good ceramic one:  TDK C2012C0G1H222J
In the DA test it is much better than the other (about a factor 5 from the PS). With a slightly faster (e.g. x 2) run-up the DA error should than be really small (e.g. 0.1 ppm Level).

Yes, the current generation of TDK NP0/C0G leaded capacitors is excellent, very low DA and femtoamps level leakage even for >10nF caps.

Cheers

Alex
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on October 31, 2019, 10:48:19 am
We would need a quick test to know whether you have got the TDK ones or something else ..
Title: Re: DIY high resolution multi-slope converter
Post by: SilverSolder on October 31, 2019, 10:57:31 am
Yes, the current generation of TDK NP0/C0G leaded capacitors is excellent, very low DA and femtoamps level leakage even for >10nF caps.
[...]

Are modern leaded capacitors made by, essentially, putting leads on a SMD component?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 31, 2019, 11:11:53 am
The good cap I tested is SMD  size 0805 with 0.85 mm hight. It was bought from Mouser - nothing special (some 70 cents for 10 pieces).
The corresponding point (at some 3 ms discharge) in the Graph from Bob Pease is at about the curve for the PTFE cap.
Title: Re: DIY high resolution multi-slope converter
Post by: Alex Nikitin on October 31, 2019, 11:25:50 am
The good cap I tested is SMD  size 0805 with 0.85 mm hight. It was bought from Mouser - nothing special (some 70 cents for 10 pieces).
The corresponding point (at some 3 ms discharge) in the Graph from Bob Pease is at about the curve for the PTFE cap.

Try something like FA28NP02E222JNU06 or FA28C0G2E222JNU00 if a leaded cap is more convenient.

Cheers

Alex
Title: Re: DIY high resolution multi-slope converter
Post by: wildhog on November 10, 2019, 04:53:08 pm
The HEF4053B switch turns on in 65ns typ, 130ns max with a +-15V supply.  The difference between turn-on and turn-off is unspecified and is important for accuracy.  If this time skew is 1nsec, and the switching period during run-up is 100us, this is a 10ppm error.  This can be calibrated but not on a cycle-by-cycle basis as would be required to eliminate its drift with temperature/life. 

How is this dealt with?

Thanks,
Dave
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on November 10, 2019, 05:29:25 pm
I have tested the slow HEF4053, but my favorite is the considerably faster 74LV4053. More stable delay and less jitter is a reason for preferring the faster switches. Another factor is low a relatively small internal gate capacitance and thus less supply noise. The switching speed (delays) can effect the result a little. However most of the effects would cause just an offset or change in gain factor. The 2 reference switches are also connected symmetric, so that many of the errors of those 2 switched would compensate.

The offset is corrected with normal auto zero, just switching between a signal and zero conversion. The effect on gain is normally not corrected. For the new setup with resistor arrays I did a quick check on the temperature drift of the overall gain factor and it turned out to be very stable ( < 1 ppm/K).  Most if this is due to the resistors and hardly any effect from heating the LV4053.

In the version before with less stable resistors I had a fast gain factor measurement. So the measurement cycle was signal , zero and 7 V reference. So the gain factor could be corrected on the cycle by cycle basis. This was needed as there was quite some drift in the gain factor.  Even with this extra measurement the overall noise was still acceptable: the noise of the reference conversion is less than the LM399 reference noise. The extra gain correction about doubles the ADC noise - but it is still good enough, as the ADC starts with very low noise.
This mode may still be attractive, as it can also correct some thermal INL effects, that where visible with the simple resistors.
Title: Re: DIY high resolution multi-slope converter
Post by: wildhog on November 10, 2019, 07:28:35 pm
Thanks for the quick response.  Do you have an idea as to how slow you do you run-up cycles before DA begins to kill your linearity?  Also, to a first order at least, running the integrator up, then down below ground, then back up to ground should cancel out any DA effects.  If DA is modeled as a parallel RC then this holds.  Have you tried this and do you have a feel for how well it works?  I realize that you want to run the clock fast for a quick conversion, but for linearity there are some advantages of slowing it down (fewer transitions).  The big disadvantage, however, is DA and it's difficult to know the optimal run-up frequency for best linearity. 

Thanks,
Dave

Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on November 10, 2019, 09:38:42 pm
The modulation speed is a compromise: DA related errors and to get a fast rundown a fast modulation is preferred. To keep the effects of charge injection, timing jitter and settling of the integrator small, slow modulation is better. Currently my favorite would be around 60 kHz with 2 tests per period.

For the DA related error, the measurements of the difference of the 2 modes are a good estimate. So with the currently best capacitor I have (TDK NP0) and some 27 kHz modulation (with a single comparator test) the expected DA related INL error is at some 0.2 ppm of the full scale. The error is expected to go down with about the modulation frequency. There is a slight chance that some of the DA error can be compensated by measuring the average integrator voltage - ideally averaged in a way that resembles the DA time constants.  Another point would be a little more waiting in the rundown to reduce the fast DA part.

The integrator control is already going negative and positive in a way to keep the average voltage low. Here it helps a little to read the comparator  early. However the effect is limited. There is a way to use a mode with 2 comparator checks per period to get effectively twice the response - however this requires good symmetry. I had problems with this, but the current program seems to work now. However I still get slightly higher ( +30%) noise with faster modulation (125 kHz). For some reason there seem to be some odd effects of delays and the exact synchronization between the ADC and modulation. A little like that the ADC clock can effect the PWM signal generation. In some cases there is a periodic background that adds to the "noise". So a high performance version may need an extra sync stage (e.g. 74AC74) between the µC and the switches.

Attached is a graph of the average voltage (units  about 7 mV with a zero at 140) in the integrator as a function of input voltage. Curve is point symmetric about 300 mV and should about reflect the effect of the slow DA. So the linear part is only an effect on gain. The two curves are for slightly different run-up versions. The point's off the curves are usually not noise, but part of resonance like structures that is not fully visible with a limited number of points.

The other graph shown the difference between run-up speeds (27 and 81 kHz). The range is the center part of the resonant like structure near 300 mV. The 2 curves are for a poor and a good NP0 capacitor and same software version.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on November 17, 2019, 01:09:27 pm
I did some more test with faster run-up, especially going down to 104 clock cycles for the loop. This is the same length as the UART master clock for 9600 baud. In this case there is a strong dependence on the exact delays and phase relative to the UART clock. Depending on the exact delays there is some beat signal that can be quite strong, up to some 20 µV peak and some 6 µV RMS. With the right delay there is relatively low background.  The effect of the phase relative to the ADC clock is also visible and can be controlled with synchronizing the ADC clock - however this does not work well with the UART if the UART is used to receive commands at any time.

So I tried the synchronization of the control signals with flip flops  (currently 74HC74 as a dead bug bodge). The positive thing is that the clock phase of the external AVR clock is about right to use just xx74 flip flops. With the flip flops the dependence on phase between UART clock and run-up no longer has a visible effect. The noise level is about as good as it was before in the best delay case. Still the noise level is somewhat higher (1.2 µV)  than it was with slower modulation (0.85 µV). The extra noise seems to be mainly white noise, as the difference gets smaller with longer integration, where 1/f noise dominates.
Title: Re: DIY high resolution multi-slope converter
Post by: jbb on November 17, 2019, 07:51:00 pm
I don’t know if it’s a problem to worry about, but you can probably avoid reception of UART characters during the critical parts of the ADC operation by using a GPIO to as an old -fashioned Clear To Send (CTS) line and configure your ‘master’ (PC serial port?) into 4 wire mode (with RTS and CTS). The ADC uC can then simply say ‘not now, I’m busy,’ and the master can handle that in the UART hardware.

Given that you’re now considering additional logic resources, I wonder if a CPLD might be helpful.

On second thought, CPLDs don’t have ADCs and comparators. Maybe a PSoC, then? They have some special configurable logic built in which could be quite helpful
Title: Re: DIY high resolution multi-slope converter
Post by: schmitt trigger on November 17, 2019, 08:10:10 pm
I remembered an interesting part which could be useful for the input resistor: a SMT chip ceramic thermal jumper (https://www.electronicsweekly.com/news/products/passives/chip-component-gets-heat-tight-spots-without-leaking-electrons-2019-04/). 

Many thanks for mentioning this very useful component.
Earlier this year I had a project with thermal issues which had to be solved rather crudely.

This component would have yielded a very elegant solution.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on November 17, 2019, 10:16:56 pm
I don’t know if it’s a problem to worry about, but you can probably avoid reception of UART characters during the critical parts of the ADC operation by using a GPIO to as an old -fashioned Clear To Send (CTS) line and configure your ‘master’ (PC serial port?) into 4 wire mode (with RTS and CTS). The ADC uC can then simply say ‘not now, I’m busy,’ and the master can handle that in the UART hardware.

Given that you’re now considering additional logic resources, I wonder if a CPLD might be helpful.

On second thought, CPLDs don’t have ADCs and comparators. Maybe a PSoC, then? They have some special configurable logic built in which could be quite helpful

A PSOc and  likely also a CPLD / FPGA will also have some coupling from other parts to the exact timing of the control outputs. It only takes a few ps of shift for some 500 transition to cause a 20 µV error. So the external flip-flop is the normal way to avoid this: the HP34401 and many other multi-slope ADCs use such an external flip-flop. It is only needed for the 2 control signals, so only one 74AC74 or similar.

The coupling only gets really bad with special loop lengths (like 104 or 128 cycles) that gets a frequency in sync with ADC clock or UART. This way many transitions can be effected.  Even than, with a careful timing one can avoid larger effects, if the conversions start with a well defined phase of the interfering signal. With a different loop length the effect will be smaller but harder to totally avoid.

The critical run-up phase is active most of the time and currently about 70% of the time data are send - so not so practical to turn off the UART for a longer time. One may however be able to do a sync by turning it off for a short time and on again just before the run-up.   :)  So it is a good idea. This way the UART always starts with the same phase and it is thus relatively easy to find a good timing. The data send can tell the PC when sending is OK. Similar synchronization works with the µC internal ADC - this already works.

The comparator and ADC in the µC don't have to be high performance so a CPLD + external comparator and ADC (e.g. 10-12 Bit) are possible.  I just know the AVRs much better than CPLDs. The project started as a simple low cost µC based version and later turned high performance, without getting too expensive  (BOM costs at some $40-50 including the LM399 reference). There still it the option to use relatively cheap resistors and OPs and still get good (e.g. 6.5 digit) performance.
Title: Re: DIY high resolution multi-slope converter
Post by: wildhog on November 17, 2019, 10:28:24 pm
When you use the ADC to calculate the remaining charge on the capacitor, the absolute value of the RC time constant becomes an error term.  Have you tried doing a two-point measurement to calculate the RC time constant on the fly to remove it as a an error source?

Also, do you have a sense of what the limitations are of this multi-slope adc configuration?  It looks like you have between 6.5 and 7.5 digits.  Do you think 8.5 is possible with this topology?
Title: Re: DIY high resolution multi-slope converter
Post by: wildhog on November 17, 2019, 11:45:00 pm
One more question:  the remainder after the run up/run down is measured with an ADC while the conversion has stopped.  But during this time, the output is still changing due to the leakage (the fast switches have significant leakage) at the integrator node.  The output voltage is therefore changing during the ADC measurement.  I'm not sure if the ADC is a delta-sigma (in which case this would be averaged) or a SAR (in which case the output would be sampled at some time) but in either case, I'm surprised that this error is able to be so completely calibrated out.  Sampling at a very precise time would make the most sense for calibrating out an It/C error but would likely be noisy as the full spectrum noise of IC4 is sampled.  Averaging (delta sigma ADC) would reduce the noise of IC4 (as you mentioned somewhere above) but the start and stop times of the ADC would have to be precise and repeatable.

The leakage on the fast switches that you mentioned is 1uA max and you have three of them.  3uA is a lot of leakage and produces a 1mV/us error at the output of the integrator (assuming a 1nF integrating capacitor).  This is a large error to calibrate.  The noise of the leakage current is not specified but surely must affect the total ADC noise. 

Thanks,
Dave

Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on November 18, 2019, 08:27:39 am
There are 3 main parameters to look at for the ADC: noise, linearity and gain stability.

The noise data I showed are for the 1 PLC auto zero case, so the difference between 2 conversions at 1 PLC. At some 1 µV RMS and +-10 V full scale this is about 7 digit resolution. So it if 7 digits at 1 PLC.  With averaging (e.g. 100 x) the noise is down in the 8 digit range. The noise level is already lower than some 8.5 digit meters (e.g. Keithley2002, ADT6581, Solartron 8081, Fluke8508).
The noise level depends on the switching frequency used in run-up. Slow modulation gives lowest noise (0.85 µV with the current resistors), but also more INL error from DA. So the speed here is a compromise between INL and noise.
Most of the noise sources are known. A convenient way to note the noise is as a equivalent (series) resistor - 1 nV/Sqrt(Hz) corresponds to the noise of 60 Ohms, going up like the square. So the "resistance" values can be just added for different not correlated sources. Calculated back to a single (no AZ) conversion the noise is equivalent to some 600 KOhms (some 100 nV/sqrt(Hz)). Of this the integrator resistors Johnson noise is at 100 K,  the resistor excess noise is at about 100-200K, the critical OP at the integrator about 50 K, the amplification of the references some 20-50 K, the input buffer some 5 K, The final charge reading from the µC internal ADC some 20 K and the switching related effects should correspond to some 200-300K (more or less with a different speed).  The main point's for possible improvements are the resistor excess noise and the switching related part.

For the INL I see mainly 3 main sources: the dielectric absorption, thermal effects in the resistors and settling of the integrator. I think I now understand the DA effect and get this smaller than 0.05 ppm of FS with a reasonable modulation speed. For the integrator settling part his should be in a first approximation some slightly different slope for the positive and negative side. I have to do some more test on this (force the error to be large and visible with very short pulses and high frequency). So far this effect does not look to bad - chances are it's negligible. The thermal effect is question of the resistors - so far it looks good with the NOMCA array. 

Checking the linearity is rather difficult, so far I am quite confident the INL is  < 1 ppmFS and likely better, in the 0.2 ppm range, but I have no way to measure. I can kind of measure the DA effect though and at least the slow part of the thermal effects can also be tested.

With the resistor arrays the gain stability also got quite good, so no real problem there.

So 8.5 digit performance is possible (essentially there  :D) in this topology.
The critical parts are the switches and resistors at the integrator input. Of cause it also needs a better reference. It may still make sense to have a very good ADC with an LM399 as this could allow for auto cal in a low cost solution.

The ADC in the µC is SAR type, but relatively slow. The amplifier with MCP6002 is also limiting the bandwidth. So the ADC bandwidth is limited does not see a lot of higher frequency noise. When the final charge is measured the output is not changing much (barely visible in consecutive conversions) - the main reason is still the residual DA and not switch leakage or OP bias.
The xx4053 switches are not tested very much at the manufacturer. So the limiting values are high, but the typical leakage is much better. So even with the specs at 1 µA max, I see a net leakage current in the 5-10 pA range for the 3 switches.  Even if the leakage current would be high, a constant values is suppressed and would act as part of the reference currents. The main point would be that the DA measurement mode would not work that well anymore. If at all leakage would be a problem for the input path. Here it helps that the switch in using bath halfs of the SPDT switch: one sends the input current to ground and thus keeps the voltage low, the other isolates the integrator.
As a possible alternative there could still be the DG4053 switch - lower leakage specs and not too slow.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on November 18, 2019, 09:09:13 am
..So I tried the synchronization of the control signals with flip flops  (currently 74HC74 as a dead bug bodge). The positive thing is that the clock phase of the external AVR clock is about right to use just xx74 flip flops. .
Could you indicate the 7474 wiring, please (just indicate the two signals you synced, 74's clock is the external 16MHz)?
It also means the atmega with its internal xtal oscillator may not work straight with those 7474 synchronizers. So rather go with external canned oscillator as default.
Are you still working with the original schematics, parts and code (except the nomca array and the input buffer)?
Title: Re: DIY high resolution multi-slope converter
Post by: jaromir on November 18, 2019, 09:47:10 am
so far I am quite confident the INL is  < 1 ppmFS and likely better, in the 0.2 ppm range, but I have no way to measure.

Not trying to be snarky, but I still remember how confident I was about my first multislope ADC design, up to the moment I started real measurements  ;)
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on November 18, 2019, 09:55:56 am
A pity the effort with the pcb bite the dust, I think $50 7digits +/-12V input AD converter would be an interesting playground for experimenters (and I bet a lot of them have got 3458A to provide some measurements).
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on November 18, 2019, 11:49:20 am
The extra synchronization is with the 16 MHz clock from a canned oscillator, the signal  from the µC to D inputs and Q outputs to the 4053. With careful timing and not using loop length with multiple of 64 or 104 one could still get away without the flip-flop. A result from this test is that favorable timing cases were about as good as the version with the FF - so the FF is not absolutely needed but it can make things simpler.

A pity the effort with the pcb bite the dust, I think $50 7digits +/-12V input AD converter would be an interesting playground for experimenters (and I bet a lot of them have got 3458A to provide some measurements).
The PCB has some bodges, but except for the extra HC74 this is not too bad.  One of the NOMCA arrays is already includes in the PCB layout (though not very good - a 20 K version and using 2 of the resistors in series is probably better (less excess noise)).
It would likely still need an update to the PCB to have 2 (maybe 3) x NOMCA resistors, an updated buffer, a few more SMD parts, include the bodges and a connector for an optional external reference.

so far I am quite confident the INL is  < 1 ppmFS and likely better, in the 0.2 ppm range, but I have no way to measure.

Not trying to be snarky, but I still remember how confident I was about my first multislope ADC design, up to the moment I started real measurements  ;)
I was at that point of high confidence too, before testing the PCB version to find out that the version on the breadboard was better performance   :-//.  I now have quite some tests with the limited possibility at hand, and the results for the "final" versions looked good:
2 speed run-up versions are withing 0.2 ppm even a low speed. The faster version should be something like 4 times better with DA.
The turn over test revealed some problems with the buffer, that the extra bias mainly solved (though an extra 3rd OP may be better). After that there was very little turn over error - I have to repeat that test with the new version. For the thermal effects good stability gives me good hope there.

One of the next steps would be sending a board to someone with better instruments to do some more INL tests.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on November 18, 2019, 11:53:02 am
sorry IMO, life jumps up and pulls you away from your hobbies at random, It is why I released all the design files, as I felt I would get stuck unable to touch it for a while. (being 1200km away from my desktop is not helping things)
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on November 18, 2019, 11:55:21 am
so far I am quite confident the INL is  < 1 ppmFS and likely better, in the 0.2 ppm range, but I have no way to measure.

Does this mean that you are searching for someone that has the equipment and would do the measurements or borrow the equipment to you?

Edit: Question is a bit outdated due to last post before this post was sended.
Title: Re: DIY high resolution multi-slope converter
Post by: jaromir on November 18, 2019, 12:15:12 pm
.
The turn over test revealed some problems with the buffer, that the extra bias mainly solved (though an extra 3rd OP may be better).
What is the function of third opamp in the buffer?
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on November 18, 2019, 01:04:33 pm
The PCB has some bodges, but except for the extra HC74 this is not too bad.  One of the NOMCA arrays is already includes in the PCB layout (though not very good - a 20 K version and using 2 of the resistors in series is probably better (less excess noise)).
It would likely still need an update to the PCB to have 2 (maybe 3) x NOMCA resistors, an updated buffer, a few more SMD parts, include the bodges and a connector for an optional external reference.

Rerouter spent an effort with pcb design, and you are going to redo your pcb as well.

What about

a) to consolidate the ADC design (ie. a "final version of the schematics"),

b) then be focused at a more "thru-hole" lower density board, with more space on it, which allows easy routing and good grounding and decoupling, for example a 2 layers pcb 100x100mm (or even 100x160mm) of size (with four 3.2mm holes at the corners), without the power supply on it (ie. it means only with +15V/gnd1, -15V/gnd2 and 5V/gnd3 connectors), it also removes a significant heat source off the ADC board. You may need to make some milling as well (around the LM399, and/or around temperature/leakage sensitive parts). You need space.

A floating 3 voltages power supply pcb could be designed easily by anybody, while the AD board requires pretty experienced designer (especially when "7+ digits" is claimed).
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on November 18, 2019, 02:44:29 pm
.
The turn over test revealed some problems with the buffer, that the extra bias mainly solved (though an extra 3rd OP may be better).
What is the function of third opamp in the buffer?
The third OP in the bootstrapped buffer would just buffer the bootstrapped OP, inside the FB loop and with the normal +-15 V supply. This same configuration is used by CERN in there buffer for a high end ADC. This 3 rd OP would keep the load to the bootstrapped supply constant and suppress the output stage cross over distortion a had seen in my first try without the bias. It should be even a little better than just the bias.
There would be still the alternative to use only an OPA189 Az OP: it is fast and "MUX friendly" designed. So it should work behind the DG408. In this case the OPA189 would be used because of high gain and CMRR and thus good linearity, not because of the low offset.
With the old buffer I still have quite some current spikes on switching - not sure where they come from.

For me the old PCB design is still good enough. For just 2 or 3 units the bodges are OK - but I would not order more of the same. The current board is 80x100 mm with still some space in between, including space for large (e.g. wire wound) resistors. Some of the chips are THT, but some of the planed OPs (e.g. OPA145,  OPA189, OPA172, ADA4077 as a possible upgrade to the OP07) are not available in THT or much more expensive. The critical switch as THT allows easy changing (in case an LV4053 turns out to be leaky) - however the DG4053 is SMD only. The mounting holes are not at all in the corners because of the Opto couplers (isolation).

For a new layout the main open question is which resistor arrays to use. I have 2 x NOMCA (10K + 50 K) with good TC matching, but it looks like noticeable excess noise. The next step up could be using 2 resistor arrays for the integrator and thus 4 resistors in series each. This should reduce the excess noise (by some 30%) and also reduce the heating effect as the power is spread to 2 chips. The next better solution would be an LT5400 for the reference amplification part. For the integrator this is a little tricky: 100 K is rather on the high side and 10 K is too low for a +- 10 V range. So a really good solution would need more like 3 x 10 K in series and thus 3 x LT5400 for the integrator which starts to get expensive (at $8 each).  2 x 100 K in parallel would be an option too - with the advantage of possibly populating only one. As low cost alternative to the LT5400 (compatible footprint) there are MORN arrays - however with possibly quite some excess noise.

I don't have a problem with the regulators on the board. They are away from critical parts and make the use easier. If really not wanted there is still the option not to populate that part.
Title: Re: DIY high resolution multi-slope converter
Post by: jaromir on November 18, 2019, 03:18:53 pm
The third OP in the bootstrapped buffer would just buffer the bootstrapped OP, inside the FB loop and with the normal +-15 V supply. This same configuration is used by CERN in there buffer for a high end ADC.
Oh, that makes sense, thanks.
I read a few documents about DS22 and DS24 CERN ADC designs, but I don't remember bootstrapped buffer. Could you, please, share or point me to appropriate document?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on November 18, 2019, 04:53:35 pm
The third OP in the bootstrapped buffer would just buffer the bootstrapped OP, inside the FB loop and with the normal +-15 V supply. This same configuration is used by CERN in there buffer for a high end ADC.
Oh, that makes sense, thanks.
I read a few documents about DS22 and DS24 CERN ADC designs, but I don't remember bootstrapped buffer. Could you, please, share or point me to appropriate document?
I thinks I saw this for the Cern ADC too, but could not find it. I found another reference however:
https://www.semanticscholar.org/paper/Comparison-of-Two-Buffers-for-Impedance-Metrology-Kampik-Tokarski/40f8df3e21108a3360cd71deaf188ae748b0b559 (https://www.semanticscholar.org/paper/Comparison-of-Two-Buffers-for-Impedance-Metrology-Kampik-Tokarski/40f8df3e21108a3360cd71deaf188ae748b0b559)
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on November 18, 2019, 05:14:12 pm
2 x 100 K in parallel would be an option too - with the advantage of possibly populating only one. As low cost alternative to the LT5400 (compatible footprint) there are MORN arrays - however with possibly quite some excess noise.
Or 2x LT5400/100k with 3x 100k_A||100k_B..

PS: CERN's latest high-ender is the HPM7177 with the $15 AD7177-2 inside, afaik :)
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on December 04, 2019, 10:13:18 am
Once more about dielectric absorption: Meanwhile i received some ot those russian Teflon capacitors and compared them to the original capacitor of a HP 3456A. The Teflon capacitor is better, but the difference is about 20 % only, so the measurements in that other thread i linked before appear strange now. Some Styroflex capacitors recently ordered from Farnell were in between.

An intricate measurement that requires some work to get correct results. After keeping the capacitor at 15 V for about 100 msec it gets discharged for about 5 msec. There is a 100x amplifier in front of the scope, so the effect is about 3 to 5 mV, with error (drift) less than 20 uV. One thing that surprised me: The absorbed charge shows up slowly like a small current. Only after some 30 to 50 msec that current will slowly diminish when charge approaches its asymptotic total.

For all capacitors i tested the effect depends a lot on capacitor temperature. Even some minutes after soldering capacitor leads the Teflon capacitor appeared worse than the original capacitor. Bob Pease mentioned temperature in his application notes about "capacitor soakage", too.

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: jaromir on December 04, 2019, 11:09:44 am
I obtained similar results with my measurement - https://www.eevblog.com/forum/projects/multislope-design/msg2117578/#msg2117578 (https://www.eevblog.com/forum/projects/multislope-design/msg2117578/#msg2117578)
Russian Ebay PTFE were best, followed by polystyrene, PP and ceramic (probably NP0). MLCC were only marginally less horrible than electrolytics.
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on December 04, 2019, 12:45:12 pm
Can you repeat your measurement for the Teflon capacitor without charging it before - kind of a NULL check? I suspect you may have significant negative drift in your circuit. Otherwise i have difficulties since your Teflon capacitor looks like mine. In my circuit the effective amplifier input bias current was 23 pA and i compensated it to less than 1 pA using a 10 GOhm resistor driven by a 0,23 V offset.

Regards, Dieter

Title: Re: DIY high resolution multi-slope converter
Post by: jaromir on December 04, 2019, 01:20:12 pm
I tried to guesstimate whether bias current is of any significance by "measuring DA" of 500 Megaohm resistor, see attachment. Significant input current would cause voltage drop on the resistor.
Title: Re: DIY high resolution multi-slope converter
Post by: SilverSolder on December 04, 2019, 02:28:05 pm

[...] One thing that surprised me: The absorbed charge shows up slowly like a small current. Only after some 30 to 50 msec that current will slowly diminish when charge approaches its asymptotic total. [...]


Is that not consistent with absorption being modeled as another capacitor/resistor series pair in parallel with the "real" capacitor?

Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 04, 2019, 04:15:21 pm
It is normal that the hidden charge comes back slowly. Usually there are relaxation effects on different time scales, from very fast (sub ns) to very slow (hours).  Especially the classical relaxation in the volume is expected to be highly temperature dependent, like thermal activation and thus exponential change in the time scale.  The main effect expected is that the time scale gets faster, while the absolute size would not change much. There can be an observed change in magnitude as the test usually is sensitive to a certain time window (e.g. 5 ms to 100 ms here,  some 100 µs to 20 ms for the MS-ADC and some 100-1000 seconds for the standard DA numbers quoted in data-sheets).
Effects related to surface charges may be less temperature dependent. These are often the really slow processes.

Due to the different time scales involved the simple capacitor resistor model is not sufficient. It usually takes several RC elements in parallel.
The leveling off to long times could be for different reasons: fewer really slow processes, the length of the charging phase - so very slow processes are not charged up very much and also leakage current that can take over and discharge the capacitor again.

To check the effect of bias current, one could do the test with positive and negative charging before the recovery. The difference should be mainly the DA and the sum (with sign) should be mainly amplifier bias.

For the NP0 capacitors I found quite some difference between models. My currently best one was about 1/10 the DA of the worst. Good candidates to test would be low loss RF capacitors. I have not checked those.
For the PP film caps there can also be difference, as the purity of the PP material can be different. I have also seen different DA values for identical looking older PS caps.

So the Teflon caps also don't look that good. Some 3-5 mV recovery from 15 V is more than I found for the good NP0 (TDK). The time scales are a bit different so take the comparison with a grain of salt.
Title: Re: DIY high resolution multi-slope converter
Post by: Echo88 on December 04, 2019, 05:39:39 pm
Which teflon-caps did you test Kleinstein? Those with epoxy on the tube-ends or those who are pressed as a coilpackage into the aluminium-tube, which is then crimped on the edges?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 04, 2019, 06:25:15 pm
I did not test any Teflon caps. I was only comparing other people's results given (Dietert1 with 3-5 mV after 15 V (some 0.04%) and graph from the Bob Pease article (some 0.004% at 5 ms discharge). The Teflon cap from Dietert1 thus has about 10 times the DA. So a Teflon cap alone does not guarantee low DA.

Especially the slow processes have a lot to do with surface charges, possible air inclusions or similar.
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on December 04, 2019, 10:45:05 pm
I tested both the sealed type with hard electrodes "K72P-6 500V" and the aluminum tube with wires "FT-1 200V", with very similar results. All capacitors were 3.9 nF, same as the capacitor of the HP 3456A ADC integrator.
We have two test reports here in the forum where others measured Teflon capacitors with almost no dielectric absorption effect at all. For me Teflon capacitors looked better than other types of capacitors but not completely different. Don't understand that yet.

Regards, Dieter

Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 05, 2019, 07:16:41 am
There are 2 causes of DA in capacitors: one is the classical relaxation in the volume dielectric. This is usually relatively fast, mainly faster than ms.
The other part is surface charges, like in areas with air inclusions or oil where is surface of the dielectric is free and charge can build up via weak surface leakage.  This second type is often slow but can also extend to the ms range. This slow DA can depend a lot on the actual manufacturing process (e.g. rough foils, cleanness).

If it is for a replacement for the capacitor in an 3456, I would consider a  NP0 capacitor from TDK.  I tested a 2.2 nF one, but they should also be available in 3.9 nF.  Not all NP0s are the same, but at least the ceramic caps are easy to get and cheap. It is also easier to fit a small SMD one (e.g. size 0805 or 1206) than an oversized THT cap.
For me PFTE caps are no longer an option: too large, hard to get and now also uncertain quality.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 07, 2019, 12:05:16 pm
I did one more short test on the ADC, to see how fast the integrator settles and thus how much time is needed between reference changes, before errors go up.
With the given feedback method (2 comparator checks per period), the reference signal is a slow 50:50 signal at "zero" and increasingly more short positive or negative pulses for a negative / positive input. With a modified program I did a comparison of different length for the short pulses. I compared 8 and 10 CPU cycles (500 ns , 625 ns) to 16 cycles (1µs) as my main mode before. In both cases a small difference shows up: the ADC gain gets slightly higher by 0.55 resp. 0.22 ppm. As far as I can see there was no effect on the linearity down to the 0.1 µV Level.
So even the 500 ns pulses are Ok for the integrator and no real need to look for faster OPs.

The short pulses have an effect, but so far the effect is linear. For the positive and negative side by itself this is not a surprise, as there is only an increasing number of short pulses. The lucky coincidence is that positive and negative short pulse have "exactly" opposite effect and thus the same change in gain for the positive and negative side.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 13, 2019, 09:39:35 am
A small update:

It did the same test on the effect of short pulses with a 2 nd board. This board is still without the bodged in 74HC74 for synchronization and using just a crystal at the µC. There are small differences in the decoupling. The effect of short pulse was about 10 time larger with the 2 nd board and a small nonlinearity (still only some 0.3 ppm difference between +9.2 V and - 9.2 V) was visible.

However the short pulse effect turned out to be quite robust against changes to the circuit:
changing the resistors at the integrator (23 K / 46 K and 92 K),
adding asymmetry to the resistors at the integrator (another 270 K to ground),
loading the integrator output,
going from the 2 OP integrator to a simple 1 OP integrator and
changing the LV4053 to a HC4053.

So I still don't know which part of the circuit really determines the effect  :-//. I had expected most of the change above to effect the integrator settling and thus the effect of short pulses. Some did a change visible at the scope, but essentially no effect to short pulses effecting the ADC reading. There is no absolute need of the integrator input to settle before the next switching - as long as it stays linear (that is allow superposition) it is OK.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on December 13, 2019, 10:21:26 am
"Short pulse effect" - short pulse means here the time in the modulation scheme where you a) set refP for Xus, b) you set refN for Xus, right?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 13, 2019, 01:20:48 pm
"Short pulse effect" - short pulse means here the time in the modulation scheme where you a) set refP for Xus, b) you set refN for Xus, right?
Yes, it is about the short pulse that occur in the modulation scheme during run-up. depending in the signal sign there are short pulses of either the positive or negative reference. The lenght is set by the scheme to some 0.5 µs to 1 µs and for testing I measure the difference in the results with 0.5 and 1 µs pulses. This is kind testing how fast the modulation can be and how much error to expect if the shorter pulses are used (assuming the longer pulses are OK).

The simple picture is that the integrator should have fully settled before the next switching happens - however as it shows this is not really needed. Much of the settling is linear in the sense that superposition is valid and this linear part has no effect, even if not settled.
Even the nonlinear parts effect the gain in (some 800) equally spaced small steps, though independently for positive and negative side. So even that effect can be tolerated if not too large and similar for both signs. So far the effect of short pulses is quite well behaved, though different between the boards. So 500 ns pulses seem to be still OK, especially with the 1st. board.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 02, 2020, 05:54:10 pm
I looked at a possible front-end to make a voltmeter (and possible DMM) from the ADC. This mainly is some protection, signal switching and an input amplifier. For my first test the amplifier will be a LTC2057 (easy and low noise but relatively high bias and spikes). Later it would likely be an chopper amplifier relatively close to the one in the Datron 1281. The general setup is also similar to the Datron meter, with switchable gain at the input and only a buffer directly at the ADC.

Instead of the more conventional circuit I want to try a slightly odd version where the common input terminal in not fixed at ground, but moving opposite way to the amplifier output. It works in a simulation and AFAIK the concept also worked with an SD ADC (with differential input) in another thread: https://www.eevblog.com/forum/projects/need-advice-for-adc-buffer/msg1627207/#msg1627207 (https://www.eevblog.com/forum/projects/need-advice-for-adc-buffer/msg1627207/#msg1627207)
I would not be surprised if some DMMs with SD ADC (e.g. Sigilent SDM3065) also use this concept. At least it would be a logical way to get a 20(26)V high Z range with CMOS multiplexers at the input that are only good for some +-18V supply. This concept also results in low common mode voltage to the differential ADC input, which helps with INL.

The multi-slope ADC has a ground referenced input, but can be used in a quasi differential mode, switching between the positive and negative side instead of input and zero. This way the ADC acts as a differential input ADC with a +-20 V range, though with the limitation of near zero common mode signal and requiring 2 conversions (but no extra zero) for one reading.
The native input range would be good for some +-20V, despite of using only a +-15 V supply. So it looks really attractive - nearly to good to be true. So it there some hidden catch ? For internal cal measurements the ADC would likely need to run more conventional relatively to ground. So I still need to have the fall-back to a conventional fixed (though buffered) common terminal. The attached diagram is for the very basics only (1 gain step), the MUX at the right would be already part of the current ADC board.

The Keithley 2002 has a +-20 V high Z input range, but only uses a +-11 V ADC. So I had some hope to find a similar concept and some ideas there. There is no schematics available and the service manual only gives a crude block diagram. However the description of the self test steps gives more details. Combining the information gives a more detailed, though still incomplete diagram: The circuit seems to use a more basic concept, with an additional divider after the initial buffer for the 20 V range - relatively similar to the 2001 . So not much to learn from it  :(.
Title: Re: DIY high resolution multi-slope converter
Post by: wildhog on January 02, 2020, 08:46:19 pm
I would imagine that the CMRR/PSRR of the OPA145 would be quite linear -- this could easily be tested anyways.  If it is, its offset could be calibrated without the need for using the bootstrap circuit.  If it has some gentle non-linearity, it could at least be calibrated in a piece-wise linear fashion.  Did you look into that possibility?

Also, did you consider using a lower noise input amplifier like the OPA828?  You mention that the heat from the buffer amplifier could cause INL errors,  but since the device remains at a constant IQ during the entire conversion, why is this the case?

Thanks,
Dave

Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 02, 2020, 10:08:45 pm
The CMRR is not per se linear. It may be in first approximation, but not for sure. I don't think testing is that easy, as the difference i really small and there can be offsets and low frequency noise. So just having a null meter between the input and output of the buffer is not sufficient. It would be more about an lock-in amplifier and modulating the input.
For the input buffer I am more like thinking about switching to an OPA189 chopper stabilized OP. This one gives well better than 140 dB CMRR and gain. So it looks like good enough and is reasonable low power. The other advantage is that the common mode range is larger, so that the +-15 V supply is sufficient. The OPA145 may run in to limits at some 4 V from the positive rail.

The bootstrapped OPA145 itself is reasonable constant power as it runs on a little over 5 V and has not that much current (up to some 200 µA) to drive. It is not about the power changeing during one conversion, but the change with different input voltages.  The parts that provide the supply to the OP have quite some variations in the power: the heat shifts between the positive and negative side. This is why I had the transistor coupled in the initial design. It may still be Ok, but it is one of the few known possible INL sources.

I would like to avoid approximations like piecewise linear, as it would need extra effort and thus high precision instruments to establish the pieces. Without another DMM / calibrator that comes only close to the linearity aimed for, this is not a real option.

The main noise source is not the input amplifier (buffer) and also not the "slow" amplifier in the integrator, which is the most relevant OP. The main noise sources are the resistors (both Johnson and excess noise) and with faster modulation also some switching related noise (e.g. Jitter and variations in charge injection). If not measuring near 0 V the reference is also a pretty important noise source.
So replacing the already good OPA145 / OPA1641 with a more expensive, lower noise OPA827 would not make a noticeable difference.  The OPA827 may still be an option for a single OP integrator, as it is fast and still accurate. This would not be for lower noise, but higher speed.
The logical path to lower noise are better resistors instead NOMCA to reduce the excess noise. Already going from 50 K NOMCA  to 2x20 K in series should give a slight improvement. Besides lower additive noise this might also improve gain variation as a kind of multiplicative noise.
Currently the next step up would be more like a 2 nd LM399 and improvement in decoupling.
Title: Re: DIY high resolution multi-slope converter
Post by: jbb on January 03, 2020, 09:54:46 am
The pseudo-differential input trick is interesting but makes me a little nervous. To a first approximation, you get 2 readings, so double voltage and sqrt(2) noise... seems too good to be true.

The ‘inverter’ R ratio shouldn’t be a killer, because the voltage across both arms is measured.  Fitting a compensation cap back to the inverting input is almost certainly required, but could that cause odd behaviour when there is some high frequency content on the input?  There could be practical issues with the ADC ground plane capacitance vs the output of the ‘inverter’ op amp.

All in all, the real question might be “how useful is a 20V high Z range to you?” Some applications might really benefit from it, others not so much. (For example, when I’m pushing for accuracy at work I’m often down in the 0.1 to 5 C region.)
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 03, 2020, 10:58:11 am
The capacitor at the inverter to slow it down is likely needed for stability - depending on the main amplifiers phase reserve it may work without, but to be on the safe side the inverter should be at least 10 times slower than the main amplifier.

The pseudo-differential input trick is interesting but makes me a little nervous. To a first approximation, you get 2 readings, so double voltage and sqrt(2) noise... seems too good to be true.
The pseudo differential way does not even add much to the noise: the alternative classical method is alternating between the input and a zero reading. So the noise level would be about the same.

There is also another more indirect advantage on noise:
In the classical auto zero mode the input is only sampled half the times and this makes the input sensitive to noise (from the source and input amplifier) from frequencies around 25 Hz (with 20 ms integration). There is the possibility to filter this noise, but an analog low pass filter at some 10 Hz is slow. It gets even worse if the ADC runs at 10 PLC.
With pseudo differential sampling the input signal is essentially sampled all the time. So essentially no aliased 25 Hz noise from the input, though some 25 Hz noise from the inverter.

AFAIK some (if not most) sigma delta ADCs realize there differential inputs this way with 2 internal ADCs. So The idea is not that new.

I know there is a limited use for a 20 V range compared to a 10 V range. However if it comes at a low effort / cost, why not ?
There are a few complications with possible amps or 4 wire ohms ranges, but no as far as I have looked at it is not too bad.
The  "too good to be true" part makes me worry a little, but there is still the fall back option switching the inverter to a ground buffer.
There is some limitations to non auto zero mode, but that is OK for me.
Title: Re: DIY high resolution multi-slope converter
Post by: SilverSolder on January 03, 2020, 06:08:39 pm
[...]
For the input buffer I am more like thinking about switching to an OPA189 chopper stabilized OP.
[...]

When in neanderthal mode, I have successfully used this amp as an ad-hoc buffer with literally no supporting components at all...  it is an extremely stable and generally likeable component.  It seems an excellent choice.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on January 03, 2020, 07:14:22 pm
[...]
For the input buffer I am more like thinking about switching to an OPA189 chopper stabilized OP.
[...]


When in neanderthal mode, I have successfully used this amp as an ad-hoc buffer with literally no supporting components at all...  it is an extremely stable and generally likeable component.  It seems an excellent choice.

Not sure about that:
https://www.eevblog.com/forum/metrology/emi-measurements-of-a-volt-nut/msg2819014/#msg2819014 (https://www.eevblog.com/forum/metrology/emi-measurements-of-a-volt-nut/msg2819014/#msg2819014)
and following posts...
Title: Re: DIY high resolution multi-slope converter
Post by: SilverSolder on January 03, 2020, 08:25:55 pm
[...]
For the input buffer I am more like thinking about switching to an OPA189 chopper stabilized OP.
[...]


When in neanderthal mode, I have successfully used this amp as an ad-hoc buffer with literally no supporting components at all...  it is an extremely stable and generally likeable component.  It seems an excellent choice.

Not sure about that:
https://www.eevblog.com/forum/metrology/emi-measurements-of-a-volt-nut/msg2819014/#msg2819014 (https://www.eevblog.com/forum/metrology/emi-measurements-of-a-volt-nut/msg2819014/#msg2819014)
and following posts...

Fair point - but how hard can it be to keep EMI out of the way? - it wasn't a problem to me even with a bird's nest approach, but my lab area is pretty quiet EMI wise.
Title: Re: DIY high resolution multi-slope converter
Post by: wildhog on January 03, 2020, 08:43:38 pm

The  "too good to be true" part makes me worry a little, but there is still the fall back option switching the inverter to a ground buffer.


Why a ground buffer and not just ground?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 03, 2020, 09:19:40 pm
The effect of just 10 K in series and also the added capacitance does not look that nice. So It does not look such an easy going.
I can have a relatively low and rather constant source impedance for the OPA189, though I definitely don't like 100 pF to ground very much - a little less may be OK with settling.
The OPA189 would still be an option to try. Even if the new ADC board has more like a 3 OP version it would be easy to only populate 1 and add a bridge.

For a bootstrapped OP buffer I found another possible configuration: the input amplifier of the Keithley192 (from the old days when the instructions still included schematics) uses 3 OPs, with the the final OP not just as a buffer but with additional lower frequency gain. So this version also increases the loop gain and this way should have very good linearity, even if the single OPs don't have that much gain.

Why a ground buffer and not just ground?
The ground buffer comes out easy when the inverter is switched "off" at the input side. The buffer for most cases it not inside a critical path, so errors of that buffer should not be that bad. I hope I would need to switch back to ground buffer mode only for some kind of ACAL measurements to measure the amplifier gain and maybe if later added for 4 wire resistance measurements. It would add a little noise, but not much. Offset and output impedance should have little effect. I could use switching at the output, but this would need lower resistance switches and leave the ground return current from the gain setting.
Title: Re: DIY high resolution multi-slope converter
Post by: saturnin on January 04, 2020, 12:06:32 am
The Keithley 2002 has a +-20 V high Z input range, but only uses a +-11 V ADC. So I had some hope to find a similar concept and some ideas there. There is no schematics available and the service manual only gives a crude block diagram. However the description of the self test steps gives more details. Combining the information gives a more detailed, though still incomplete diagram: The circuit seems to use a more basic concept, with an additional divider after the initial buffer for the 20 V range - relatively similar to the 2001 . So not much to learn from it  :(.

The input buffer in KEI2002 may be a composite amplifier which consists of U245 (LT1124) & U249 (LTC1050). It provides low offset, low noise and low input bias current. I guess its topology is as shown on the attached picture. As the block diagram in the documentation suggests, the signal from the input buffer goes to A/D MUX (U222) and then to A/D buffer (U226) which should be very similar to the A/D buffer used in KEI2001.

All of above is only a speculation based on my investigation of circuit topologies used in KEI20xx series. I have a KEI2002 waiting for repair (need ADC board, or ADC ASIC)... If it helps I could check what the real topology of the input conditioning is.
Title: Re: DIY high resolution multi-slope converter
Post by: TiN on January 04, 2020, 12:44:15 am
Here is K2002 ADC schematics (https://xdevs.com/doc/Keithley/2002/sch/k2002_ADC.pdf) for reference.  :-DMM
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 04, 2020, 10:45:47 am
As similar parts are used I would expect the input buffer of the K2002 to be similar to the AC input amplifier in the K2001. Because of the 20 V range it also needs bootstrapping of the supply.
From the description of the self tests the 20 V range looks odd with an extra 100K-100K divider and extra buffer (U217 (OP97)+likely support by U257 (AD711)).
The rest of the circuit looks rather conventional, with a CMOS MUX and it looks like a single (likely selected for good linearity) LT1007 as the main amplifier.
The odd thing is that there seem to be a direct x1 path (used in self tests) and thus a 10 V range. However it looks like it is not used in normal operation  :-//.
The gain setting resistor for the x50 amplification is the high end sealed BMF pair. The x5 gain uses one of the blue dividers. There is also a precision 1.75 V reference (from LTC1043) - so there may be some kind of ACAL for the 2 V range - at least the HW part is there, for not much other use.
I have a crude circuit plan (for the DCV and amps part) deduced from the test descriptions. I have to redraw it one more time to make it more readable.
Title: Re: DIY high resolution multi-slope converter
Post by: saturnin on January 11, 2020, 09:25:59 am
It is as I thought - the input buffer circuitry is basically as shown on the schematic I posted above. It is powered by an isolated DC/DC converter which provides several voltage levels.
As for 20V signal path, the input buffer output is divided by 100K-100K divider (20V -> 10V conversion) and then it is buffered by U217 (OP97). U257 (AD711) acts as a tracking voltage regulator for U217.
There is a direct x1 path. I might be used for low voltage ranges (haven't checked this). Obviously it can't be used for 20V range since A/D buffer (U226) is powered by +/-15V.

I must say reverse-engineering of KEI2002 is definitely not for the faint-hearted. Four layers PCB, buffers, protections and local auxiliary voltage regulators everywhere and on the top of that deliberately misleading service manual (can't believe so many typos can be made unintentionally - thank you Keithley :-\).

I think the KEI2002 performance can be improved slightly be using modern opamps, but it has to wait until I get functional ADC board to test this.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 11, 2020, 10:59:20 am
Attached is the crude plan for the voltage input of the K2002, that I got from the descriptions of the self tests. I have not check this against real HW and there are some contradictions and unclear formulations so take it with a gain of salt.

From the description it looks like some Ohms modes use the x 1 path.
From the board pictures I saw, there is not much unidentified circuit around U226 (the main amplifier). So with just a single OP (LT1007) used as the main amplifier, the achieved INL level is already surprisingly good. For some odd reason the buffer on the divider for the 20 V range got more attention (visible on photos, but not in the test description).

Back to my ADC design: I populated a 2 nd board to do some more tests. The 2 nd board uses just a crystal and no external sync. For some reason the 2nd board shows rather high INL error. With some software version the turn over error is up to 250 µV, so really bad. I don't think this is due to the different clock or missing sync (the first board was OK without the extra flipflop). The buffer amplifier also does not seem to be the reason.  My guess is more with transients at the integrator - though equal parts are used.  To see it positive: the larger errors may help to identify the mechanism that causes so much INL.  However so far not much luck. Changing the resistors at the integrator (20K ,46K and 92 K) has not much effect. Also the noise with 92 K resistors is still at an acceptable level so a single 100 K  LT5400 may be possible with not too much noise.
I also tested another run-up version with zero phases in between. So the reference is not directly going from positive to negative, but with a short zero phase in between. So the steps a spread in 2 smaller ones. The SW gets confusing, but did not really improve things.
Title: Re: DIY high resolution multi-slope converter
Post by: saturnin on January 11, 2020, 01:23:41 pm
I was interested only in DCV signal path, so I didn't go through all blocks. As for DCV ranges, I can see two mistakes (due to no hints in the documentation): lower leg of Q203 is connected to U253 output and Q201 input is connected to U255 output.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 11, 2020, 04:12:56 pm
If Q201 goes to the input or output of U255 probably does not make a big difference.
Knowing that the lower leg of Q203 goes to the output of U253 (= ADGND) is good.

Another part that is not that sure / clear and a little odd is the part with R313, R314 going via U242 to the input of U253.  To me that part does not make much sense. The current sources for the references in the ADC circuit are a kind of elegant way to allow for a (small) difference between the input ground (ADGND) and the reference low side. However the ADC circuit still needs ADGND to be close (e.g. < +-1 V)  to ground, so the signal at U253 can not be much different from ground.

The main part still left over is U236 (= OP27). It may be part of the buffer with U217+U257.
There is also no more free input at the MUX U222. So I see no way that there could be a kind pseudo-differential mode hidden.

U256 also does not appear in the descriptions - these 2 OPs are likely used with the input protection (e.g. bootstrapping the protection) and maybe part of the input buffer (e.g. part of the floating supply or current source).
Title: Re: DIY high resolution multi-slope converter
Post by: saturnin on January 11, 2020, 06:59:00 pm
Another part that is not that sure / clear and a little odd is the part with R313, R314 going via U242 to the input of U253.  To me that part does not make much sense. The current sources for the references in the ADC circuit are a kind of elegant way to allow for a (small) difference between the input ground (ADGND) and the reference low side. However the ADC circuit still needs ADGND to be close (e.g. < +-1 V)  to ground, so the signal at U253 can not be much different from ground.

The ADC needs to measure signals from different sources: e.g. voltage reference, input signal etc. Based on a given signal the proper ground is selected by U242. In reality, voltage reference and input signal grounds are the same wire, but they need to be measured as close as possible to the signal location to avoid errors caused by voltage drops along the wire. I would guess there are max. tens of mV difference between REFLO and COM grounds.

The main part still left over is U236 (= OP27). It may be part of the buffer with U217+U257.

In KEI2001 +5V ground and +/-15V grounds are shorted directly. Not so in KEI2002: +/-15V are referenced to COM while +5V is referenced to "Common 3". Still you need to define relationship between COM and "Common 3". U236 is used for this purpose. It is a unity-gain buffer. Its input is connected to ADGND and output to "Common 3". It probably helps to isolate COM and "Common 3" yet it keeps them at the same potential. Quite surprising for me.

U256 also does not appear in the descriptions - these 2 OPs are likely used with the input protection (e.g. bootstrapping the protection) and maybe part of the input buffer (e.g. part of the floating supply or current source).

U256 powers input stage of the input buffer.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 11, 2020, 07:33:04 pm
For the 4 wire Ohms mode Ohms sense low is connected to the ground side buffer (U253). So in theory there could be more than 10 mV, though in many cases it would be less. The other grounds are connected and the difference would be even less (no extra connector to an external reference), so it would be only trace resistance.
Thanks for explaining the function of U236. Having the 5 V ground relative to the output of U253 and thus ADGND makes sense, as the ADC contains a few critical HCxx chips. The switch resistance and speed would be effected by the 5 V supply and digital GND level.
Title: Re: DIY high resolution multi-slope converter
Post by: ogden on January 24, 2020, 11:59:50 am
Just stumbled on "precision" mux http://www.ti.com/product/TMUX6104 (http://www.ti.com/product/TMUX6104) with special charge-injection cancellation circuitry (-0.41 pC in the full signal range). TI article about charge injection (https://e2e.ti.com/blogs_/b/analogwire/archive/2018/10/18/is-charge-injection-causing-output-voltage-errors-in-your-industrial-control-system). For those who already know - sorry. Others may find something new, perhaps.
Title: Re: DIY high resolution multi-slope converter
Post by: coppice on January 24, 2020, 12:13:39 pm
Syncing an MCU's ADC with such external events is difficult.
With some MCUs its difficult, but with some its trivial.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on January 24, 2020, 01:30:57 pm
Here is a config for the integrator switches:
http://www.ti.com/lit/ds/symlink/tmux1134.pdf (http://www.ti.com/lit/ds/symlink/tmux1134.pdf)
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 24, 2020, 02:06:25 pm
Just stumbled on "precision" mux http://www.ti.com/product/TMUX6104 (http://www.ti.com/product/TMUX6104) with special charge-injection cancellation circuitry (-0.41 pC in the full signal range). TI article about charge injection (https://e2e.ti.com/blogs_/b/analogwire/archive/2018/10/18/is-charge-injection-causing-output-voltage-errors-in-your-industrial-control-system). For those who already know - sorry. Others may find something new, perhaps.

The 4:1 mux is not that relevant for the ADC circuit. A corresponding MUX with 8 inputs could be an option for the input MUX. I still see quite some charge pulse with the DG408 or DG508, but I am not sure if this is from the MUX or buffer amplifier.
The ADC itself uses 2:1 switches at a fixed low voltage, where the charge injection is naturally low, even with not so special switches.


After quite some test, I finally found the weak point of the 2nd board: The crystal driven from the µC was somehow effected by the integrator signal. Changing the crystal to a boxed oscillator (this time 12 MHz) did the trick, even without the extra flip-flop.
For tests the integrator uses 20 K resistors (PTF56 type). In part this is to see if it may be possible to use 2x10 K from LT5400 in series and see in general if INL effects from high current get visible.  The current is a little on the high side and there may be some INL from thermal reasons or OP loading. So far no obvious extra error is visible. However the tests so far are not sensitive to ~ U³ type errors (e.g. expected from thermal effects). So it would need one more test that is also sensitive to U³ parts.

The attached files shows the difference between two speeds for modulation for negative voltages. One for the bad case with crystal and one with the canned oscillator-
The absolute value of the difference is arbitrary (additional charge pumping due to different frequency) and the slight linear slope for the good case is at least in part due to the continuous changing (capacitor discharge) voltage during the test. For comparison the second picture shows the comparable curve with the quartz crystal for the clock. The V shape error corresponds to the large turn over error seen with only the crystal.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on January 24, 2020, 02:14:39 pm
A 20x improvement from 1 change, Now that is something very nice to see,

For the canned oscillator graph, how does that look if scaled by PPM of input instead of delta voltage?
Title: Re: DIY high resolution multi-slope converter
Post by: ogden on January 24, 2020, 03:16:16 pm
Would be nice to see summary of current state of your project - including short description of the goal(s), pointer to theory of operation. Also some answers to main questions people who possibly just arrived here in this thread, would have. Like: It is open source (HW/SW) or not, where are design files/SW if any? What are "guaranteed by current design" specs expressed in common ADC/DMM performance figures?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 25, 2020, 10:54:08 am
A 20x improvement from 1 change, Now that is something very nice to see,

For the canned oscillator graph, how does that look if scaled by PPM of input instead of delta voltage?
The improvement was relative to a bad starting point. So the unusual point was that the the crystal at the µC was unusually sensitive to external effects. The 2nd board is now about to the same level (maybe a little better) I have with the 1 st.  I also started with just a crystal on the first board, but there was a relatively small effect changing to the canned oscillator - because of this (and because it took some time to find one) I was so slow in changing to the canned oscillator.

The ADC full scale is at some +-10 V. So the variations of some 2-3 µV in the difference test correspond to some 0.2 -0.3 ppm of the full scale. However this test is not a full INL test: It does not include all INL contributions - mainly DA and switching effects, but not things like self heating of the input resistor and the input buffer.  On the other side it is also effected by variations in the 5 V supply effecting the charge injection and a non ideal test signal (e.g. nonlinear capacitance).

Compared to normal ADC / DMMs specs the current state is about the following:
Input range about  +11 V to -12.5 V, with some limitations beyond some +-10 V
Sampling rate: 24.5 SPS:  20 ms input, ~250 µs rundown , 20 ms zero (or negative input), ~250 µs rundown
Nominal (numerical) resolution:  ~28 bits
Noise: about 900 nV_RMS for the 24 SPS auto zero readings, difference of the 2 readings with 50 K input resistors.
For a DMM this would be called just 7 digit resolution for 1 PLC (24.5 readings/second)
With averaging one would be at 8 digit level for about 100 PLC.
However the LM399 reference adds extra noise with higher measured voltages. So the real resolution is more like 6-7 digits, limited by the reference. The lower noise is still useful at the low end of the range and for internal tests (e.g. ACAL).
Speed wise it is currently 1 PLC and for tests also 2 / 4 / 8 / 16 PLC, but more noise than averaging.
The Hardware should also work reasonable up to some 1000 reading per second with good resolution - currently the data transfer takes longer.
I have not tested the stability / temperature drift very much. The crude test gives some 1 ppm/K for the ADC gain in addition to the LM399 reference (should be < 1-2 ppm/K).
It somewhat depends on the resistor quality, so the spec limit would be more like 10 ppm/K, but the specs on the NOMCA resistors seem to be conservative and TC matching to the 1 ppm/K level seems more like typical.

The difficult part is linearity. Here the measurements are limited:
The turn over error (testes at some 9.3 V and 8.4 V) for both board is at some 3-8 µV, so around 0.5 ppm for each reading.
The wiggly part of the INL (mainly switches and DA) looks like better than some 0.3 ppm.
The thermal effect of the input resistor (U³ part) is expected to be less than 1 ppm FS for the TC seen in the gain drift.

Guaranteed by design is difficult as at that level.  The tricky parts are the small effect one does not fully understand or has no good control over (e.g. parasitic coupling, acoustic effects, RF interference, thermal effects, board leakage). So there is no guaranteed by design limit - it is more a best case scenario in the design, from the noise sources and INL effects one understands. This best case scenario is at around 500 nV noise (mainly the 50 K resistors) and ~0.05 ppm INL from  the DA (depends on the run-up) and ~ 0.2 ppm INL from the thermal effects of the resistors.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 27, 2020, 09:57:06 pm
A short update for today:
I did a few more turn over tests. This time for the run-up with the classic 3 phase  mode. For comparison 3 different lengths (667 ns, 1000 ns and 1500 ns) of the fixed phases were tested. The overall length for the cycle is 8.5 µs, so relatively fast, but not as extreme as in the 34401 or 3458 with some 3.2 µs cycle.

I found a relative easy way to make the test:  have the ADC sample 2 external inputs and calculate the difference. Those inputs are connected to the + and - of the external source. The ground connection is switched between the two sides with a mechanical switch.  This way the program continuously reads the same voltage. So even small difference get relatively well visible without much math.

The picture shows the turn over error for different test voltages and the 3 run-up versions.
For the mode with long fixed phase the 9.3 V point is already outside the range, and for the lower voltages there was hardly a turn over error visible ( < 1 µV range).  So while the two modes with the short times are not that good, the mode with a longer waiting time looks very good. ;D
The turn over error looks about proportional to the voltage. That is a slightly different gain for the positive and negative side. This is what is expected for the error from short pulses. 
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on February 11, 2020, 05:00:05 pm

A short update:
For a new board there is the choice of the resistors between NOMCA (e.g. 2x20K in series) and LT5400 (100K or 2x10K or 3x10 K in series). To check if using only 20 K resistance and thus more current at the integrator causes problems, I did a test with 20 K (the measurements before) and also 10 K resistors. I don't plan to use 10 K for the final version, this is more like a test to provoke errors than would come up with smaller resistance. So if 10 K works Ok, 20 k should be fine.

With more current the settling effects of the integrator gets more visible. The two attached scope pictures are for the integrator input for switching the reference from positive to negative and back to positive again. The scale is about 50 mV/div , 500 ns/Div (but no divs visible :-DD) the time between the switching is 1 µs and the peaks go up to about some 150 mV (same scale for both pictures). The two pictures are for 0 and some +6 V input voltage. One can see that the settling after the switching is faster and better with positive voltage. This also explains, why the step from negative to positive ref looks so much better.
This shown that the OP (OPA172) in the integrator behaved nonlinear (e.g. BW or phase reserve dependent on output current) and this can contribute to the INL error. Depending on the input voltage the settling changes and the number of short times in between also changes (about linear with the voltage). So this effect can contribute to a U² contribution and thus the turn over error. The transient by itself would not be such a problem if they don't change - this would only give an offset, and if they extend over the short pulses maybe a little change in gain.

The good thing is that one can avoid this effect: With an added current to the integrator output, the transients look much better, even more than expected from the pictures shown  ;D.
This is because the switching no longer includes the change in sign of the current and thus the cross over range of the output stage. The first test was with just a resistor for the extra current, the later solution would be a current mirror - this can even keep the currents after switching about constant. So things look good for using 20 K resistors for the integrator.

Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on February 15, 2020, 08:17:28 pm
Another short update:
The test with the 10 K resistors is kind of limited, as the gain is drifting a lot. Probably the more power type wire wound resistors are just not a good choice. With so much drift an INL test is difficult.

So back to 20 K (2x 10 K PTF56 resistors in series) at the integrator. This time with the current mirror to compensate for changing input current. In addition there is an additional capacitor at the integrator to improve the transients a little.
A test with disabled current mirror does not change much. So the main improvement is from the extra cap.

I did some INL test with an external, switchable reference:
The first one is the classical turn over test, this time in a fast version: the MUX at the input switches between 2 values and the ground connection is switched by hand.

The second test is using 2 voltage in series that give an about constant sum of some 9.3 V. This test can be done in 2 versions:
1) The more classical form with a zero measurement for auto zero of the ADC. There are 4 such readings (including one zero offset) that are repeated about 4 times. This test is symmetric about the center.
2) In a fast version, there are only 2 measurements:
 one is reading the difference between first partial voltage and the sum (some 9.3 V). The second case measures zero and the second partial voltage. The fast version is less sensitive to low frequency reference noise and thus attractive.
Ideally the two tests would give the same result. The 1st versions only adds 4 additional zero conversions.  However there are still some differences, especially from thermal effects and possibly from a delayed effect.

Attached are the results for the turn over test and the sum tests.
For the sum tests the + and x symbols are for the fast version using the normal and slow run-up versions. Likely due to thermal effects the curve is no longer symmetric.
The * symbol is using 4 separate AZ readings. By design this test is symmetric. These readings are more noisy as more steps are needed and thus more reference noise.

 
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 07, 2020, 09:16:41 am
Sorry for the long delay, But I am back if you wish to continue, seems the current changes are slightly different choices in op amps, a revision on the input buffer, 2 arrays in series for the integrator, a canned oscillator for the micro and some change to the integrator response capacitors?

also provisions for the changeover input / multimeter functions.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 07, 2020, 12:05:58 pm
The changes done so far are:
1) slight changes in the input buffer (adding a resistor to provide a biasing current to keep the output stage in class A. 
2) A canned oscillator and for one of the 2 boards also 74HC74 flip-flops for syncronization
3) An additional capacitor at the integrator: a direct feedback for the "slow" OP
4) A low pass filter and buffer for the average integrator voltage - currently used for debugging, as a test-point.
5) For a test : add a current mirror at the positive supply, controlled by a resistor from the buffer output + one to ground. The current goes to the integrator output. As a result the waveform at the integrator looks better (no change with input), but there is essentially no change in the INL error visible.

There are a few planed changes, not yet in HW:
1) use different resistors at the integrator: either LT5400-100K (1 or maybe 2 in parallel) or NOMCA as 2x20K in series each
    this would be for a new board
2) test a buffer for the ground to the 4053 switch to make it easier to use an external reference
    I can test this with the current board.
3) For the integrator I would like to test another option to use extra FB from the average integrator voltage during run-up. This could help to reduce errors from DA and related. This part would be mainly an optional DG419 switch and a few resistors.
4) Changes to the buffer: 3 OP version with maybe different OPs or maybe just 1 AZ OP (e.g. OPA189).
5) Input amplifier and switching to make is a real voltmeter with different ranges, possibly later also a DMM with current and resistance ranges. This part would be more like a separate board.

The tests with different resistors, like 2x10K in series as the last version are more like for tests, to see if lower resistors are possible or if some INL contributes get stronger so they may be easier to identify. So far it is kind of unclear:   still need to check the INL with higher/lower resistance and otherwise same HW.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 07, 2020, 12:48:39 pm
1) slight changes in the input buffer (adding a resistor to provide a biasing current to keep the output stage in class A.
I assume something like 100K to the -15V rail, or did you do something else?)
Quote
2) A canned oscillator and for one of the 2 boards also 74HC74 flip-flops for syncronization
Any description of how the 74HC74 is used, I presume inline with the PD2/PD3/PD4 lines? and maybe the PC3/PC4/PC5 lines?
Quote
3) An additional capacitor at the integrator: a direct feedback for the "slow" OP
would that be between U2 + and the intergrator input node, and assuming something low like 1nf?
Quote
4) A low pass filter and buffer for the average integrator voltage - currently used for debugging, as a test-point.
already have an integrator output test pad, so if you have a rough circuit, I will just add it. always been a chunk missing from that area I've not been sure how to fill.
Quote
5) For a test : add a current mirror at the positive supply, controlled by a resistor from the buffer output + one to ground. The current goes to the integrator output. As a result the waveform at the integrator looks better (no change with input), but there is essentially no change in the INL error visible.

Harder to visualise this, is this what you meant as a means to keep the buffer output biased on?
Quote
There are a few planed changes, not yet in HW:
1) use different resistors at the integrator: either LT5400-100K (1 or maybe 2 in parallel) or NOMCA as 2x20K in series each
    this would be for a new board
2) test a buffer for the ground to the 4053 switch to make it easier to use an external reference I can test this with the current board.
3) For the integrator I would like to test another option to use extra FB from the average integrator voltage during run-up. This could help to reduce errors from DA and related. This part would be mainly an optional DG419 switch and a few resistors.
4) Changes to the buffer: 3 OP version with maybe different OPs or maybe just 1 AZ OP (e.g. OPA189).
5) Input amplifier and switching to make is a real voltmeter with different ranges, possibly later also a DMM with current and resistance ranges. This part would be more like a separate board.
1. Had already started working towards 2 in series based on earlier comments, for 2 in parrellel that gets more interesting to lay out without cheating and mirroring on the other side of the board (you wanted the heat shared, which means to me all signals through both resistors)
2. Not clear why ground needs a buffer to use external references,
3. There is extra ADC pins, e.g. your peak overflow pin could be repurposed to this. as it would serve the same role to my understanding. if you have a circuit in mind, I will add it.
4. The buffer is the hard part, I know it will take time, so ready when you are.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 07, 2020, 01:00:06 pm
Should also add, I finally discovered kicad has the hotkey of shift to select / deselect single items, so its even cheaper for me to move around chunks than before.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 07, 2020, 04:22:20 pm
The extra sync is for the PD3/PD4 lines to control the reference switches. The switch for the input is not that critical and does not need the extra sync.

The input buffer got a bias current from a 1-5 K resistor to the local bootstrapped supply (R87 in the plan), so a rather constant current.
The two boards I have soldered use slightly different versions of the buffer, especially the bootstrapped supply part and both work. The 3rd OP in the plan is an in loop buffer, so that the precision OP does to need to drive the load.

The additional capacitor (C14 in the plan) at the integrator is from the output to inverting input of IC11 (OPA1641 in current circuit). The current value is 390 pF, the best values depends on the other capacitors / OPs. So a values to be determined experimentally to get low overshoot. I don't think it needs a trimmer, more like one of 220, 330, 390 or 470 pF depending on the OPs and resistors used. With larger resistors at the integrator input the cap may be less important.

I have attached a circuit plan for my current planed version, both as PNG and eagle file (zip packed).  I know the circuit diagram is a little crowed.

The extra current mirror is with T5/T6 (below IC19) and the resistor values may still need some tweaks.


The choice of the resistors is a slightly difficult part and I have not decided for my board. I see several possible choices:
1)  1 x NOMCA 20 K with 2 of the resistors in series each. The reference part would be a 10 K NOMCA with 2 of the resistors in parallel each.
 This would be a good match to a LM399 reference, with still a little more noise from the LM399 than the resistors.

2)  LT5400 resistor: for the reference amplification a single 10 K version should be good.
    For the integrator one could use 1 x 100 K , 2 x 100 K in parallel  or maybe 2 or even 3 x 10 K in series. 20 K is a little on the low side, though it did work for the test with PTF56 resistors. 1 x 100 K would be a little on the high side, with slightly higher noise, but probably still similar or better than the 40 K NOMCA case. The parallel layout is tricky, but it should be possible, e.g. with the chips side by side and  references on the inside and only a single critical link. The 4 th resistor each would be a guard between the signal and the reference resistors. The nice point is that one can start with a single array and add the 2 nd later for lower noise.

An external LTZ1000 reference kind of needs better resistors than the NOMCA.  A LTZ reference with only the NOMCA resistors does not make too much sense, as there would be resistor excess noise larger than the reference noise. The LTZ reference could also need either a +16 V supply or a JFET instead of T7, to make it work with the slightly higher voltage.  The ground buffer IC1 in the plan would help with the external reference, as it would reduce the current spikes to the central ground point that would be at the reference. If not used one might need a 3rd ground line to the reference.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 08, 2020, 12:40:58 am
Would it be possible to upload your eagle schematic saved as the XML based format?
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on March 08, 2020, 07:28:26 am
Do you have some measurement or reference for your statement about "Nomca resistors destroy LTZ reference low noise"? Maybe some link?

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 08, 2020, 08:15:49 am
the 5400 series resistor arrays are pretty much the best you can get, and specced on only the worst case spec in there datasheet,

The nomca by comparison's typical value is about 2-4 times worse from memory,

Due to the position in the signal chain, most of the noise of the entire circuit is dominated by those input resistors, (was about 2700nV / root Hz when I was calculating using a 25K array), so using any tricks you can to reduce the noise of those resistors gets a very significant improvement in the entire circuit.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 08, 2020, 10:20:29 am
In the thread about statistical arrays there was a report on added noise when using the NOMCA resistors to scale a LTZ1000 reference:
https://www.eevblog.com/forum/metrology/statistical-arrays/msg2527074/#msg2527074 (https://www.eevblog.com/forum/metrology/statistical-arrays/msg2527074/#msg2527074)
In short: using NOMCA for a divide by 2 adds about as much noise as the LTZ1000.

Compared to the simple divider resistor excess noise is more of a problem in the ADC. Here the resistors see a higher voltage and more resistors are involved.
I see quite some extra 1/f noise. This could be either from OPA1641 OPs (3 pieces tested) much more noisy than normal or as the other main source from the excess noise of the resistors.  I also see the noise to go up when measuring the ADCs own reference - in this case resistor excess noise gets more important.
The data-sheet for the NOMCA specifies a noise index of < -30dBi. Using 2 resistors in series or parallel adds -3dB.  This is about the order of magnitude of noise that I see. So the resistors don't seem to be much better than the specs. There is a little hope that the 20 K arrays may be a little better than 50 K as there is the tendency that resistors at the upper end of the range can have higher noise.

In comparison the LT5400 gives < -55 dBi , so really good - kind of difficult to measure.

The TC and TC matching specs are also much better for LT5400, even though the NOMCA resistor TC matching seem to be often better than spec and using 2 resistors each also helps. Good TC matching can help with the thermal part of the INL.

Due to the position in the signal chain, most of the noise of the entire circuit is dominated by those input resistors, (was about 2700nV / root Hz when I was calculating using a 25K array), so using any tricks you can to reduce the noise of those resistors gets a very significant improvement in the entire circuit.

The resistor noise is a significant part, but not that bad.  For the Johnson noise the integrator resistors act as if 2 of them are in series to the input. The known OP noise correspond to some 40 K for the noise equivalent resistor. There is also some other noise, not yet full understood (e.g. from jitter and variations in charge injection).   The additional 1/f noise suspected to come from the  NOMCA 50 K resistors makes up about as much as all other noise sources together.

The resistor excess noise contributes to the normal additive ADC noise - this is not nice, but still not too bad, as the 1 PLC integration the frequency is still relatively high. So the additive ADC noise with a short is still good (e.g. still close to the spec limit for the 3458 at 1 PLC).
The more nasty part is that resistor excess noise also causes multiplicative noise - here the frequency is not limited to some 25 Hz from the AZ chopping. So the lower frequency resistor noise does matter and causes statistical variations of the ADC gain. This directly competes with reference noise. In this comparison the NOMCA resistors seem to be in between the LM399 and LTZ1000 reference noise levels.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 08, 2020, 11:38:07 am
Have what I believe to be all but IC16 done, also spotted an error in your schematic, IC4 is lacking a connection to the -15V rail

still have a few 2XX / 3XX references, mainly decoupling additions, and some references that I just cannot see clearly.

I was less clear with what you where doing with the resistor arrays with sets of 10, and around the reference area, so I took them as optional footprints, as such I tweaked what I had to allow parallel and series combinations, the reference one is done the same, just with 1 set to allow for parrellel. However If we stick with that, I will probably shift things around so the thermal pad would not short for any mounted on the backside.

Edit: There are some blue notes on the PCB, for noise and current, I have not updated most of them, so ignore for now.
Edit2: also revised most of the design files to use generic kicad footprints, so this one should preserve the 3D models for most next time I release an archive of it.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on March 08, 2020, 11:39:36 am
I proposed some posts back 2x LT5400-100k in parallel (thus you get 50k). You may then deploy 1x(100k) with LM399 (6.5dig) or 2x(50k) with LTZ1000 (7.5dig) when considering noise of the integrator resistors vs. Vref.

https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/msg2790476/#msg2790476 (https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/msg2790476/#msg2790476)

PS: put the package A on the top, the package B at the same place from the bottom of the PCB and wire in parallel via 6 vias. Easy..

PPS: randomly chosen new LM399AH will 1/f fluctuate within 1ppm (10uV) with some popcorn noise (4-7uV jumps) after 1500hours burn in, when lucky. So the integrator resistors value vs. 399 noise would be rather academical issue here, imho..

PPS2: the arrays around the 399 reference - imho - 1xLT5400-10k + OPA2277 (+/-14.1V Vref -> no problem with 100k/50k integrator resistors, afaik) is pretty enough considering the 399's qualities..

PPS3: ANY resistor wired to LT5400 in ANY way will make the entire TC worse (unless you own a bag of 0.2ppm/K resistors)..
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on March 08, 2020, 06:40:39 pm
Thanks for the link to the noise measurement results of antintedo. I thought there were some new results to confirm them.

The LT5400 datasheet specs -10 ppm/K < TC < 15 ppm/K for the absolute resistor value and there is no spec on how stable the absolute TC will be. Yes, any mixing with other parts will ruin the tracking specs except for fine tuning the residual imbalance of 0.01 % to 0.025 %.

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 08, 2020, 07:01:28 pm
The plan has extra optional resistors in parallel to the array - these are alternative footprints for my board, e.g. for THT types like PTF56 or for a first test and to check other resistor values. It won't make sense to have them together with the array.

When using a LM399 reference, the NOMCA resistors are good enough. The variations in ADC gain are visible (e.g. 0,2 ppm popcorn like jumps), but less than the reference noise. So there is a limited advantage of using a LT5400 with a LM399 reference. One could still consider 2xNOMCA with 10 K, so 4x10K for each resistor. This would be for slightly lower noise and less self heating

On the other side, with a LTZ1000 reference, it would be bad to have the cheap resistors that add something like 2 times the reference noise. In this case using 1x10 K and 2x100K LT5400 would be more appropriate.  Even with only 1 x 100 K the additive noise would likely be not that bad and not much multiplicative noise from the resistors.
Even with the LT5400 one could still use a parallel resistor to produce the asymmetry, as the parallel resistor is larger something like 10-20 times. It is not perfect but could be acceptable with an external 5-10 ppm/K resistor. The extra center shift can be better if < 5-10 ppm/K matching is used there.

@ Rerouter: thanks for noting the missing (lost) supply at IC4.

There is no LT5400 with 20 K !  2 x 20 K in series is the preferred option for a single NOMCA network.

So with LT5400 one would have 2 x 10 K in series and thus 20 K total. This is on the low noise but likely higher INL side. It may also need a slightly larger integration cap.  For the test 20 K (2x10 K PTF56) worked, but there is a chance to get better INL with higher resistance. So it is an option if lowest noise is the target, but one has to expect a little more INL.
The ADTV6581 uses an even slightly higher current level (20 K with 15 V reference level), so it is not absolutely out of range.

For better INL 2x100 K in parallel is likely better, though slightly higher noise. In addition 1 x 100 K is also an option (slightly higher noise).
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on March 08, 2020, 07:13:22 pm
I think you have to distinguish between the 399 and LTZ versions of your ADC.
With v399 I would expect the 34401-like performance. Two LT5400 packages (say $15 each) would be ok for such a version (LT5400-10k for the Vref and LT5400-100k for the integrator).
With vLTZ Vref the costs will be v399+$200 anyhow, thus 2 LT5400 packages for the integrator resistors (100k||100k) will not add that much.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 08, 2020, 08:50:25 pm
Yes one has to think about 2 versions:
 
1) A lower cost version with LM399 reference. This could use 2 x NOMCA (10 K + 20 K).  The noise level for the reference is like the 34401 (maybe a little more), but the ADC noise (e.g. relevant for small fractions of the full scale and fast (e.g 1 PLC) readings) can be much lower, more like the 34465. It would be more like 3 x NOMCA 10 K and 2xLM399 to get a slightly better version. The resistors at the ADC are a little more important than the ones to scale the reference. Using LT5400 is possible but not really needed. Besides the higher price the LT5400 are also more difficult to solder, especially if not using solder paste and hot air. The other reason for the LT5400 would be the better TC matching to reduce the thermal INL.

2) A Version with LTZ1000. This would essentially need LT5400. With the cost of the reference using 3 x LT5400 would not be a big factor. There is no need for the higher grade, the simple grade (more like $10 each) is sufficient, as the On resistance matching in the LV4053 would not be much better than 1%.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 08, 2020, 11:10:42 pm
For the 2x lm399 method. Are they directly wired in parellel or is that anything else being used to sum them.

Have the reference and most of the adc laid out to the new schematic. Just working out how to make the input buffer nice.

i can make it so there are 3 series sets for the input if 30K really is the sweet spot. Should not effect things too much.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 09, 2020, 07:33:20 am
For 2 x LM399 one would use 2 separate resistors to the filtering and separate resistors to provide the current. The heaters would be directly in parallel.

For the integrator resistance I don't know exactly where the sweep spot is. More resistance adds a little to the noise (like twice the resistance at the input)  and too low can increase the INL. I have tested 20 K to 105 K so far with no big problem. The last INL data are with 20 K.  With 10 K resistors it did not work so well (too much drift), but this could be from the resistors used (power type wire wound). Maybe I have to repeat the test with different resistors, to see if there is significant more INL.

30 K would not be that much different from 20 K anyway.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 09, 2020, 10:26:50 am
Would you be able to describe what function IC20/U20 would accomplish, seems like your adding currents to the slope amplifier, but not clear what it does.

Edit: also the current mirror with T5 / T6 and why it connects to the integrator output?
Title: Re: DIY high resolution multi-slope converter
Post by: chickenHeadKnob on March 09, 2020, 01:58:55 pm
For 2 x LM399 one would use 2 separate resistors to the filtering and separate resistors to provide the current. The heaters would be directly in parallel.

For the integrator resistance I don't know exactly where the sweep spot is. More resistance adds a little to the noise (like twice the resistance at the input)  and too low can increase the INL. I have tested 20 K to 105 K so far with no big problem. The last INL data are with 20 K.  With 10 K resistors it did not work so well (too much drift), but this could be from the resistors used (power type wire wound). Maybe I have to repeat the test with different resistors, to see if there is significant more INL.

30 K would not be that much different from 20 K anyway.
What physical mechanism(s) would you attribute to causing INL ? Is it simply self heating of the resistor or other factors?
Thank you for all of your efforts.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 09, 2020, 05:31:38 pm
There are several mechanisms that can contribute to the INL, some of them are likely negligible. The main INL sources I know are:

1) heating of the resistor at the integrator input. This gives a contribution proportional to the resistor TC (or TC match if tight coupled) and U³. With resistor arrays there can be also a U² part, but the AZ mode will suppress most of this.

2) DA in the capacitor hides part of the charge and gives it back in the next conversion.  The slow part of the DA follows the average integrator voltage.

3) Switching the reference before the integrator input is fully settled gives a small error due to the input voltage of the integrator. Luckily with the simple 1 test per period mode for the run-up, the number of short reference pulses is proportional to the input voltage. So the error would be a linear step function, so that only the error from single steps would be real INL. The rest would be just a slight change in gain.

4) Having two short phases close together could have some additional effect, e.g. with the 4053 supply not settled or a tiny rest at the integrator. This case happens more often near zero and less frequent at the extremes. This effect is expected to give some u² or similar dependence, if visible at all. Longer time for the short phase should reduce this effect.

5) The settling of the integrator can depend on the current the OP drives. The OPs GBW or phase reserve seems to depend on the output current.  As the settling part can contribute to a small offset to the integrator input, this effect can contribute to INL. The effect on the settling is visible on the scope and the extra current mirror can to a large part suppress it - however with no visible effect on the INL. So this mechanism still seemed to be rather linear. A similar effect comes in combination with short pulses, as the effect of a short pulse may depend on the current.

6) leakage on the board, at the resistor array or 4053 can couple the input voltage a little to one of the references. This would give a U² contribution, as the time that reference is used depends linear on the input.

7) there can be some coupling from the input buffer / input to the integrator to the reference circuit. This can be thermal or through the ground or maybe the supply.

8 ) The buffer may still be not perfect, even with using a bootstrapped supply. Load the output was one such effect, that was visible before adding a bias.

9) some couplings, e.g. from the comparator / slope amplifier to the clock. This was a problem before using the canned oscillator.
  Together with the extra sync FF this effect should be minimal.

10) if only a 1 OP integrator is used, the residual voltage at the input in combination with mismatch of the resistors can cause an error.
   The 2nd OP in the integrator should suppress this part to a large part. With the resistor arrays the mismatch is relatively small and a 1 OP integrator may be possible.

11) thermal coupling in the 4053. Due to the low resistance the power is small, but there still is some heat.

12) During the transients there can be a small current at the OP inputs at the integrator. Though JFET OPs the ones used have protection diodes that can start conducting over some100 mV. This is better than with BJT based OP that can start to have more current beyond some 40 mV, when the input stage starts to become nonlinear.

13) The fast part of the DA depends on the very end of the run-up and the charge measured. This can give an more local INL error especially at the steps when the run-up part changes. The fast DA is also visible as some drift of the residual charge, but the effect is usually small with a good cap and some waiting time in the run-down. 

Then there are also those effects I still missed and a few more I know, but with very small effect.
Quite a few of the possible INL source are switching related, so that very fast modulation to reduce the DA error is not only positive.

The idea of IC20 (DG419 at the slope amplifier) is to modify the feedback during run-up. During run-up extra signal from the average integrator output is added. This would reduce the average integrator voltage and this way the slow part of the DA, one of the know larger INL sources. This way lower modulation frequencies are possible, with less switching related errors.  As an additional side effect there is less loading of the integrator during run-up and the small resistor for low noise is only chosen for the run-down phase, when it is needed. I have not tested this, so just an idea that has a good chance to work. If not, one can still keep the DG419 not populated and change the one resistor at the slope amplifier input.

The current mirror to the integrator output is to keep the output current of the integrator about constant, as it was observed that the current has a visible effect on the OP speed/settling. The current is not constant all the time - there are still the jumps up and down by the reference, but the two level for going up or going down would stay about the same. The additional offset shifts the current to the one side that works better for the OPA172.  The improvement of the settling is visible on the scope (see the scope traces a few posts back) - but not much INL effect, even with 20 K at the integrator.  :-// . So the current mirror is optional for a possibly small effect, not yet detectable. Especially with higher resistors at the integrator one could likely skip the current mirror.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 09, 2020, 08:45:11 pm
For me it looks like the main points are
- prevent phase reversal in the op amps. Not hard just some math.
- reduce leakage paths to critical nets. Already partially done with the guard traces where applicable
- reducing the slope amplifier / analog comparitors radiated EMI. Done for the slope amp. Will look into for the comparitor.
- protect the clock from external noise sources
- run some thermal FEM solvers to try and keep heating uniform around critical parts of the board. Currently poking the kicad community about this and there are starting to be better guides
- keep the option for the input array heater to reduce the change in temp as much as possible.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 09, 2020, 09:14:47 pm
Most of the OPs used don't have a problem with phase reversal. The input common mode range is still a thing to watch for because of the differenc supplies.

For the clock, using a canned oscillator and the 2 flip-flops to synchronize the 2 critical signal the timing is critical only for this rather small part.

EMI is one of the more tricky parts. There are fast switching events and a mixed digital / analog circuit. EMI not only effects the analog world, but also the digital side. Without the FF for sync the ADC in the µC did have some effect on the timing of the outputs - only very small and visible with a poorly chosen modulation frequency. So EMI is not only digital effecting analog, but can be other way around. I don't think radiated EMI is a main problem, the first point is coupling via the supply and ground. For this reason there are resistors in the supply at quite a few point - both possible sources of trouble and sensitive parts. So interference would go through 2 such filters.
There is still an odd, likely EMI related effect: the output state of otherwise unused IO ports at the µC effects the result: even with the input MUX (DG408) removed from the socket the MUX setting from the µC has some effect (~ 1 µV) - more than I would expect from capacitive coupling.


Thermal coupling should not be so critical that it needs FEM. A static thermal gradient would not be a problem. If at all it is about heat sources that change with the input signal.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 09, 2020, 09:47:08 pm
EMI is not as evil or hard. Just takes a lot of thinking. Its partly why my earlier boards had such a weird ground layout. I was going through what ground current each device put out. And tried to shift anything that I could off from the 'signal ground" that changed too much or was a significant current. What your seeing with the micro is likely a combination of the ground voltage changing with supply loads combined with the micro control signals being very fast (also why i have the resistors on all outputs in my diagram

I will keep walking through them for now. After all no one said it would be easy :)

Sorry not phase reversal. Meant crossover distortion to avoid the non linear transisition between sinking and sourcing current.

Edit: the FEM solver also gives me ways to analyse how currents effect voltages on other nodes. Trying to get the PSRR in our favour
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 10, 2020, 07:43:26 am
The odd effect of the IO pins controlling the MUX is not effected by series resistors at the pins and there is no current flow as the pins are open or going to the CMOS inputs of the MUX. I think it is more like adding capacitance to the ground side or VCC side. That would be the main difference. The other point is the change in level that may cause capacitive effects, but it does not change with an added cable. So still confusing. Even if odd the effect is like an offset to each MUX channel and thus possible to correct.

Cross over distortion at the OPs output is in deed a possible factor, that I learned here can be important.  One could add more bias (lower value for R76) to the current mirror to avoid the cross over also for the integrator. Currently the normal case is to have the current to change sign.

I know the problem with ground currents. This is the reason for the +-15 V supply isle for the integrator an slope amplifier with C6 going directly to the signal ground. This is to compensate the changing reference currents from the 4053. R31/R32 in the supplies are large with 150 Ohms to avoid the AC current to go a different way. The alternative (no more C6) ground buffer is also intentionally from that supply isle. Except from C6 and the 4053 the other things connected to the signal ground are more like low current or constant current like the reference.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 10, 2020, 08:07:27 am
Would you be able to upload your schematic in eagle xml format? would like match up the references a bit better between our 2.
Title: Re: DIY high resolution multi-slope converter
Post by: nnills on March 10, 2020, 09:20:10 am
I am new to this project and would like to understand how it works. I was not able to find: the kicad files, the software and a theory op operation. I suspect the letter one does not exist but where could I find the other two?(on github?)
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 10, 2020, 10:17:38 am
Modified rev-2 is the current kicad files I am working with, had to pull things back apart while I updated the chunks to the current schematic

Theory of operation is a multislope converter, with the input left connected you switch between the 2 references in a pattern depending on what the output of the comparator measuring the output of the integrator was (There is a psudo-log amplifier between these 2 to amplify the difference) with the goal to keep it as close to 0V as possible, you take note of how many counts it was high, and how many it was low, and by knowing the reference voltages can find the slope that matches only that voltage. and use an ADC to capture the residue left afterwards to gain some extra resolution out of the result. (or so I think, going from memory)

Software Klein has released before, as atmega assembly from memory again.

There is a thread where a lot of this was discussed over in projects and technical, but can't find it right now.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 10, 2020, 10:38:30 am
The theory of the operation is explained in the first few posts. There is also a version of the software, though an older one. So I add the current version of the µC SW as an attachment. The actual software has not changed that much, but some of the registers / constants got renamed - hopefully it is now a little easier to understand.  The circuit is there as an eagle file (zipped) and .png a few posts back.

For the theory of operation, the idea is to have a relatively simple multi-slope ADC with the µC to do the control. In short the HW is similar to the HP34401, while the control is more like the classical multi-slope with a run-down with a single slow slope. Most of the resolution is from the classical form and the µC internal ADC is used to replace the integrator reset and to add a little extra resolution. So instead of the reset the integrator charge is measured with the µC internal at the start and end.

The general idea with the multi-slope ADC is to integrate the input signal and apply feedback from the reference current during run-up. This phase takes up most of the time - in my case usually 20 ms. The keep the number of switching events constant there is a fixed frequency for the modulation and a fixed sequence the references are switched - only the time of few transitions changes. The feedback is the very simple form: a short (e.g. 1 µs) fixed positive and negative phase and than one longer (e.g. 8 µs) phase that depends on a single comparator reading. This gives some 2000 net positive of negative steps of 8 µs for the run-up part. The rundown part than disconnects the input and uses a variable length for a positive and negative reference to get close to zero.  The software has a timing resolution of clock 4 cycles and thus some 250 ns/333 ns depending on the clock( 16 or 12 MHz). To get the accurate timing the SW in written in assembler.

The way the slow slope is realized is a little unusual: the positive reference is a little stronger than the negative one and the two sources together give the slow slope of something like 1/20 the single slopes. The slow slope phase reduces the residual charge even further. The µC internal ADC than reads the small rest. Overall the run-down takes some 150-200µs, including some waiting time.
The contributions from the run-up and the fast run-down are linked by the known lenght of the run-up steps. So there are 3 contributions to the final result: one from the difference of the reference currents, one from the sum (= the slow slope) and the µC internal ADC. The relative size of the 3 parts is measured before in a separate calibration run. The ratio is stable enough that this only needs to be done once a day, week or so. The use of measured ratios avoids the need for accurate resistor ratios. The extra multiplications for the result are no longer a big deal for a µC. Currently the ADC part sends out raw results via the UART and the combination of the 3 parts is done at the PC.  The normal mode of operation is to alternate between the actual input signal and a zero level. So a full reading takes some 40.4 ms.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 10, 2020, 10:40:57 am
The eagle file was the binary format as best I can tell. The xml one i can import into kicad.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on March 10, 2020, 11:23:20 am
I am new to this project and would like to understand how it works. I was not able to find: the kicad files, the software and a theory op operation. I suspect the letter one does not exist but where could I find the other two?(on github?)

https://www.eevblog.com/forum/projects/multislope-design/msg1376978/#msg1376978 (https://www.eevblog.com/forum/projects/multislope-design/msg1376978/#msg1376978)
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 10, 2020, 12:34:46 pm
I am new to this project and would like to understand how it works. I was not able to find: the kicad files, the software and a theory op operation. I suspect the letter one does not exist but where could I find the other two?(on github?)

https://www.eevblog.com/forum/projects/multislope-design/msg1376978/#msg1376978 (https://www.eevblog.com/forum/projects/multislope-design/msg1376978/#msg1376978)

That other older thread was from another user starting to design a MS ADC. It was kind the starting point for the ADC shown here, but it also contains a lot about other versions and older ideas, especially at the beginning. Near the end much is about the ADC used in this thread.

The eagle file is the binary version - the only one available with the old eagle version (5.12) I have.
Title: Re: DIY high resolution multi-slope converter
Post by: branadic on March 11, 2020, 10:51:34 am
About the choice of opamps in such a design, there is an interesting read about opamps usable for ppm range today:

https://www.analog-praxis.de/lassen-sich-mit-operationsverstaerkern-wirklich-genauigkeiten-im-ppm-bereich-erzielen-a-912607/ (https://www.analog-praxis.de/lassen-sich-mit-operationsverstaerkern-wirklich-genauigkeiten-im-ppm-bereich-erzielen-a-912607/)

-branadic-
Title: Re: DIY high resolution multi-slope converter
Post by: MegaVolt on March 11, 2020, 11:17:03 am
Full text:
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on March 12, 2020, 05:11:19 am
The eagle file was the binary format as best I can tell. The xml one i can import into kicad.

Maybe the only thing I can contribute  ;)
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 12, 2020, 10:20:26 am
Thank you very much for that,

R48 is a floating connection
IC13's (pin 7) output is floating
on your schematic klein.

Going through and matching up references that where too hard to tell before.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 12, 2020, 11:27:23 am
Thank you very much for that,

R48 is a floating connection
IC13's (pin 7) output is floating
on your schematic klein.

Those two points were misplaced dots from moved parts. In my program versions they are still connected.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 14, 2020, 03:29:36 am
Have the reference part updated, Guessing the Jfet is just acting as a current limit on the heater to make things more predictable at the cost of a longer time to steady state?

Also curious why you changed the zener current down to 0.7mA, the curves from the datasheets tend to have 0.9-1.4mA as the region with the least temperature variation?

Have the ADC almost how I like it, the input buffer is going to take some time to unwrap in a nice way.

Yes the guard traces are overkill, but for now trying to work out where some of the INL error sources could be. and having them makes the math easier.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 14, 2020, 09:04:34 am
The JFET at the reference heater is there to limit the current on start up. It may be enough to have a resistor there. Without a current limit I had a problem with start up with a relatively low power DCDC converter. It also helped to adjust the brown-out detector at the µC.
I have not really checked the reference current very much. AFAIK 0.7 mA should be just OK, at least in most cases, but 1 mA is the more normal current. The extra power is part of the heating anyway, so not much need to keep the current at the low edge.

I rechecked the operation with 10 K resistors at the integrator, this time with more stable PTF56 resistors.  For the turn over error the resistor TC is not a significant contribution, but stable resistors help to do the test.  In a quick check without much warm up, the turn over error was relatively large ( some 25 µV at 9.3 V and ~5 µV at 5 V). So it looks like INL gets worse with smaller resistors and 10 K seem to be well on the low side.
So I am afraid using 20 K as 2x LT5400-10K in series is not a good solution. 2x100 K in parallel would be the preferred solution, despite of the slightly more complicated layout.

Some overkill with respect to INL is understandable. It is hard to measure and every source avoided helps, even if likely small.
The current mirror is a little in this direction.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 14, 2020, 11:12:14 am
Already have parallel covered, there is the same footprint on the back of the pcb, as well as the 0805 option... First revision option that I left in, if you want parallel on the same side It will take some thinking.

For the integrator output, that current source is my main bit of grief at the moment, It appears to only cater to an integrator voltage up to 550mV positive (so only effecting negative input signals),

Not clear how fast your modulation is now, but I recall it being about 1uS per pattern step with a 12 step pattern, for 50K input and 2nF cap we would need to cater to about 2.7V to work for your full input range.lets say +-3V to cover for any weird points.

Simplest to fix it at present would be to swap out R30 with 68K, would ensure it remains constant, downside is it is a lot of current to sink, about 1.14mA, and around 15mW of heat extra, as well as heat loads that change with input voltage.

Harder fix is probably going to be making a constant current source / sink track a bit nicer, as right now it just shoots off towards 1.4mA with a +10V input when in reality it should be almost turned off. the only time the additional current is needed is for negative input voltages as best I can tell, and for a +-10V range about 2.45V is needed for integrator voltage

If your modulation has changed I will update the math accordingly, but right now that current source is not working for negative voltages over about -4V
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 14, 2020, 12:59:14 pm
For the modulation in the run-up phase I have several versions to choose from the short times are from some 0.66 to 1.5 µs, normally 1 µs and the signal dependent part is 6.5 µs  in the normal version and up to 15 µs in the slow one.
For the larger current with small integrator resistor (10K) I have doubled the integration capacitor.

The current mirror part has some gain, so getting a higher current out than in. So the current out from T6  is about 4.5 times the current going into T5. So R30+R19 should be about 4.5 times the resistance at the integrator. So R30 should be adjusted with the resistors at the integrator.  The current trough R76 gives an addition bias - ideally to avoid the output cross over region of the integrator all together. A smaller value (e.g. 100-150 K) for R76 may be a good idea.
For the analysis it is important that the current mirror input voltage is at the positive supply.
With a high positive input the current mirror will give less current.

I get some 0.6 mA with zero input and 0.4 mA / 0.8 mA with a +10 V / -10 V input.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 14, 2020, 01:05:40 pm
I was modelling the whole chunk, so the current through the integrating capacitor + current in or out of the slope amp, this is where it swaps. pretty much what direction is current flowing at the output of the op amp U2

At the cost of some extra heat, swapping R30 for 68K would be something easy to test, assuming one of your current test boards has it fitted.
Title: Re: DIY high resolution multi-slope converter
Post by: Andreas on March 14, 2020, 01:09:11 pm
The JFET at the reference heater is there to limit the current on start up. It may be enough to have a resistor there.

are you really using a SST5485 ?
with only 4-10 mA constant current you may get a instable heater which needs up to 300 mW in steady state.
So you might want a current source which only limits above 20-30 mA.

According to (old NS) data sheet you will need a small electrolytic (> 2uF) in parallel to the heater when using a series resistor (or FET) for heater stability.

My observation is that the LM399 also has a measurable PSRR on the heater voltage.
Especially with heater voltages below 12V.
So I want a stable heater voltage.

with best regards

Andreas

Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 14, 2020, 01:41:54 pm
I currently don't have the JFET at the heater. The 1st board has a direct link, the 2 nd board a small resistor. The SST5485 was more like one of the very few JFETs in SOT23 case I have in the old eagle libraries. The more obvious choice is a MMBF4392 or MMBFJ111.

Thank you for mentioning the capacitor at the heater. This makes sense.

@Rerouter:
The current to the slope amplifier could indeed be a problem. With the DG419 part used the resistor R12 should become larger (e.g. more like 22 K, maybe more), so that less current will flow there. During run-up the DG419 is turned off - it would be on only during run-down.

R30 should be adjusted to directly compensate the current from the input. R76 gives an extra constant part - this has no obvious ideal value and would be a point to tweak.  The current to the slope amplifier changes with integrator output voltage and can thus not be compensated by the current mirror. A larger values for R12 can help here. However without the DG419 switch this would add to the noise for the run-down. The 5 K already give more noise than the OPA1641 or NE5534. So the 5 K value is kind of a compromise.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on March 14, 2020, 02:48:41 pm
With 30-50mA current limit it may take up to 2minutes until the 399 "starts" itself..
PS: I started my 399 from cold, my "foldback" current limit is around 40mA, it took 101 seconds (with 15V at the heater)..
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 14, 2020, 03:32:51 pm
The heater gets +-15V minus the drop on the JFET, so a total of near 30 V. This would be some 10 mA steady state.
It depends on the supply whether the extra limit is needed. I currently get away without with a 3.2 VA 2x18V transformer as well as a DCDC converter limited to some 50 mA. It currently takes some 15 seconds until the supply is reasonably stable. The version with a sereis resistor takes a little longer.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 14, 2020, 11:23:21 pm
Suggest moving the current source to a fixed 1.1mA one as the thermal variation is about the same and removes another unknown from the mix. including not having to route the buffer output across half the PCB. Also want to shift it on to the analog supply rails as it shares a current loop with these devices. from some simulation sweeps this covers as best I can tell all input voltages between +-10V,

This is based on 50K input resistance, 2/2.2nF capacitor and a pattern length of up to 12uS, longer patterns and lower input resistances will need to be wound up a little more to keep that +-10V input, smaller inputs can still be quite longer.

For the average integration voltage op amp I feel needs to be tweaked to work how you described. right now any positive average integrator voltage will just be stuck at 5V to the ADC, removing R67 will have it reflect an average of +-5V on the integrator to the ADC, I can keep that as a footprint for scaling options, just right now I feel it should be non-populated by default.

Edit: now that the slope amplifier is using Q2 for a non-linear element, I presume there is some reason why D2/D10 did not get the same treatment?

Edit2: Had to tweak the current up to 1.33mA, to really cover every possible case up to 12uS patterns, so a 180K resistor
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 15, 2020, 10:11:06 am
Using Q2 instead of the 1N4148 is because I saw some temperature dependence of the gain, even at around zero. The transistor instead of the diode helped by having less leakage and hopefully still enough speed. At least it now seems to work better.  For D2/D10 this is not needed, as there is the extra resistor in between, so that leakage current is not as critical.

The point with R67 is very valid. I had the extra gain as an option but so far not populated.

I know it is a kind of pain to route the buffer output (or current mirror input node) all across the circuit. However the main idea was to compensate for the changing current level with a change in input voltage. So I would at least keep this as am option, just in case. Worst case one can always add a resistor and bodge wire.
Having just a constant current source that is strong enough to avoid cross over may also work - kind of a different way to fight a possible weakness. As there is the current through R12 this may even be the better way. For a constant current source it does not really matter where it gets its supply from.
 
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 15, 2020, 12:58:45 pm
ADC and buffer are mostly fitted together, not entirely happy about the buffer and will space it out more so the reference designation can be better placed soon.
Thermals also included, so the input resistor should avoid a lot of the variation, If something does not have a value, it means it has less than 0.08mW of heat output on average while operating.

Will include the option for a jumper wire for the current source, on board trace would be difficult due to how noisy the area it would be passing is.

While I will likely keep the double input array, right now both resistors would be sitting at the RN202 spot. one on the front, one on the back, for 50K equivilent.

Current source thermal values will be a little different from the schematic, as I have been tweaking a little based on simulations and datasheet values, but the transistor heat output is within a factor of 2 of the latest schematic.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 16, 2020, 12:42:08 pm
Moving through it all, getting back to roughly where I was on Rev1, just lacking some polish,

Things can still shift about but its leaving even more room than rev1 free for the micro / power supply / possible multi meter input respin.

The micro and similar I will be aiming to crowd up closer to the lower left, and may try to shuffle the power supplies a bit further away from the references as well. to keep as much free board area as possible around the reference and input area as this is what I suspect will be the most likely to change.

Any thoughts and I can add / change it.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 16, 2020, 01:36:03 pm
The electrolytic cap between the integrator and input buffer it quite large. I think the Food-print can be a little smaller.
The same is true for halve the caps at the supply. The ones at the output side can be smaller and they may be better placed closer to the demand side. The capacitors on the input side may need the size, especially if powered from a 50 Hz transformer.

For the integration cap there is no more real need for a THT footprint. The capacitor of choice is definitely TDK C0G in SMD (e.g. 0805 size), possibly 2 in parallel to get high capacitance if 20 K are used at the integrator or for other low loss caps that may only be available to some 1 nF. 

For additional points to add,  I would consider a connector for an external reference, e.g.  like the HP3458-A9: two rows with 5 pins.
With the slightly higher voltage of an LTZ1000 one may need JFETs instead of zener + BJT at the reference amplification so one can get closer to the +-15 V limit.

A true input stage would be quite a bit of circuit - probably a little too much for the board.  A minimal one would still need an AZ OP, some gain switching (e.g. 2/4 or 3/4 of DG201B), some switching at the input (e.g. DG408, DG201B) and input filtering and protection (incl. some guard / BS drive). The control would likely need some shift register (e.g. the usual 4094) connected to the SPI port.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on March 16, 2020, 05:19:48 pm
I would add 1-1.5mm slots - like at the places indicated with the red below..
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 16, 2020, 06:53:01 pm
There is not that much space left to really add a lot.

I would like a little more space between the input buffer and the resistor arrays.

With the buffer U16 one could/should have some extra filtering (Pi type) and protection (Zeners+2 diodes with bootstrapping). This would make it more like a real DVM input, though still without gain.
Without gain one could also add a simple slow inverter so one could have a +-20 V range. The inverter output would be the other side terminal, and should also get an input of the MUX. With a gain of 1 only, there is no need to turn the inverter part off, as one does not need a gain check all the way to the input. The zero check /cal would need user help to short the input.  So one would have the choice to use 4 channels +-10 V (one with protection) or 1 channel with +-20V.
 
I see very limited need for the guard traces around U4 / U20. The NE5534 is not high impedance anyway.
Title: Re: DIY high resolution multi-slope converter
Post by: jbb on March 16, 2020, 11:00:19 pm
I had a look at the schematics for our Agilent DAQ DMM card ... and there’s a lot of stuff in there!

I suspect that trying to fit a ‘proper’ DMM input on the same board will open up a heap of issues, so it might  be better to design that separately.

That being said, an input protection network would be useful for system integration.

The 20V range trick is interesting, but seems to require some floating ground tricks, which could complicate system integration (eg might end up with floating supplies and AC CMRR issues when ADC ground isn’t the same as front terminal ground).
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 16, 2020, 11:25:10 pm
Are you willing to share those schematics?

The 100x100 was just a cheap board size. In reality it could be anything. I agree on a seperate sub board might be a valid answer.
Title: Re: DIY high resolution multi-slope converter
Post by: jbb on March 16, 2020, 11:48:41 pm
It’s the Agilent / Keysight 34972A DAQ. You can download the service manual from the Keysight website, and the schematics are near the back.

Of note:
- lots of custom resistor arrays for things like V scaling, reference gain, ADC core
- some relays for mode switching (eg high V / low V / R / I)
- selected LM399AH reference

Edit:
- current input is protected by 4 diode bridge. An op amp is used to bootstrap the ‘live’ diodes (presumably reduces leakage)
- 0.1A current shunt for 1A range, schematic doesn’t indicate 4 wire
- extra 5R shunt stacked on for lower ranges
- resistance range current supplies by a 2 range low side current sink connected to a 4 range current mirror (to make a current source). Quite elaborate here.
Title: Re: DIY high resolution multi-slope converter
Post by: MegaVolt on March 17, 2020, 07:58:29 am
It’s the Agilent / Keysight 34972A DAQ. You can download the service manual from the Keysight website, and the schematics are near the back.
I could not find the circuit :( Tell me where can I see the circuit?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 17, 2020, 08:18:13 am
I know the commercial ADCs usually use custom resistor arrays, but these are not available so easy. So this ADC is made to work with standard resistor arrays (e.g. 4 equal values) for most of the part. This is not that difficult. Going from 7 V to +-14 V range is not that inconvenient. It even has some advantage over the +-10 or +-12 V references used in the 34401 or 3458.

A full DMM input would be really more like a separate board, about the size of the ADC board, or even more with amps and ohms ranges. There can be enough issues with the input part and ADC - so separate boards make changes easier. I would even consider to have a voltage input stage only for the start and have amps and Ohms as a 3 rd part.

Attached is the idea for a little protection  filtering for the U16 (from the ADC schematics) input.
The exact resistor / cap values are not critical, more like order of magnitude. The 2 lines to the right would go to the MUX.

Something like CMRR or mains hum may be an issue - this is a reason to include the simple inverter part to test it. There can also be a positive side, like reduced turn over error or the possibility to get an auto zero mode for 50 SPS. So if it works it can be attractive.
There are issues to combine the driven common terminal with multiple inputs. It also makes the current modes a little more complicated, but not too bad if relays are used for range switching.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 17, 2020, 08:21:26 am
Shifted about as requested, not yet looked into slots around the reference,
Now both the resistor array and input mux are far enough away from variable heat sources that the thermal difference is too small for me to worry about further, but I am open to mixing things up.
Capacitors where mis-sized for a higher voltage, picked the most common footprint for 100uF >35V and ran with that for the lot of them, half of them should be 47uF which could get away with smaller, but I don't really see a need for it.

the +-15V caps being nearer to point of load is already mostly done, the biggest load is the reference, then the input buffer, everything else of significance is on the analog +-15V rail, where the largest loads are the second integrator op amp and the slope amp.
The main power traces right now are on the back of the PCB in 0.8mm thick traces, at the current levels involved the varience over the largest load difference should account to about 300uV of DC shift on the supply rails, everything is locally decoupled,
Its the AC influences I cannot fully control for,

For the external reference, you say 2 rows of 5 pins, I assume something like below?
Or skip the sense thought and instead its just for contact reliability

+15V  +15V
-15V   -15V
GND    GND
-Ref     -Ref_sense
+Ref   +Ref_sense

If there is a popular reference module e.g. the KX LTZ1000, and someone can give me its pinout and connector dimensions I could just space it out to make it plug and play.

the slope input trace is very overkill, but having it there makes the math easier, so unless it hurts something, I will leave it be, as the ground would be there either way to soak up some of the noise from where it passes through. There is a fair bit of energy every time the slope output moves, and that would couple in too easily otherwise.

U16 confuses me a little, where R10 and R7 are meant to connect, and assuming that only U16's reference is the same as the main PCB
Edit: Ok, just an inverter, so to 2 different inputs, What is pad 2 for?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 17, 2020, 09:12:31 am
AFAIK there is no common interface for the DIY LTZ1000 boards.  The closest to a kind of standard in the this case would be the reference board in the HP3458.
Pins an A9 board
J401 1) Heater (base of transistor) - likely used for burn in only
J401 2) +18 V  (OP + startup resistor)  (15 V should be sufficient )
J401 3) Heater GND
J401 4) -15   for compensation of the ground current via a resistor
J401 5) +10 V heater
J400 1) divider for set temperature  (should be left open) - likely used for burn in only
J400 2) Ref GND  (0V)
J400 3) Ref. 7 V
J400 4) GND A# , ground for the OPs
One pin of J400 is unused / blocked as key.
The connections are not ideal, but also not so bad.  Ideally I would like one more GND pin and I see not much need for the heater base connection.
Still the original HP A9 board uses an odd connector so the board sits very close to the carrier. 
Title: Re: DIY high resolution multi-slope converter
Post by: branadic on March 17, 2020, 07:19:29 pm
What I would like to see on a reference meter is an external input, for a well known 10.xxxxxxV reference.

-branadic-
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 17, 2020, 08:00:17 pm
An external could be nice, but it's also not easy.
I would guess the more normal use of an external reference would be to drive some divider network from the reference and than sense a voltage as a differential input. So both voltage are liked but generally don't share a common ground. So either the reference input or the voltage input would need to be differential.
Also reference scaling from 10 V (likely x 1.5)  is more complicated than scaling form 7 V (x 2).

For some tests it could help if one would have a extra output from the ADC reference - this may be easier to realize than a true ratio mode. It still gets tricky with extra drive and sense lines and especially if the +- mode for 20 V input is used.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 17, 2020, 11:40:17 pm
+20V -19.2V could be done. Would need an extra supply for the 2 pass transistors in the reference, higher voltage zeners. And adjustment of the current source on the intefrator output. as everything else is still inside operating range. At minimum its not hard to tweak for the option. Just ugly fitting an extra supply on there that is unlikely to be used for most with a supply load of around 45mW
Title: Re: DIY high resolution multi-slope converter
Post by: branadic on March 18, 2020, 09:14:45 am
By the way... it could be worth using an isolated ultralow noise power supply such as a dc-dc converter based on LT1533, followed by low noise LDOs. I recommend the DC230A-C board with ±15V on the secondary side. Already have that demoboard on my desk and it works a treat by now. Still need to add the LDOs.

-branadic-
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 18, 2020, 09:57:20 am
Isolating the +-15V rails do not buy much currently as the switch IC's need logic signals, and the ADC / Analog comparitor outputs make it uglier to float. you can by treating things as differential, but ugly...

But yes PSRR was something I was starting to consider earlier, the LM78XX tend to have less than 100uV of noise, so they are fairly quiet, but the DC shift of ~15mV via load and line are not so nice. in reality it should be smaller, but have to account for it.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 18, 2020, 12:12:30 pm
Been going through things more, R31/32 seems off, they drop about 2.3V each during normal operation, the supply variation is only a few mV, and it would certainly prevent any signals getting out, but seems excessive. (Supply current will vary between ~ 13-15mA during operation on the analog rails)

C6 and the whole virtual ground, can I ask what your trying to control for? just not yet able to see the exact purpose

For power supply options if you want to keep looking into it branadic, its 40mA max on +--15V while operating + initial heater current.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on March 18, 2020, 12:24:32 pm
I recommend the DC230A-C board with ±15V on the secondary side. Already have that demoboard on my desk and it works a treat by now. Still need to add the LDOs.
125$  :scared:
Similar PS: Silentswitcher from Linear Audio NL ~80Eur (https://linearaudio.nl/silentswitcher)
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 18, 2020, 12:33:26 pm
I feel he meant for a reference schematic and BOM, those evaluation boards are always overpriced.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 18, 2020, 01:53:10 pm
For a ration measurement there are 2 ways: the true ratio with an external reference to the ADC and to have the ADC to measure the two external voltages in a fast sequence. The second method is definitely easier to implement, especially if an OP like LTC2057 is considered acceptable (input bias in the 100 pA range) as input buffer. With the filtering at the reference one has very little noise in the 10 Hz range. If needed slightly more filtering should be possible - enough to bridge the time for 4 short conversions.

A true external reference would need a differential input, either for the reference or the input. A differential input for the signal should be easier to implement, as the ADC is naturally kind of pseudo differential with 2 conversions and taking the difference. With gain things get a little more complicated, but differential gain would be still possible. For the reference the current combined x 2 and -1.9 scaling could still work, but with a reference voltage much different the the comparator limit may also have to change or more reserve left at the µC intgenal ADC. In this case I would prefer a slightly different, more conventional setting: the first stage as x1.5 or x2  and maybe x 4/3 to chose from and than a separate fixed times -0.96 or so for the negative side.

I think the simpler way with 4 ADC conversions and maybe slightly more reference filtering would be sufficient.

I know that R31/R32 values are relatively high. The Idea behind this is to have the AC current from the reference modulation to flow through C6 and not much through R31/R32. Things are less critical if the ground buffer U1 is used - in this case lower resistors are more suitable.  I don't see 13-15 mA for the supply island. Its mainly an OPA172 (~2 mA) and NE5534 (~ 5 mA but variable) and maybe some 1 mA through R12 between the 2 OPs. So more like 1 V drop at each side.

For the supply, I have tied a simple DC/DC converter (push pull drivers with dead time and generous snubber) with no obvious extra noise. I don't think the actual driving circuit would be the critical part. The tricky part can be more like the transformer itself to get a low common mode signal / capacitive coupling. AFAIK this would get better with a relatively large core and some space between the core and windings.
Title: Re: DIY high resolution multi-slope converter
Post by: jbb on March 18, 2020, 10:16:49 pm
Yes, an isolated supply would require some care. I guess the following would be relevant:

Edit: as you can see, that’s quite a few things to consider. PPM level equipment is hard.
Title: Re: DIY high resolution multi-slope converter
Post by: SilverSolder on March 19, 2020, 12:27:40 am
Yes, an isolated supply would require some care. I guess the following would be relevant:
  • Reduce capacitive coupling by using a large toroid core and a snap on plastic cover to make an air gap between primary and secondary
  • Consider electrostatic shielding between primary and secondary windings (some designs have been spotted using coax cable for this)
  • Reduce dV/dt with slew rate limited transformer driver and snubbers (on both primary and secondary) or maybe use a resonant converter
  • Reduce stray magnetic field by using toroid core and careful winding terminations (no partial turns!)
  • Reduce stray magnetic fields by careful layout of rectifiers and filter capacitors
  • Investigate system sensitivity to various frequency ranges (eg frequency mixing in multiplex schemes, autozero / chopper amplifiers and ADC sample rates. Synchronisation of DCDC converter and ADC clock may be required

Edit: as you can see, that’s quite a few things to consider. PPM level equipment is hard.

Worth going for battery power instead?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 19, 2020, 08:24:40 am
Battery power is still possible. However it takes some time for warm up. So if would be more like to have battery power as an option, but still also have the option for mains power. Even with battery power one would likely need some switched mode converter, as there are several supply rails (+-15 V and +5 V). A input stage may also want some -20 V or so if JFET switches are used.
A good isolated power supply needs some care, but is not impossible.

The current circuit is not optimized for low power, but the power is still not too high (e.g. should be a little under 1 W). There are a few point where one may reduce the power: change from the NE5534 to a lower power OP (e.g. OPA197), reduce the voltage for the µC to some 3.x V. This also allows a lower power oscillator. If needed the clock cold be reduced to some 8 MHz with not too much penalty. For the input buffer one could consider a single OPA189 instead of the 3 OP version. Instead of the OP07 there are also lower power versions, even with slightly lower noise (e.g. OPA207).
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 20, 2020, 10:40:49 am
Just to poke it along, Getting closer to what I am happy with, Reference ends up in a bit of a weird place, but its the best I have for now,

Will probably end up shifting the micro up a little, to fit the serial comms under it,

And the reference a little down and to the left, this will give me a bit more room for the input area, and fitting the latest ideas for an inverted amplifier for the input voltage,

Power traces added for now, it wraps around a fair bit, but the local decoupling, and overkill trace width should remove much concern for voltage drooping.

Edit: I should confirm if that is the desired clock source footprint? only been working with small SMD stuff in the past. so seems a bit big.
Title: Re: DIY high resolution multi-slope converter
Post by: Echo88 on March 20, 2020, 11:15:42 am
@jbb: Could you elaborate on the "careful winding terminations (no partial turns!)"-statement and maybe link those found coaxcable-transformer-designs? Im playing around with low noise DCDCs myself at the moment and always look for fresh papers on this topic.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on March 20, 2020, 12:00:51 pm
Coax-Transformer in K7510 @50mins:
https://youtu.be/uvgJ2zAxgAY (https://youtu.be/uvgJ2zAxgAY)
Title: Re: DIY high resolution multi-slope converter
Post by: Cyan on March 20, 2020, 01:25:04 pm
US-Patent US9478351 seems to be a good read on this topology.
Title: Re: DIY high resolution multi-slope converter
Post by: fcb on March 20, 2020, 01:52:46 pm
US-Patent US9478351 seems to be a good read on this topology.
Its a nice way of doing low-noise, low L/C txfmr.  A little surprised they got a patent, pretty sure i've seen similar txfmr concepts as gate drive transformers though.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 21, 2020, 12:20:59 pm
Another day, another few more steps into madness,

J4 is the 10 pin ICSP header, as 3 pins are shared in common, going to try and make a combined 10 pin + 6 pin footprint for both programmer styles, painful, but not a bad option

Bunch of components top left are from the window comparator, need to work it back in with the larger inverter stage.

Still working out where is best to have the UART, but its practically all laid out at this point

J400 / J401 still working out how best to add, as at present we don't exactly have a +10V rail for the heater, would this just be another +15V? also some level of measurements between the points would allow for plug and play

Open to any suggestions, even added in the reference slots, tell me what it is, and It will be added.

(Will try and add some slots to the top right of the reference once the input amp is a bit more together.)

Edit: Helps if I attach the correct image....
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 21, 2020, 01:54:17 pm
The power inputs could probably be placed a little more together, so one could use one connector for the power input.

Similar the output of the inverter for use as 20 V input could be closer to the corresponding input.

I have the 10 Pin ISP connector in a way with 2 extra signals (normally ground) so that the connector could also be used to control an external front end. The extra pins are used as CS for SPI and maybe  in a far future as clock for an chopper amplifier.

The guard traces around some digital signals look odd.  With the clock signal it is usually more about loop area than capacitive coupling or surface leakage.

The LTZ1000 reference (e.g. A9 board)  does not need exactly 10 V for the heater this could be also 15 V or maybe the 15 V with an external resistor / zener in series. The original A6 board used connector that go through the reference board, so that reference board would be very close the to board and would thus need quite some free space. So it could be tricky to really allow that board.  The connector can still be OK.  Also remember that the LTZ1000 voltage is a little high one could need a JFET instead of the NPN + zener to drive the positive reference.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 21, 2020, 02:40:56 pm
Added the other programming header, and fixed the power connections into a single plug, Free to be used how anyone prefers, for now means both styles of programmers will also be supported.

Fixing up the input amplifier will take a bit more time, as I was not sure what the inverted output was being used for.

Clock guard was mostly to keep it from injecting signal into anything else. I am still working on overkill,

The guard around U202's traces was for the same reason, due to time constraints any updates to him would probably be at a high speed, and as he is near the input array, wanted to soak up some of the noise.

Edit: the plan is currently to shift up the micro 3-4mm higher to fit the UART connector right next to the power connector, just a little painful to get it to fit nicely.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 21, 2020, 03:52:02 pm
Shifting the µC up and fit the UART isolation just below is probably the area to use - no ideal, but not so bad. For a first test there is no real need to have the distances for high voltage isolation. The opto couplers also don't look like made for high voltage, more like the normal to slightly lower isolation level, but that is OK.

The inverter output is meant to be used as the negative side terminal for a +-20 V range input together with U16. So these pins should ideally be no separates so much. The would likely be wires to the connectors - so it is not important, just nice to have.
Title: Re: DIY high resolution multi-slope converter
Post by: SilverSolder on March 21, 2020, 07:02:27 pm
Another day, another few more steps into madness [...]


This is beginning to look cool!   8)
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on March 21, 2020, 10:12:42 pm
What is the reason to stick with the quite bulky tht uC and osc - everything else is smd?
At a first look, the massive snake bus bottom right catches the eye. I did not dive in detail into the layout, but looks like it could be shortened.
The project seems to get close to the finish - keep going  :-+
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 21, 2020, 11:30:05 pm
Canned oscillator as clock jitter was effecting the accuracy, but can be swapped out, been building that area to make it fairly painless to alter to a well built crystal.

Micro can be SMD, have the footprint for the TQFP footprint off screen on the top left, but wanted to keep it as close to the original schematic as possible to start with. Also have an EEZ BBM3 template off to the left, but all things in good time.

Giant snake traces is to keep both heat away from the reference area, which does not nicely fit next to the crystal as it would leave it too near the power supply area. and keep digital from crossing the analog stuff, the input mux is switched between conversions so no noise on these traces should couple.

Needing to fit the input amplifier i the middle right part due to me using these constraints is another part for the snaking.

Playing with replacing the UART opto's with a digital isolator, ends up with roughly the same power dissipation, but should allow much faster transmission rates, so hopefully free up a few cycles for potentially setting the DAC or other stuff. at present I cannot keep it isolated and fit in where I was hoping, will keep playing to see if I can fit it, but for now surrendered and stuck it in my second choice.

Unless anyone can suggest much more, all that is left right now is that input amplifier. and the possible placement of J400/401, but for now there should be enough test pads in the area for someone to bodge in there higher end reference.

For the LTZ1000 reference, its output is ~7.1 compared to ~7.0, even doubled this is still within the control range of Q7, which should be good up until ~14.5V, is there any reason why we would need the Jfet in this case.?

Also as a secondary point, everything on the board so far can run at +-18V, so there is headroom if it is really needed.

For the option of an external 10V reference, thinking I will just break out test points for the supplies to Q7/Q3 in the reference, so if anyone wants to, they can drive them with a higher bodged on voltage otherwise just fitted with a jumper.

And double checking pays, LTC2057 is mainly available in an MSOP package, so that should make it easier to pack together the input amplifier.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 22, 2020, 03:55:03 am
Ok. looks like its done, any suggestions or additions?

Kicad files with gerbers attached,

Done with kicad nightly build kicad-r15194 if it does not open for what ever reason on current main versions.

Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 22, 2020, 07:31:37 am
Ok, slight edits coming, a BC850 is an NPN for instance, fixing up now,
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on March 22, 2020, 09:41:18 am
Very nice, do you plan to put the project on github/gitlab?
Is there a reason not to have groundplanes/groundfilling at least for some areas?
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 22, 2020, 10:39:11 am
Software is kleins, so would be up to him how he wants to host it,

PCB can be, never used it before, as never looked into the whole syncing local to site, and my adventures with bruteforcing on github in the past seemed the wrong method.

A ground plane / fill's role it to make sure there is a nice short return path for all signals, however similar can be accomplished with a ground trace bundled or better wrapped around those signal traces to keep loop areas small,

I could flood fill things, but I'm hesitant to as it both conducts heat better meaning the isolated little islands of heat end up effecting larger areas, and any noise on that plane can couple into traces and pads. you can see the reverse for the resistor arrays and reference where I do want that area at as close to the same temperature (relative to ambient) at all time.

Instead I focused on making those loops as small as possible to accomplish a similar task, sometimes its better to steer the current exactly where you want it, than risk multiple things mixing, and where possible followed the golden rule of power to the decoupling capacitor then to the device where possible.

Tweaking some other small things, practically a review stage, like making sure I can actually source all the parts, finding a good Jfet for the task, all the transistors had the pinout rotated, etc

Edit: LTC2057 is now back to a SOIC, way too pricey in MSOP, Jfet I am looking at is "MMBFJ31DLT1G" as based on datasheet needs more than 15mA to function correctly.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 22, 2020, 12:19:18 pm
With only 2 layers there is not much left for a ground plane. For the precision DC part I think it is better to have control of the ground and not use a ground plane. It may be OK for the digital part, but there is not that much true digital.  A also agree that more ground fill would not really make things better. 

For the JFETs (LM399 current limit and ref. drive) the MMBF4392 or MMBFJ111 should be OK. The transistors should be just standard small signal NPNs/PNPs, no special needs.
The DG419 should be the normal version, not the DG419L (lower supply limit).

For the OPs there may be a few options to choose from, but all with standard pin-out (no LT1013). It's a question of availability, price and preference for low power consumption. The main performance critical one is U11 where I currently have an OPA1641. The OPA140/141 would be another, maybe more obvious choice.  For the Buffer the OPA145 is used because of low noise at still low power consumption.

I have not experience with github. Maybe I put it there.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 22, 2020, 08:05:46 pm
Ok up on github, anyone who wants to contribute, go nuts,

https://github.com/Rerouter/Multislope-ADC-PCB
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 23, 2020, 07:59:39 pm
Mainly cosmetic changes today while I run through the BOM, and adding more test points, mainly around the reference.
An old preference of mine is to put pin-outs on the PCB so diagnosing is easy.

Will keep the op amp options in mind, right now everything is bog standard SOIC, so should be able to flip around freely
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 23, 2020, 08:25:52 pm
I think there could be still some ground loops with the filter caps at the regulators. The ripple current through the caps seems to share some part of the normal ground lines.  So there is chance to see some ripple on the supplies.

For the OPs there are in deed a few options. However in most places there are several good enough options (especially with only a LM399 reference). So there is not much need to test different combinations.
The 2 main critical OPs should be the 2 of the integrator: The slow one needs good low frequency noise (still have the resistors as a competing noise source). The fast one driving the output should have a good output stage and speed - this is the less predictable part, possibly effecting the INL.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 23, 2020, 08:51:15 pm
Power supply ground is on its own little trace back to the power in plug. Is it the current between the regulators your concerned about. Or is the thick ground traces on the top layer hard to tell?

With the fast integrator op amp biased in to class A operation the need for a "good output stage" should be mostly resolved. As there should be little to no changeover in the output stage.

The integrator has left me wondering about capacitive load driving.

Edit: will move the 5V ground to the power connector to keep everything to the same node.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 23, 2020, 09:46:48 pm
The ground track on the bottom from the AC in looks suspicious: the ground of the filter caps (unreg to GND) can carry some AC current and this can couple to the capacitors at the output. The current is relatively low, but the layout is not that good. That area is not very visible for the top.

The other point I just noticed is the 5 V supply to the 4053: the ground parts is quite a snakes trail. The PSRR for the LV4053 is not as bad as I initially though, but it is still not perfect. The 34401 ADC even has a separate low noise regulation (derived from the main 7 V reference) for the HC4053 chip. With the give relatively long trace, I would consider some optional more local regulation for the 4053.

When driven to class A output the fast integrator may not be as critical, but it is still one of the not so well understood points. Capacitive loading is somewhat linked to the output stage. Those OPs that are relatively tolerant to capacitive loading also tend to have a low open loop output impedance.

There is some capacitive loading, but not too bad: The integrator capacitance is not directly capacitive loading. The inverting input is only a virtual ground no true ground. Things like C17 and R20 are more like helping by adding real impedance. Because of the capacitive loading I currently have C37 unpopulated - more like keep it just in case as other ADCs have it and there may be a reason behind it I have just not yet understood. C14 from the other OP in the integrator kind of couples the 2 OPs - so this could be seen as capacitive load, but it helped with the response, both in real life and the simulation.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 24, 2020, 08:06:19 am
Ok, how would you prefer the power supply grounds? probably having a slow day, but not clear how exactly you want it handled. "current" was how it was when i posted the last picture, 3 is how I have it at this moment, but happy to flip it about.

Shortened the ground on the 4053 bit, and broke the micro off on to its own 5V feed split right at the regulator.

Also included some board pictures with no silk to hopefully make things easier to tell
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 24, 2020, 10:30:07 am
I am afraid that non of the suggested layouts for the regulator part is really good. It may still all work OK, as the current is small and this only low low ripple currents. Still it is odd to have this rather basic part not right.

The ground sides of the input filter caps and the outputs should not be mixed. The version 2 may be acceptable if the capacitors for the regulator output side would get there own ground (could be one shared).

From the input side there is input ripple current flowing trough the input caps - the connections in this path should not be reused.
There is no need to have a good ground connection for the AC input.

The ideal circuit with a central ground point is not that practical with so many parts. So one kind of has to compromise a little.
One can see the input side as a separate block, with it's own approximate ground point with the 3 input side caps the link to the input and the one connection to the central ground point for the regulator outputs.

One point that makes it difficult is having the capacitors for the output side also close to the regulators. They can be very well on the other side or more to the center of the board where there is space. The caps don't produce much heat and they don't need the heat from the regulators unless operated well below freezing. The caps on the output side can likely be smaller (e.g. more like 10-100 µF), while the input side caps may need some size (e.g. 220 µF, maybe 470 µF with a more power hungry reference), when using a 50 Hz transformer.  The regulator GND pins are more like inputs, so they may share a single line. So the central ground could be with the output capacitors.

Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 27, 2020, 09:11:27 am
Any better? analog and digital 5V right now have a separate feed to the output capacitor, analog also have another point of load cap closer,

Unreg current paths are now seperated out, all output ground current uses the regulator traces, so if the ground moves up and down a little, the regulator will track it.

the 100nF caps current should be almost nothing, so they are sharing the regulator ground for now.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 27, 2020, 10:32:41 am
It looks much better. There still seem to be a second ground connection at the 5 V filter cap on the top layer.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on March 27, 2020, 10:35:24 am
Clearer? the ground that wraps around the bottom does not actually connect.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on April 01, 2020, 07:45:01 pm
I did a few more tests for the turn over error with the integrator resistance still at 10 K. I know that 10 K is too low for the integrator to expect really good performance. This is more like a test under intentionally more difficult conditions to maybe get an idea about the source for INL errors.

In the normal configuration the turn over error follows about the simple square law. So it looks like an additional U² part to cause the turn over error.  for 9.3 V (the current maximum of my test source) the error reaches some 26 µV or some 3 ppm of the voltage.
The turn over error did not change much for 2 PLC mode and for a slower (half the speed) modulation in the run-up. Similar disabling the current mirror has very little effect - in the after-thought this is not such a surprise:
The main effect of the current mirror is to improve the settling at the integrator input and make it less dependent on the current. So the current mirror would reduce a possible effect due to settling of the integrator. Since changing the frequency and thus the number of switching events did not have an effect the settling should not contribute to the turn over error. So no longer such a surprise to no effect from the current mirror. There may still be an effect for the odd powers.

After this I did 2 tests exchanging the 74LC4053 switch chip: the first try was with the classical 74HC4053 (ST brand). This gave a huge turn over error, something like 10-15 times larger.  A main difference is that the on resistance is typically about 4 times higher. So the next try was testing 2 x 74LV4053 in parallel (stacked DIP). This gave a much lower turn over error - nearly too good to be true (-2 µV to 1 µV)  ;D.

With this test, there could still be a chance that 20 K integrator resistance could work.  It looks like there is a problem if the voltage drop the switches gets too large. And switch resistance is an important factor, entering more like a square, not just linear.

Attached is a plot for the turn over error with 1 and 2 x LV4053.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on April 02, 2020, 08:40:03 am
I think I got an idea which effect could cause this nonlinear effect:
The on resistance of the CMOS switches may not be so linear at higher currents. The data-sheets show the R_on changing with the DC-level. In a simplified picture about half ohmic voltage drop on the switch acts as a shift in the DC level and this way causes a nonlinear resistance. From a DS for HC4053 from Phillips I get a change of resistance by about 20% per volt. For 1 mA at 100 Ohms one has 100 mV of drop and could thus expect some 1% change (~ 1 Ohms) in R_ON. This would be 100 ppm of the 10 K at the integrator. The observed error (with the HC4053) is on the order of 60 ppm at 10 V.
 
This type of error would be proportional to the square of the input voltage and the square of the ratio of R_on to resistance at the integrator. This about fits the observed errors.
To get an error less than some 0.1 ppm we want  r_on/R_int less than about 1/1000. This would be some 30 K for the LV4053.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on April 02, 2020, 10:07:10 am
Looking over what is available to buy, I guess leaves the question of what ones we can immediatly knock out for there on resistance or similar.

DatasheetManufacturer PNManufacturerPriceOn resistance maxChannel MatchingSingle SupplySplit SupplyOn Time, Off TimeCharge InjectionChannel Capacitance CS,CDLeakage
https://datasheets.maximintegrated.com/en/ds/MAX4051-MAX4053A.pdf (https://datasheets.maximintegrated.com/en/ds/MAX4051-MAX4053A.pdf)MAX4053ACSE+Maxim Integrated3.75100Ohm6Ohm (Max)2V ~ 16V±2.7V ~ 8V175ns, 150ns2pC2pF, 2pF100pA
https://datasheets.maximintegrated.com/en/ds/MAX4051-MAX4053A.pdf (https://datasheets.maximintegrated.com/en/ds/MAX4051-MAX4053A.pdf)MAX4053CSE+Maxim Integrated3.58100Ohm12Ohm (Max)2V ~ 16V±2.7V ~ 8V175ns, 150ns2pC2pF, 2pF1nA
https://datasheets.maximintegrated.com/en/ds/MAX4617-MAX4619.pdf (https://datasheets.maximintegrated.com/en/ds/MAX4617-MAX4619.pdf)MAX4619CSE+Maxim Integrated2.2410Ohm200mOhm2V ~ 5.5V-15ns, 10ns3pC5pF, 8.5pF1nA
https://datasheets.maximintegrated.com/en/ds/MAX4558-MAX4560.pdf (https://datasheets.maximintegrated.com/en/ds/MAX4558-MAX4560.pdf)MAX4560ESE+Maxim Integrated5.18160Ohm2Ohm2V ~ 12V±2V ~ 6V150ns, 120ns2.4pC2pF, 4pF1nA
https://datasheets.maximintegrated.com/en/ds/MAX4581-MAX4583.pdf (https://datasheets.maximintegrated.com/en/ds/MAX4581-MAX4583.pdf)MAX4583CSE+Maxim Integrated1.9780Ohm1Ohm2V ~ 12V±2V ~ 6V200ns, 100ns0.5pC4pF, 6pF1nA
https://datasheets.maximintegrated.com/en/ds/MAX4581L-MAX4583L.pdf (https://datasheets.maximintegrated.com/en/ds/MAX4581L-MAX4583L.pdf)MAX4583LESE+Maxim Integrated2.5780Ohm1Ohm2V ~ 12V-200ns, 100ns0.5pC4pF, 6pF2nA
https://assets.nexperia.com/documents/data-sheet/74LV4053.pdf (https://assets.nexperia.com/documents/data-sheet/74LV4053.pdf)74LV4053D,118Nexperia USA Inc.0.62105Ohm2Ohm1V ~ 6V-31ns, 24ns-3.5pF2µA
https://assets.nexperia.com/documents/data-sheet/74HC_HCT4053.pdf (https://assets.nexperia.com/documents/data-sheet/74HC_HCT4053.pdf)74HC4053D,652Nexperia USA Inc.0.44120Ohm6Ohm2V ~ 10V±1.5V ~ 5V31ns, 29ns-3.5pF100nA
https://assets.nexperia.com/documents/data-sheet/74HC_HCT4053_Q100.pdf (https://assets.nexperia.com/documents/data-sheet/74HC_HCT4053_Q100.pdf)74HC4053D-Q100,118Nexperia USA Inc.0.44120Ohm6Ohm2V ~ 10V±1.5V ~ 5V31ns, 29ns-3.5pF100nA
https://assets.nexperia.com/documents/data-sheet/74HC_HCT4053.pdf (https://assets.nexperia.com/documents/data-sheet/74HC_HCT4053.pdf)74HCT4053D,112Nexperia USA Inc.0.48120Ohm6Ohm4.5V ~ 5.5V±1V ~ 5V34ns, 31ns-3.5pF100nA
https://assets.nexperia.com/documents/data-sheet/HEF4053B.pdf (https://assets.nexperia.com/documents/data-sheet/HEF4053B.pdf)HEF4053BT,652Nexperia USA Inc.0.44155Ohm5Ohm3V ~ 15V---7.5pF200nA
http://www.onsemi.com/pub/Collateral/MC74HC4051A-D.PDF (http://www.onsemi.com/pub/Collateral/MC74HC4051A-D.PDF)MC74HC4053ADGON Semiconductor0.5100Ohm10Ohm2V ~ 6V±2V ~ 6V--50pF100nA
http://www.onsemi.com/pub/Collateral/MC74VHC4051-D.PDF (http://www.onsemi.com/pub/Collateral/MC74VHC4051-D.PDF)MC74VHC4053DR2GON Semiconductor0.6100Ohm10Ohm2V ~ 6V±2V ~ 6V--50pF100nA
http://www.onsemi.com/pub/Collateral/NLAS4053-D.PDF (http://www.onsemi.com/pub/Collateral/NLAS4053-D.PDF)NLAS4053DR2GON Semiconductor0.7126Ohm10Ohm3V ~ 5V±3V23ns, 23ns12pC10pF, 10pF100nA
http://www.onsemi.com/pub/Collateral/MC14051B-D.PDF (http://www.onsemi.com/pub/Collateral/MC14051B-D.PDF)MC14053BDR2GON Semiconductor0.43280Ohm10Ohm3V ~ 18V---7.5pF100nA
https://www.renesas.com/en-us/www/doc/datasheet/isl84051-52-53.pdf (https://www.renesas.com/en-us/www/doc/datasheet/isl84051-52-53.pdf)ISL84053IBZRenesas Electronics America Inc1.98100Ohm6Ohm (Max)2V ~ 12V±2V ~ 6V50ns, 40ns2pC3pF, 9pF2pA (Typ)
http://www.ti.com/general/docs/suppproductinfo.tsp?distId=10&gotoUrl=http%3A%2F%2Fwww.ti.com%2Flit%2Fgpn%2Fcd74hc4051 (http://www.ti.com/general/docs/suppproductinfo.tsp?distId=10&gotoUrl=http%3A%2F%2Fwww.ti.com%2Flit%2Fgpn%2Fcd74hc4051)CD74HC4053MTexas Instruments0.55130Ohm5Ohm2V ~ 6V±1V ~ 5V--8pF100nA
http://www.ti.com/general/docs/suppproductinfo.tsp?distId=10&gotoUrl=http%3A%2F%2Fwww.ti.com%2Flit%2Fgpn%2Fcd74hct4051 (http://www.ti.com/general/docs/suppproductinfo.tsp?distId=10&gotoUrl=http%3A%2F%2Fwww.ti.com%2Flit%2Fgpn%2Fcd74hct4051)CD74HCT4053MTexas Instruments0.55130Ohm5Ohm4.5V ~ 5.5V±1V ~ 5V--5pF, 8pF100nA
http://www.ti.com/general/docs/suppproductinfo.tsp?distId=10&gotoUrl=http%3A%2F%2Fwww.ti.com%2Flit%2Fgpn%2Fcd4051b (http://www.ti.com/general/docs/suppproductinfo.tsp?distId=10&gotoUrl=http%3A%2F%2Fwww.ti.com%2Flit%2Fgpn%2Fcd4051b)CD4053BMTexas Instruments0.5240Ohm5Ohm3V ~ 20V±2.5V ~ 9V--0.2pF, 9pF100nA
http://www.ti.com/general/docs/suppproductinfo.tsp?distId=10&gotoUrl=http%3A%2F%2Fwww.ti.com%2Flit%2Fgpn%2Fcd4051b (http://www.ti.com/general/docs/suppproductinfo.tsp?distId=10&gotoUrl=http%3A%2F%2Fwww.ti.com%2Flit%2Fgpn%2Fcd4051b)CD4053BNSRTexas Instruments0.46240Ohm5Ohm3V ~ 20V±2.5V ~ 9V--0.2pF, 9pF100nA
http://www.ti.com/general/docs/suppproductinfo.tsp?distId=10&gotoUrl=http%3A%2F%2Fwww.ti.com%2Flit%2Fgpn%2Fcd4053b-q1 (http://www.ti.com/general/docs/suppproductinfo.tsp?distId=10&gotoUrl=http%3A%2F%2Fwww.ti.com%2Flit%2Fgpn%2Fcd4053b-q1)CD4053BQM96G4Q1Texas Instruments0.53240Ohm5Ohm3V ~ 20V±2.5V ~ 9V--0.2pF, 9pF100nA
http://www.ti.com/general/docs/suppproductinfo.tsp?distId=10&gotoUrl=http%3A%2F%2Fwww.ti.com%2Flit%2Fgpn%2Fsn74lv4053a (http://www.ti.com/general/docs/suppproductinfo.tsp?distId=10&gotoUrl=http%3A%2F%2Fwww.ti.com%2Flit%2Fgpn%2Fsn74lv4053a)SN74LV4053ADTexas Instruments0.5975Ohm1.3Ohm2V ~ 5.5V-14ns, 14ns-0.5pF, 8.2pF100nA
https://toshiba.semicon-storage.com/info/docget.jsp?did=54976&prodName=74HC4053D (https://toshiba.semicon-storage.com/info/docget.jsp?did=54976&prodName=74HC4053D)74HC4053D(BJ)Toshiba Semiconductor and Storage0.4100Ohm5Ohm (Typ)2V ~ 6V-38ns, 38ns-5pF100nA
https://toshiba.semicon-storage.com/info/docget.jsp?did=54977&prodName=74HCT4053D (https://toshiba.semicon-storage.com/info/docget.jsp?did=54977&prodName=74HCT4053D)74HCT4053D(BJ)Toshiba Semiconductor and Storage0.4110Ohm5Ohm (Typ)4.5V ~ 5.5V-45ns, 59ns-5pF100nA
http://www.vishay.com/docs/69685/dg4051e.pdf (http://www.vishay.com/docs/69685/dg4051e.pdf)DG4053EEY-T1-GE3Vishay Siliconix1.4978Ohm910mOhm3V ~ 16V±3V ~ 8V75ns, 88ns0.3pC2pF, 3.1pF1nA
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on April 02, 2020, 12:00:24 pm
For the switches, I have tested so far:  LV4053(best),  HC4053(Ti), HC4053(ST), HEF4053 and max 4053. The main chips left that I see for tests are DG4053 and NLAS4053DR2G / VHC4053. Chances are the last two a pretty similar to the LV4053. The DG4053 may be interesting because of a slightly lower speed - not sure if this helps or is a problem.

For the resistance specs it looks there are still some mixed numbers: the DS can use different conditions, like supply and also the DC level. Than it is also the question between maximum and typical.

I consider the LV4053 good enough. At least the ones I have here showed very low leakage and the on resistance is considerably better than the HC4053 version with about the same capacitance and less supply spikes.
The problem can be leakage, as the cheap logic series chips are not really tested for leakage. The specs are at some 100 nA with a typical value in the 1-10 pA range.

With R >= 30 K it looks like on resistance is good enough to get very low INL. 20 K is still a bit borderline but not too bad.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on April 03, 2020, 11:47:17 am
Been slowing working through the specs for our specific setup, and agree the DG4053 looks to have the best typical values out of the lot of them, with ones like the HEF4053 seeming downright horrible based on the spec sheet alone.

Also confused about what brand LV4053, as they both seem much faster than the rest, and I was left feeling you preferred slower switches, could there be a chance faster is better?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on April 03, 2020, 12:04:37 pm
For the speed of the switches, this is a two sided thing: fast gives the chance to get less jitter and the dead time in between is shorter. However this also gives more of the very high frequencies towards the integrator. Also the supply decoupling is more critical at the higher frequency end. A good point of the LV4053 is also having low power dissipation capacitance and thus low supply spike - so less critical supply decoupling overall.

I have use a Ti Version of the LV4053.
The main weak point of the LV4053 is that the leakage specs (test limits) are not very good. So they are not really tested for leakage - they can still be good: I see very little leakage so far (e.g. 10 pA range for the 3 switches and 2 OPs).
Title: Re: DIY high resolution multi-slope converter
Post by: branadic on April 11, 2020, 12:31:00 pm
There is an interesting looking source for hermetically sealed PTFE capacitors on ebay, which also offers 2.2nF 500V. You might want to give them a play to see, if they can do any good to your INL as well?

https://www.ebay.de/itm/560pF-0-1uF-500V-K72P-6-PTFE-Capacitors-fits-brand-name-Teflon-USSR-NOS/193107860442 (https://www.ebay.de/itm/560pF-0-1uF-500V-K72P-6-PTFE-Capacitors-fits-brand-name-Teflon-USSR-NOS/193107860442)

Nothing to loose, as they cost only 0.59€ each.

-branadic-
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on April 11, 2020, 01:07:38 pm
I thought about these NOS PTFE caps. However they are mechanical quite large and it is not sure they are actually good. I forgot where, but there was a report about not so great performance.

The capacitors I have now (TDK  C0G ceramics) are quite good: about the 5 times lower DA than PP / PS. In the diagram from Bob Pease they are about where the PTFE cap is.  With the extra switch to change the feedback in run-up I see a chance that the error due to DA could be reduced even more by maybe a factor of 5 or so. Currently I don't think the DA is the limiting factor - still lower DA could allow for a slower modulation and this way less effect from switching.
Title: Re: DIY high resolution multi-slope converter
Post by: razvanme on May 17, 2020, 12:48:43 pm
@Kleinstein, is someone trying to redo the code so it's easier to understand / modify? or are you working on a refactor? If not I can give it a go (without hardware for now), if the board on git is ok for a start, I can make some and test the software on the actual board.

Based on what I understood from the descriptions you provided here and on the other thread, bellow is the actual code that will do the runup. Did I understand that correctly? You used a "before" in some descriptions and that makes me think the comparator reading / check is using a queue of 2 values.

Another patent describes having references either both on or both off for equalizing the number of P/N Ref switching on each slope while the comparator is checked.

Code: [Select]
    RUNUP:
        SWITCH SWITCH_VIN                                           //2 clock cycles
        //----------------- We are counting clocks from here down
        // Clock cycle accurate delay
        DELAY (INTEGRATE_TP/2)-4 // compensate for the next switch
        RUNUP_LOOP:
            SWITCH_TOGGLE SWITCH_TOGGLE_CURRENT, SWITCH_TOGGLE_MASK, SWITCH_VIN   //4 clock cycles
            //-------------------- From here we are integrating VIN + VRP as start
            //  the next loop we are integrating VIN+VRN and toggle on a subsequent loop
            DELAY us_to_cycles(1)-5 // 3 for jmp and 2 for switch
            // If integrator is positive go to the needed slope
            LOOP_IF_POSITIVE 1f                                     //3 clock cycles
       
            // The integrator is negative, we integrate VREFN to go positive
            SWITCH SWITCH_VREF_N | SWITCH_VIN                       //2 clock cycles
            //---------- From here we are integrating VREFN+VIN   
            DELAY us_to_cycles(20)-12
            INCR SLOPE_COUNT_VRN                                    //2 clock cycles
            JUMP_IF IS_ONE(TIFR1, OCF1A), PRERUNDOWN                //4 clock cycles
            rjmp RUNUP_LOOP                                         //2 clock cycles

            // The integrator is positive, we integrate VREFP to go negative
        1:  SWITCH SWITCH_VREF_P | SWITCH_VIN                       //2 clock cycles
            //---------- From here we are integrating VREFP+VIN
            DELAY us_to_cycles(20)-12
            INCR SLOPE_COUNT_VRP                                    //2 clock cycles
            JUMP_IF IS_ONE(TIFR1, OCF1A), PRERUNDOWN                //4 clock cycles
            rjmp RUNUP_LOOP                                         //2 clock cycles
    PRERUNDOWN:
        // When we exit the runup loop we exit with 6 missing clock cycles from a full integration slope period
        //  2 for rjmp and 4 for the new switch toggle, compensate for that in the switch and extra delay
        DELAY 4
        // Make sure we are above 0
        // Integrate -VREF So we go in a positive direction until we go above zero
        SWITCH SWITCH_VREF_N                                        //2 clock cycles

Attached is a full project in AtmelStudio.

PS. It's still WIP. Also the pins do not correspond to the actual board, I just added the defines to make sure everything is working.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on May 17, 2020, 03:42:46 pm
The code I uploaded where complete versions, with run-up, run-down and the special test cases to measure the slope ration and ADC scale. The code also includes some dead code no longer needed, especially a 2 nd version for test of the ADC scale.  I do not yet have the code to control the front end - that part is still under development.
There is quite some code beyond the pure ADC conversions to aid testing: via UART control different modes of operation can be selected (integration time 1,2,4 PLC , RU version, loops over different setting of the input MUX, test mode for the ref. ratios, test mode for DA).
The PC side of the code is still essentially the old Turbo pascal version - I have started with a C code version that also runs with an UART-USB converter.

The AVR code is in ASM and not C, as the program run time is used for the delays. So AVR-studio uses an ASM project, not C. Because of the delays it would be very difficult to use C code - depending on the compiler the lenght could vary and especially the UART part with the same run time for different cases would be tricky in C. It already took quite some simulator runs to get it right in ASM.

Other peoples ASM code can be hard to understand, especially with code that has evolved over time, so that some name to the registers don't make much sense in all cases.
I can keep most of the data in the CPU registers that get  names. Only a few "variables" in the SRAM are used.
The stack like UART buffer can be really confusing - for better readability this may be a point to to change to a more normal FIFO like buffer.


In the current version there are 8 different run-up versions to choose from. The main versions  (e.g. from runup_P3f: on ) use a simple 3 phase system, a little like the HP 3458, 34401 and quite some other DMMs. During run-up there is always one reference active - no zero phases in the this version. As pseudo code the procedure is:
1) positive reference for some 12 cycles (varies between RU Versions)
2) depending on the comparator setting (from register t3)
     a) positive ref.  phase of some 78 cycles   (the exact length varies between RU versions)
     b) negative ref. Phase of some 78 cycles
    This includes sending UART data from a buffer if needed,
     counting the positive phases and at the end read the comparator status to register t3
    The exact timing when the comparator is read can vary between versions.
3) negative reference  for some 12 cycles  , and loop to 1) until finished.

There is no queue for the comparator, just a single buffer in a register (t3).

The rundown is similar to the HP3456. First one direction (positive) than the other and than the fine slope (positive) and finally as a new point reading the µC internal ADC with the integrator in hold mode.


The current standing is that I am routing / designing (depends on space) a board for the input part for voltage readings. The chopper type amplifier (a little like the Datron 1281) part at least works on the bread board to the degree expected for the BB.  As a fall back an AZ OP should be possible on the same board.
Title: Re: DIY high resolution multi-slope converter
Post by: razvanme on May 17, 2020, 04:56:03 pm
I understand all your points. It's hard at first glance to understand the original code that's why I figured it's easier to ask you :).
Also I think I was misunderstood, the snipped above is actual code from the project, in ASM using macros to simulate 'high level', the comments next to a line are the number of clock cycles that macro takes regardless of compiler since it's actual ASM ( actually regardless of compiler version / flags or other code ). I am aware timing is critical and at least the runup / rundown must be done in ASM. The only C part is main and eventually processing of UART commands since that is not critical. Also there are no variables, everything is in registers (we have a lot of them), 0 SRAM occupied for code that actually does something, it's a first for me anyway. I don't think it's that hard to read the above extract ( I am aware it might not be easy for others especially if you switch from another project or mental model of the functionality / project layout ).

So I guess the answer is no for now. Roger that.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on May 17, 2020, 06:53:26 pm
The mix with macros is really hard to read, if one is not familiar with the macros.
The macros may be nice for a simulation, but one step more tricky than pure ASM.

The run-up - method described looks a little different from my solution. There seem to be a phase without a reference instead of the positive + negative phases as a sequence.  Not sure if it really works as I don't see if the total number of switching events is constant.
Title: Re: DIY high resolution multi-slope converter
Post by: razvanme on May 17, 2020, 07:40:23 pm
It's a bit differently laid out I agree.
 Toggle VREP or VREFN for 1 us
     Integrate depending on comparator
  Jump to toggle

Now that you mention it, it might get out early and not finish a full P+N,based on your steps the timeout for 20ms should be checked at the end of the 3rd step before jumping to 1. That way it's sure to have a P + N per full cycle. Got it. There is no phase without reference applied, again I do agree it's hard to decode someone else's code if that's not a priority or there is something else that require's one's attention :).

Anyway I don't want to take over the thread with software discussions if that is not an objective now. I just wanted to know what's the status of the software and if I can help.

Will keep following the hardware development :-+.

Thank you.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on June 13, 2020, 01:27:46 pm

I tried a small variation of the ADC: the current from the 4053 switches to ground (when the "signals" are turned off) is not send directly to ground, but to an OP buffer. This is the optional OP IC1 in the plan, that replaces C6 and R47.
The idea behind this is to have a rather similar path for the current: either to the integrator or to the buffer. The supplies of the 2 OPs are closely coupled, so that the extra OP is expected to reduce supply ripple and ground currents. This extra buffer corresponds U808 in the ADC of the Keithley 2002.

For testing the difference of 2 run-up versions is recorded, while the voltage is slowly changing.
The 2 run-up version here are 3 phase with 1000 ns respectively 666 ns fixed phase. Total run-up period is 8.5 µs.
This is with the 2nd board and 10 kOhms at the integrator - so more like the test version to make the errors more visible (the 50 K version shows less difference).
Ideally one would have a flat curve or as the next approximation a slight slope. Deviations from a straight line represent different INL errors for the 2 modes of operation.

The green curve is before the change, with a direct ground connection. The blue curve is with the extra buffer.
The blue curve has slightly lower noise because this is the average over 50 conversions as opposed to 20 conversions.
There is a slight change in slope and some zig-zag part from -2500 mV to 1800 mV. So some visible errors at the +-1 V points that would be used to measure 1:10 gain steps.
The extra buffer seems to help with the overall slope (change in overall gain), but not much with the INL.
So far the extra buffer is not worth the effort.
Title: Re: DIY high resolution multi-slope converter
Post by: Crossphased on August 22, 2020, 08:08:05 am
Hope this topic isnt dead,
I find it incredibly interesting and I'm definitely going to build one!

Is it possible to switch to a more compact microcontroller? Kleinstein I think I read a comment by you that code coupled with this microcontroller provides the correct timing. I'm wondering if a smaller, faster micro would be acceptable as well?

Also, I took a look at the great board that Rerouter put together. I opened it in Kicad, but Rerouter must have a newer development version of Kicad, the board wouldnt open for me. After going through the text of the .kicad_pcb file, and removing code specific to the newer version of Kicad, I was able to modify to a file that can be opened with the current stable release of Kicad. See attached file if you're having trouble opening Rerouters Github version. Change the .txt extension to .kicad_pcb to open.
Cheers
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on August 22, 2020, 08:30:14 am
smaller micros are possible, but to use his original code it should be the same series, pretty sure the chip has a QFN option, I was using a dev version from memory as at the time clearance around curves was a little broken,
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on August 22, 2020, 10:51:02 am
The Mega48 µC is also available in a SMD version (QFN or similar) - for me this was too tiny to solder by hand. There is no real need for a faster µC. I would even consider reducing the clock speed to some 8-12 MHz to reduce the power consumption. My current board is intentionally not very small to have some room for bodges. Some of the room was needed, e.g for the modified buffer.
DIP parts with socket also allow changing chips (e.g. 74HC4053 or LV4053 or max4053) and if needed to change a chip if leakage is excessive.

With a much different µC one would need to rewrite the code. Some of the code is relatively tricky ASM code to ensure a defined run time, even with doing UART write from the buffer in the "background". Things could become rather tricky if the µC uses some kind of cache or similar, as this makes the run-time less predictable.

My current code uses about half the flash of the mega48, and includes some debugging test code. For a final DMM I am not so sure the fash is sufficient, so it may need the 8 kB version if more functions are integrated.

I have done some slow progress on an analog input board for DMM functions. Basically still the same idea as described earlier in the thread. Integration of 4 Wire ohms and current measurement caused some minor changes.
 
The other open point is the output / digital side. This currently is still a Turbo pascal program for a PC. I also have a crude limited version in C for another AVR µC. However here the AVR is a little on the small side using double numbers makes the code grow quite fast. One may have to go for some ARM based solution here (e.g. Blue pill or maybe a Raspberry).
Title: Re: DIY high resolution multi-slope converter
Post by: prasimix on August 22, 2020, 11:38:35 am
Hm, such great ADC + DMM functionality would be a neat new module for EEZ BB3  :-/O
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on August 22, 2020, 12:54:45 pm
Glad to see you join the party Prasimix, This was actually the ADC front end I was hoping to adapt into a module for the BB3 after refining it for 100x100mm, I think my kicad files actually still have your pcb template laid out to the right of the page.
Title: Re: DIY high resolution multi-slope converter
Post by: prasimix on August 22, 2020, 12:58:41 pm
Wow, that's sounds great. I believe we have enough room to put everything in place on one or even two levels if needed: e.g. ADC + MCU + Power on base PCB and DMM stuff as piggyback.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on August 22, 2020, 01:13:18 pm
Re Kleinsteins latest graph, a while back I spotted that the pattern you where using had certain ambiguous spots and seems to be roughly in the same spot I suspected, Perhaps alter the pattern slightly and see if it moves?

https://www.eevblog.com/forum/projects/multislope-design/msg2608230/#msg2608230 (https://www.eevblog.com/forum/projects/multislope-design/msg2608230/#msg2608230)
Title: Re: DIY high resolution multi-slope converter
Post by: SilverSolder on August 22, 2020, 01:21:26 pm
Wow, that's sounds great. I believe we have enough room to put everything in place on one or even two levels if needed: e.g. ADC + MCU + Power on base PCB and DMM stuff as piggyback.

Would this still allow building a stand-alone unit in a minimal enclosure?
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on August 22, 2020, 01:23:19 pm
The blocks are easy to shift around, once implemented for one, it can be shuffled around for another. I've already done it like 40 times for this project  :-/O
Title: Re: DIY high resolution multi-slope converter
Post by: prasimix on August 22, 2020, 01:24:42 pm
Wow, that's sounds great. I believe we have enough room to put everything in place on one or even two levels if needed: e.g. ADC + MCU + Power on base PCB and DMM stuff as piggyback.

Would this still allow building a stand-alone unit in a minimal enclosure?

Yes, why not if we take that requirement into account while designing the PCB.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on August 22, 2020, 03:20:33 pm
Wow, that's sounds great. I believe we have enough room to put everything in place on one or even two levels if needed: e.g. ADC + MCU + Power on base PCB and DMM stuff as piggyback.

Would this still allow building a stand-alone unit in a minimal enclosure?

This would still allow a stand alone version with a minimal enclosure. The added part (otherwise provided by the EEZ box) would be the ground referenced part (e.g.  ARM based µC  + LDC module + some PC interface (USB ?)) and a crude power supply to give some 12 V (some 1- 1.5 W) - possibly from an external wall wart.
A point that may prove tricky is that in the EEZ box the boards are vertically mounted - not sure how happy the LM399 is with this.

From what I have found the space in the EEZ box es about 75 mm x 180 mm (maybe 200 mm). At least with my current density this would need 2 stacked boards. Likely split like:
A) ADC + reference(LM399) + ohms current source + some reference level generation
B) input protection, switching, main amplifier, current shunts and current switching.
Especially the relays (currently 5 x)  may take up some space.
For the DC/DC converter and voltage regulation it is not sure which board would have space.

My current plan is to include some kind of internal calibration of the gain and shunt steps to get a artifact calibration like the 3458. For a DIY project it can be handy not to need many calibration points. This kind of needs  current ranges down to µA  and 1:10 steps. So there is no easy simplification with fewer shunts or only small current sources for Ohms. If at all one could simplify at the low current / high ohms (e.g. > 10 M) end. Also limiting the current to some 1-2 A can allow for more compact relays.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on August 22, 2020, 03:29:13 pm
Re Kleinsteins latest graph, a while back I spotted that the pattern you where using had certain ambiguous spots and seems to be roughly in the same spot I suspected, Perhaps alter the pattern slightly and see if it moves?

https://www.eevblog.com/forum/projects/multislope-design/msg2608230/#msg2608230 (https://www.eevblog.com/forum/projects/multislope-design/msg2608230/#msg2608230)

There are a few more tricky values, e.g. at some -350 mV where the modulation is like +-+-+- or to a smaller extend at other special patterns. The points move with a modified run-up. Quite a few of the graphs / linearity tests are with the difference between different feedback (run-up) versions. This is currently the most sensitive way I have to detect small deviation from ideal behavior.
Title: Re: DIY high resolution multi-slope converter
Post by: prasimix on August 22, 2020, 03:33:59 pm
Thanks Kleinstein for valuable input. The EEZ DIB module PCB dimensions are as in the picture below (height 95 mm x width 90-185 mm, source files are here (https://github.com/eez-open/modular-psu/tree/master/DIB)). We also have enough room to stack two PCBs (distance between modules is 35 mm).

(https://raw.githubusercontent.com/eez-open/modular-psu/master/DIB/EEZ%20DIB%20v1.0%20module%20dimensions.png)

The module may or may not be ground referenced. A small isolated DC-DC converter like Traco could be used (e.g. like in case of MIO168 (https://github.com/eez-open/dib-mio168) module).

Hm, if LM399 don't like vertical mounting that could be a show stopper. Perhaps something else could be used (not in that class but still worth the trouble)?

Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on August 22, 2020, 04:05:09 pm
The LM399 shows a slight change in voltage when tilted, but if this is constant it would not really matter. It is most likely OK. The main effect would be a slightly different thermal environment for the reference.  The LM399 with long leads is relatively high - so this may need to go to the inside with space left out in the other board. With the populated side to the inside one would just need to avoid a high part in this area - just no relay of large cap there.

One would likely need some insulation and maybe a shield to neighboring modules so some of the 35 mm spacing is lost there. So it would likely be something like 20 mm board spacing with the large parts on the inside.

The DCDC converter on the bus board would probably not be good enough. They usually have too much common mode ripple signal to be really useful for a good DMM. At least the ones I know are made for small size and not low coupling capacitance.  For the DCDC converter it would help to know the real power need (likely < 1 W, but could be more (e.g. 1.5 W) with a high ohms source current).
So far I plan with some +-20-22 V and some 7 V (to get 5 V from an LDO) so this would be non standard voltages anyway.
Title: Re: DIY high resolution multi-slope converter
Post by: prasimix on August 22, 2020, 04:15:44 pm
Judging by the look of similar modules for VXI / PXI chassis, I think shielding will be mandatory for the whole module or at least for the sensitive sections.

Regarding DC-DC isolation, what's about SN6505B (https://www.ti.com/product/SN6505B) push-pull converter in combination with ultra-low noise LDOs? That should provides 2-3 W.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on August 22, 2020, 05:13:25 pm
I think shielding and extra isolation would be needed, as the circuit ground / shield could be at a relatively high voltage (e.g. 200 V, maybe 500 V) relative to the rest of the circuit. At least for the 1st version I would limit the maximum voltage, so that more normal relays can be used and less need for cut-outs or extra spacing.

The SN6505 looks good, though I would prefer the lower frequency A version. My current DIY DC/DC runs even slower (AFAIR 25 kHz and long BBM time) as it uses a relatively large core (some 30 mm OD  ring core) to get more distance for low coupling. I don't think it takes special low noise LDO's - normal ones should be OK. It would be more about the higher frequency ripple. If at all it would be the +5 V for the 4053 switches at the ADC that is a little critical. This may be derived from the main reference (like in the 34401) if really needed - it may be a good idea if the 5 V regulator is not directly at the ADC.
Title: Re: DIY high resolution multi-slope converter
Post by: cape zoloh on September 21, 2020, 01:47:14 pm
Kleinstein,

Thank you for this thread, it is pure gold.
I've gone through roughly half of the thread now, and your posts are invaluable. Your tone is always positive and very informative. Thank you for sharing. Do you still put time into this?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 21, 2020, 07:44:41 pm
I am currently working on the input part to make it a full DMM (DC only). For the actual ADC part I have currently no need for changes: The INL part is still not as good as I ideally hoped for, but kind of good enough. The DMM input part would make INL testing simpler - so for the time being I consider the ADC good enough. The noise is already very good and I now know the NOMCA resistors are a large part of it, so it could get even better. The INL could always be better, but it's starts to get tricky with testing for the 50 K version - the last tests with larger errors were with lower resistors (20 K and 10 K) to make the errors more visible and thus simplify testing.

The last change in the HW (using a ground buffer - already planed on the PCB and finally tested) looks small, but it makes the difference between needing the reference closely linked to the ADC and the option to have an external reference.  There is an effect on the INL too - though not large. This supports that part of the INL has to do with the layout / ground routing.  A lower noise reference may be needed for more stringent INL tests.

Another point was looking at the option to change to an STM32 µC  (e.g. STM32F334 or STM32L151) - wanted to start with these µC anyway. It looks like the event system can do essentially all the time critical things in hardware. So there would be no more need for ASM code and C code could work. By itself the other µC with a 12 bit ADC would not improve the resolution or noise - it may make things slightly faster, but not much. It can however allow a different run-up version, that may have better INL  So I am not sure if I do the next ADC PCB version for an AVR or STM32.  I have a slight problem with the communication from the GND based part towards the AVR, as the AVR is not checking the input side very often.

Anyway the front end would probably be first, but should work with both µCs.
Title: Re: DIY high resolution multi-slope converter
Post by: openloop on September 22, 2020, 01:30:49 am
Kleinstein,

Quote
The noise is already very good and I now know the NOMCA resistors are a large part of it

What's wrong with those? Not-temperature-related ratio drift?
How did you find out?

K2002 ADC uses that kind array (asymmetrically) in slopes current setting.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 22, 2020, 08:44:22 am
I see more than initially expected 1/f noise, even after changing the main relevant OP. So there seems to be an additional source of 1/f noise.  The noise also went down with different resistors:  with NOMCA (50K) the noise level is at some 850 nV, with 20 K PTF56 (2x10K in series) the noise goes down to 500 nV. The change is not only in the white noise part, but also with the 1/f part.

There is also a measurement of the NOMCA resistor noise directly:
https://www.eevblog.com/forum/metrology/statistical-arrays/msg3137942/#msg3137942 (https://www.eevblog.com/forum/metrology/statistical-arrays/msg3137942/#msg3137942)
The noise measured there is about the order of magnitude I see as extra 1/f noise.
So my current favorites are DNFA resistors as there is no 50 K version of LT5400.

The K2002 DMM is relatively noisy (some 2000 nV for 1 PLC AFAIR, but conflicting reports). Excess noise from the resistors could be part of the problem, but there seem to be other points (the front end may contribute a factor of 2) that also add to the noise. The resistors are likely not the main point. The resistors look similar to NOMCA, but they may be different internally.
Title: Re: DIY high resolution multi-slope converter
Post by: openloop on September 22, 2020, 12:17:52 pm
Kleinstein,
Thanks!

In regards to your INL testing:

How do you measure it?
I'm asking because when messing with my guinea pig K2001, I found that it is very important to keep ADC busy.
Namely, interspersing payload with acal readings of various voltages keeps components warm and their thermal mass (inertia?) reduces influence of the value measured on the result.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 22, 2020, 12:54:17 pm
For the INL testing I have 3 different tests:
1) the classical turn over test with a few voltages (1.5 to 9.3 V in steps of some 0.7 V). Switching the polarity is manually, but the program runs through. The results are averaged over some 5 repeats.
2) A simple addition of 2 voltages test, with the sum at some 9.3 V or -9.3 V. Here again switching at one end is manually the other end is with the DG408 mux at the ADC board.
3) compare 2 ADC variants with different run-up versions (e.g. different delays, FB frequency). So one reading version A, one reading version B and than back to A. The difference between the 2 versions captures those INL errors that are different for the 2 versions. So not a full test, but on the upside very sensitive to also small  errors down to the 0.01 ppm range and relatively fast and automatic (let the program run for some 2-5 hours to get a whole lot of data, e.g. covering some +10 to -8 V with maybe 5000 points after averaging to some 50 to 100 PLC.

The first 2 tests include the reference noise and are thus more noisy. The difference test uses an external test voltage, but the difference is over a short time and the filtering of the ADC reference helps here quite a bit. So reference noise does not enter very much. The first 2 tests get the long range (e.g. U² and U³ contributions), while the 3rd test gets the shorter range more wiggly part with more local effects. The more short range effects are expected to be effected by a different run-up. The slow changing part may not change with a different run-up.
Title: Re: DIY high resolution multi-slope converter
Post by: branadic on September 22, 2020, 05:28:39 pm
With respect to the noise measurements by Castorp you could test Susumu (NI -60dB) RM3216I-503 / RM3225I-503 / RM6432I-503 (4x 50k resistor) to see, if you are limited by the noise of NOMCA (NI -40dB) resistors.

-branadic-
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 22, 2020, 08:08:51 pm
The Susumu resistor arrays with 50 K and 3 or 4 resistors  seem to be not so easy to get - I don't see them in Stock or even listed at Mouser or Digi-key.

The DFNA arrays are in stock at mouser. They are not as low noise, but still supposed to be some 10 dB  (7 dB compared to 2 resistors in series) better than NOMCA. As last resort it could be 4 x 10 K in series, which also has a chance to improve on the relative TC and self heating.

The relevant frequency for me is at some 17 or 25 Hz. So there may be a little excess noise visible, maybe comparable with the normal Johnson noise.  The excess noise would also cause some fluctuations in the overall gain, effectively adding noise to the reference.  This is not much and the NOMCA resistors should still be better than the LM399 ref, though likely more noisy than a LTZ1000 ref.

Another series available is the PRA100 series: not as cheap (some 10 EUR), but still OK.

So maybe a should get some for testing (e.g. dead bug style on the existing PCB)  before designing the next ADC PCB. The 50 K resistors may behave slightly different from 10 K. Also the noise specs (if there at all) could depend on the value or may reflect the limits of the test system. Measuring below -40 dB noise index is tricky.
I am quite sure that quite some of the noise is due to the resistor excess noise - so the tests are more about finding / confirm a better solution.
Title: Re: DIY high resolution multi-slope converter
Post by: openloop on September 22, 2020, 10:49:24 pm
On the subject of the power supply:

In Horowitz and Hill, "The X chapters" there is a good treatment of a relatively simple, low noise, low common-mode noise isolated power supply intended for scientific instrumentation.

Chapter 9x.14

Fun read, if (as I assume) you're into that kind of thing.
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on September 25, 2020, 08:09:11 pm
After doing some experiments i'm not very impressed with those "X-Chapter" proposals. That converter puts about 0.5 mV of common mode output into 50 Ohm = 10 uA. A 50 Hz power supply i made recently based on a commercial 50 VA two chamber transformer outputs about 3 uArms into ground. That means with a ground wiring of 0.3 Ohm or less one gets below 1 uV of error voltage. And this is 50 Hz, so inductance matters less than at 100 KHz. And there are commercial 100 mH common mode chokes!

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 25, 2020, 09:08:16 pm
The x-chapters DCDC converter does not look very impressive to me either.  When using a forward converter, there is no need to have very good coupling at the transformer. So no need to have the winding as primary - secondary - primary.  It can be simple 2 well separated windings (e.g. 2 chambers, or opposite sides of a relatively large ring core) with sufficient spacing (e.g. a few mm, not just a capton tape). The efficiency may not be great, but probably still better than the loss from linear created sine drive.
I have tested a simple push pull DCDC with a relatively large ring core (some 35 mm OD) like this and it seems to work good enough (no obvious extra noise). However it looks somewhat hand made and not pretty. The coupling capacitance should be relatively small (e.g. < 5 pF) - though I have not measured yet.

With the aim of little capacitance to ground, there is only a limited effect of a common mode choke.
Title: Re: DIY high resolution multi-slope converter
Post by: openloop on September 25, 2020, 09:39:42 pm
Kleinstein,

In defence of the X chapters:  ;D

Quote
So no need to have the winding as primary - secondary - primary.
They do not have that either. All they have is a secondary, sitting between two (not shorted) layers of copper tape (grounded) serving as electrostatic shield.

Quote
The efficiency may not be great, but probably still better than the loss from linear created sine drive
They also point out that trapezoidal drive works the same. They say that pretty much anything without discontinuities should work.

Quote
With the aim of little capacitance to ground, there is only a limited effect of a common mode choke.

Some form of a ground connection will be provided by the user...   :-/O
Title: Re: DIY high resolution multi-slope converter
Post by: openloop on September 25, 2020, 09:49:29 pm
Dieter,

Quote
A 50 Hz power supply i made recently
Well, duh!  :)
If an old school power supply is an option then sure. All DMMs on my bench are like that.
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on September 26, 2020, 07:01:22 am
I noticed discontinuities from two sources:
a) The primary side will ring when current switches from npn to pnp driver and vice versa.
b) The secondary stray inductance will ring with the rectifier bridge turning off, so it needs a snubber (some nF).

Until parts arrive i used a large 6 mH common mode ring choke. Also one would want some voltage regulation from secondary to the primary side oscillator amplitude. I used a wien bridge with a n-channel FET to get something nice. The FET saves the third OpAmp and it can be replaced by a HF11 optocoupler (+ 2 pF). The stray capacitance of a conventional two chamber transformer is about 50 to 100 pF.

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: julian1 on November 25, 2020, 07:48:01 pm
How are the analog switch dgnd pins handled? 

Are they merged as a net with analog gnd (ADGND?), or are the switch gnd traces pulled out to a star ground?

Perhaps it does not matter too much - given relative infrequency of switching and dominance of charge injection noise?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on November 25, 2020, 08:37:26 pm
The analog and digital (main) ground are linked at the ground pin of the LM399 reference.  The analog GND mainly goes to low current inputs, so there is no extra star ground used for this.

With hind-side the AGND routing may be more tricky than I though, so a separate path for the divider at the integrator (the only path with more than an OP input) may better use a separate path to the central ground point at the reference. I don't know for sure but things like ground currents (also dynamic, not just static) can be a cause for INL errors.

I don't think charge injection is dominating noise. At least the noise does not change much if the modulation frequency is changed (some 40 kHz to 160 kHz).  So far the 2 larger noise sources are the resistors thermal noise and excess noise from the resistors (NOMCA). Than likely comes noise from the "slow" OP at the integrator (OPA1641), and maybe some not so well understood source like charge injection, supply noise, mains hum or clock jitter.  Anyway ADC noise is no longer the main concern. It is more about improving the INL and finishing a front end and output side software.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 23, 2020, 01:01:23 pm
 
After quite some time here is a small update on the ADC. Attached a new version of the PC side software. This time for FreePascal / Lazarus  (a free IDE similar to Dephi). The function has not changed very much, mainly the possibility to run with USB-UART adapters and Win7/8/10.

For the ADC board, I still have 2 rather odd effects, that are rather resistant to changes to the circuit:
First there still is some effect, that initially looked like a delayed effect. One reading is to a small fraction effecting the next reading. However ever it turned out that much of the effect is not from the actual ADC reading, but the selected channel at the input mux. The really odd point is that a similar effect is still present with just switching the control lines at the µC, even without the DG408 MUX in the socket.
The effect of the MUX channel is not nice, but as long as it is stable (it is hard to change even if I try) one can subtract it as a channel specific offset.

To get only the delayed effect from the ADC and buffer, but not the mux, the effecting voltage is varied externally. 2 zero readings are compared with different readings before. Reusing a program part made for a slightly different purpose the sequence is  0 V,  variable voltage, 0 V and 7 V reference. Ideally the 2 zero readings should read the same, maybe with a small offset from the different active channels before. There is a small effect of the variable voltage on the next reading, not much, but just visible. For noise reduction the data points are the average over 50 sequences at 1 PLC each. The curve combines data from going up and down in the voltage several times.
A known mechanism to cause such a delayed effect is the slow part of the dielectric absorption in the integration cap. However this should have the opposite sign and is expected to be a little weaker (e.g. 10 ppb range). Chances are the observed effect is something like a thermal effect.

The second odd point is that different run-up version give a slightly different result. The main nasty point here is a slight difference in gain (close to 1 ppm) for negative readings compared to positive ones between two versions with different minimal pulse length. Chances are the version with longer minimum pulse length is less effected, but this is not sure, as only the difference can be measured with high resolution.
Title: Re: DIY high resolution multi-slope converter
Post by: ali_asadzadeh on December 27, 2020, 05:21:07 pm
Thanks Kleinstein for sharing :-+

I suggest you make a repo for this project on Github, It make it more convenient to see the latest update there.
Title: Re: DIY high resolution multi-slope converter
Post by: ali_asadzadeh on December 29, 2020, 10:40:57 am
Out Of curiosity, How much Resolution and sample rate could you get from this ADC,
Also I have found this new cheap ADC from TI ADS131M08IPBS & ADS131M04IPBS, they have 20.3 ENOB @ 250sps, so the questions is Does it worth the effort? or can these new ADC's from TI be used to enhance this  multi-slope converter?
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on December 29, 2020, 11:07:55 am
I have played with the ADS131M08 before, that spec assumes a perfect power supply with no noise, PSRR drags it down a little, as well as reference drift, for relative measurements they are little unicorns, for repeatable its a little worse,

As a cheaper method you could just build a direct sampling ADC without the slope comparitor using that chip, however scaling the input to a suitable range would be mostly the same including an input buffer as its impedance sensitive,
if you built it well, you have a -1.5 to +3V input range,

You can tease out a few more bits using the gain assuming you have a suitable offset DAC, but that is not too easy either,
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 29, 2020, 12:29:09 pm
I currently have a 20 ms integration time and thus some 40.4 ms time for an auto zero cycle with 2 measurements. The theoretical / numerical resolution is at some 28-29 bits (depending on the gain used for the µC internal ADC). There is no real need for more resolution from the auxiliary ADC - I currently use some 8-9 out of 10 Bits.
The noise level is at some 850 nV_RMS with 50 K resistors (NOMCA) and some 450 nV with 20 K resistors (2xPTF56). This is close to  24 bit ENOB for 25 SPS, depending on the input range / front end. For comparison with SD ADCs one may have to look if the readings are independent. Some filters give kind of overlapping samples, like a running average filter.
 
I initially had a fast version that was at around 200 µs for the conversion (and still good resolution) - but the data transmission separate. So a speed up to some 5000 SPS should be possible. For the very fast conversions the integrated ADCs definitely have some advantage.

The SD ADCs can offer quite low noise, but the linearity is limited and they start with a reference of some 2.5 -5 V.  The high stability references tend to be around 7 V and it thus needs extra effort to generate the reference and also the input stage needs an extra divider.

For lower needs the SD adc chips are hard to beat. The really low noise noise ones (e.g. AD7177) are not that cheap and still need some support circuit (e.g. reference buffer, scaling).
Title: Re: DIY high resolution multi-slope converter
Post by: branadic on December 29, 2020, 12:46:09 pm
Kleinstein, question:

Did you already test TOMC16032002AUF (https://www.mouser.de/ProductDetail/Vishay-Thin-Film/TOMC16032002AUF/?qs=%2Fha2pyFadugFFvujY3Cc%252BW1zHNKdK8GGUW3e%2Fym%252BOkEjqrz%2FW3ljDQ%3D%3D)?

If 20k is a good value and noise is not to bad either, refering to the measurement by Nikolai Beev (https://www.eevblog.com/forum/metrology/statistical-arrays/msg3137942/#msg3137942), they might be an economical solution and are available, other than TDP16032002 or multiple LT5400-1, which perform even better in terms of noise.
Though there are no public results of noise measurements on PTF56, other than many other resistors, that where tested in Resistor Current Noise Measurements (https://dcc.ligo.org/public/0002/T0900200/001/current_noise.pdf).

-branadic-
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 29, 2020, 02:25:13 pm
The 20 K resistance version is more like for INL testing to make some of the errors intentionally larger. A 8x20 K array may still be OK if used with 2 resistors in series. Because of the INL effects I would not like to go much below 40 K. Without excess noise from the resistors I would expect to reach some 500 nV noise level also with 40-50K resistors.

My current plan for a next board is to used DFNA type resistor arrays. They are also in the measurement of resistor arrays, only slightly higher noise than the TOMC type.

The PTF56 also seem to have some excess noise. The TC matching in an array can also be better - though the resistors I have show good matching (a little over 1 ppm/K for the gain drift, that depends on 2 sets resistors). The self heating effect on INL depends on the individual TC with separate resistors, but the relative TC with a coupled array. So an array is the way to go. I still have PTF65/PTF56 planed in the input stage.
I have planed a noise test of some  PTF56 resistors - using the ADC to read the amplified noise.  The circuit is also a test for the planed input stage.
Title: Re: DIY high resolution multi-slope converter
Post by: ali_asadzadeh on December 29, 2020, 03:10:45 pm
Thanks Kleinstein for the points,

Quote
I initially had a fast version that was at around 200 µs for the conversion (and still good resolution) - but the data transmission separate. So a speed up to some 5000 SPS should be possible. For the very fast conversions the integrated ADCs definitely have some advantage.
Do you have the design? Also would you please share the eagle files too?

I know the basics of dual slope ADC ,IS there any post detailing how your Converter works?

Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 29, 2020, 04:20:14 pm
There are a few minor changes from the initial board/ circuit, that are described later. The main changes from the initial circuit are with the input buffer, the supply decoupling/filtering at the µC and 4053 and using a canned oscillator instead of just the crystal at the µC.
For a simple / low cost version a single OP is OK for the input buffer. The 2  OP version is there to be reasonable confident to not have INL effects from the buffer.
There is a circuit diagram at around post 241, redrawn from User Rerouter, that is rather close to my actual circuit. There should be also some eagle / Kicad files around. My last changes are more bodged on and thus no board for this.

There is some description on the workings in the initial few posts of this thread.
The fast case used the same hardware, just a minimal run-up phase with only integrate for a fixed time, so a  dual slope like run-up and multi-slope type rundown. It was used as initial test version for development. It is still there as dead code in the ASM file. A shorter run-up with only a few run-up cycles would also work, possibly even faster -  this also needs a higher baud rate. I have not tested beyond some 100 kbaud.
Title: Re: DIY high resolution multi-slope converter
Post by: ali_asadzadeh on December 29, 2020, 07:57:50 pm
Thanks Kleinstein for the hints, I have some Ideas to paly with your circuit with more modern parts, Like the 1GHz MCU i.MX RT1170 from NXP or the STM32H parts, they are 480MHz or 550MHz and have 16bit internal ADC,

https://www.eevblog.com/forum/microcontrollers/the-1ghz-mcu-i-mx-rt1170-is-available (https://www.eevblog.com/forum/microcontrollers/the-1ghz-mcu-i-mx-rt1170-is-available)!/

Since it can count the time with 1GHz, it should give us about 100 times the speed, also they have way better ADC's, so the first part of it is to understand fully how your circuit is working, I think I should keep reading for some time. >:D
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 29, 2020, 09:48:08 pm
It may make sense to use a slightly faster µC. However the faster µCs also make things more complicated, as they have things like internal caches and may also cause more EMI problems. The  old 8 bit AVR µC has the advantage that it does not use caches and gives 100% predictable execution speed. With a more modern ARM CPU one would more like need to rely on the µC internal event system to do the really time critical parts. Alternatively one may use extra timer input capture to at least measure the actual times. The worst case delays may not be that much better than with the old 8 Bit µC.  A µC internal PLL can also add jitter and complicate things.

The way the ADC is made, it does not really need a faster µC or higher resolution for the auxiliary ADC.  The points at the wishlist are more like a hardware buffered UART and a slightly faster (e.g. 100 kSPS instead of some 10 kSPS) ADC and maybe a low grade DAC.
The difference would be a slightly higher maximum speed, not lower noise.

I envisioned an STM32F334 version using the event system. While C code is easier than ASM, it makes heavy use of the timers and event system and is this way quite tricky, if it works at all. Somehow not the best project to start with a new µC.

The critical point is no more the noise (the main part is very likely from the resistors) and not at all the quantization limit. Different resistors are on the list as a possible improvement, e.g. for a new board, but low priority.

The weakness is more with INL, which is quite a bit more difficult part. One has to looks for all those small things one normally ignores and data-sheets usually don't tell.  Here it looks like the nasty part is from some EMI or odd high frequency interactions via the supply. 

There was a red herring with loading the OPA172 at the integrator: there is an effect of the load current visible on the scope, but it very much looks like the overall effect on the ADC result is minimal. It effects both transitions and it looks like those 2 effects near perfectly compensate. Of cause the OP data-sheets don't give curves for open loop output impedance as a function of output current and I don't expect the spice models to be accurate at such a detail.

Currently my prime suspect it the canned oscillator - there may be an effect on the clock frequency from the load to the clock signal or via supply ripple.
Title: Re: DIY high resolution multi-slope converter
Post by: Castorp on December 29, 2020, 10:12:58 pm
In case you're interested, here are some more (preliminary) numbers for Noise Index of the arrays:

NOMCA: 1 kOhm -33.7 dB; 2 kOhm -29.1 dB; 5kOhm -24.9 dB; 10 kOhm -29.5 dB; 20 kOhm -27.2 dB 50 kOhm -34.9 dB
TOMC: 100 ohms -60.9 dB; 1 kOhm -60.8 dB; 10kOhm -52.1 dB;  20 kOhm -60.1 dB
DFN: 1 kOhm -51.5 dB; 10 kOhm -43.3 dB; 100 kOhm -48.5 dB
ORN: 1 kOhm -75.6 dB; 10 kOhm -72.5 dB; 50 kOhm -67 dB; 100kOhm -64.8 dB

The numbers for ORN are pretty much at the measurement limit, so in reality they are even quieter. In fact they seem to be the least noisy thin-film arrays I've tested so far, together with MORN (different package).
AORN are similar to NOMCA but slightly better, hovering somewhere in the -35 dB ballpark regardless of the value.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 29, 2020, 11:04:02 pm
Thanks for the data.

From the data sheets I found the MORN and ORN arrays show different specs - so it looks a little more difference than just the case.
They could still be very similar and only different are data-sheets with more available data for the newer version.

Anyway the ORN or MORN arrays really look promising.  I think I would want something like >10 dB better than the current NOMCA (50 K). So most of the other arrays seem to be good enough, just not NOMCA or AORN.

The ORN type would even allow for an upfront test on the existing board with a minor (link 2 pins ;D ) bodge.
Title: Re: DIY high resolution multi-slope converter
Post by: ali_asadzadeh on December 30, 2020, 07:05:42 am
Quote
I currently have a 20 ms integration time and thus some 40.4 ms time for an auto zero cycle with 2 measurements. The theoretical / numerical resolution is at some 28-29 bits (depending on the gain used for the µC internal ADC). There is no real need for more resolution from the auxiliary ADC - I currently use some 8-9 out of 10 Bits.
The noise level is at some 850 nV_RMS with 50 K resistors (NOMCA) and some 450 nV with 20 K resistors (2xPTF56). This is close to  24 bit ENOB for 25 SPS, depending on the input range / front end. For comparison with SD ADCs one may have to look if the readings are independent. Some filters give kind of overlapping samples, like a running average filter.
Kleinstein you told that your integration time is around 20ms, and I know that ATMEGA48 can be clocked at most 20MHz, so in 20ms the timer can count to the maximum of 400000, so how you get 28-29 bits resolution, since 400K is around 19 bit so what am I missing something in here?
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on December 30, 2020, 07:17:36 am
Count the number of positive / negative slope cycles (Positive slope voltage * positive count - Negative slope voltage * negative count), This derives most of the resolution of the converter, the rundown phase then drags out a little more, and finally the ADC reading of what is left drags out a tiny amount of resolution,

The resolution derived by the slope cycles is a tradeoff between switching cycles, charge injection, drift and a few more fun factors, the time it takes to complete these cycles do not actually contribute to the resolution, but can be used to increase confidence in the reading technically if you had enough compute left over,

The rundown to my understanding is just fixed length pulses until the comparator changes state, while you can go with a timer method to capture the nanosecond it reaches the threshold, that is trading resolution between the ADC that samples the residue and the timers precision, so you don't actually gain much,

I drew up the math for it some time ago, though the exact pattern or method may have changed slightly since then, https://docs.google.com/spreadsheets/d/124oaWnT20oyATqJzljLi7ERs9dDA7BqPNQoNRmwFV4k/edit?usp=sharing
Title: Re: DIY high resolution multi-slope converter
Post by: kleiner Rainer on December 30, 2020, 09:06:35 am
Kleinstein,

did you have a look at Silicon Labs 8051 derivatives? At work we use them in large quantities, and the tooling is free (Keil C-Compiler and assembler). Support is excellent and getting samples and demo boards is hassle-free, even for our interns and their projects.

Maybe this one could be interesting:

https://www.silabs.com/documents/public/data-sheets/C8051F35x.pdf (https://www.silabs.com/documents/public/data-sheets/C8051F35x.pdf)

24-bit A/D, 2 current-mode 8 bit D/A, operation up to 50MHz, several PWM and Timers, FLASH-based and a buffered UART.

IIRC, there should be a demo board in my stash of samples, if you are interested:

https://www.silabs.com/documents/public/user-guides/C8051F35x-DK.pdf (https://www.silabs.com/documents/public/user-guides/C8051F35x-DK.pdf)

Tooling:

https://www.silabs.com/developers/8-bit-8051-microcontroller-software-studio (https://www.silabs.com/developers/8-bit-8051-microcontroller-software-studio)

Greetings,

Rainer
Title: Re: DIY high resolution multi-slope converter
Post by: Andreas on December 30, 2020, 09:54:59 am
Since it can count the time with 1GHz, it should give us about 100 times the speed, also they have way better ADC's, so the first part of it is to understand fully how your circuit is working, I think I should keep reading for some time. >:D

Hello,

increasing the time resolution does only help if the clock stability is maintained.
Usually those parts have PLLs which are much less stable than a XTAL clock or Oscillator.

As I have seen with my 10V LM399 experiments the clock stability
has a large influence on stability of the analog part.

with best regards

Andreas
Title: Re: DIY high resolution multi-slope converter
Post by: ali_asadzadeh on December 30, 2020, 10:47:07 am
Quote
increasing the time resolution does only help if the clock stability is maintained.
Usually those parts have PLLs which are much less stable than a XTAL clock or Oscillator.

As I have seen with my 10V LM399 experiments the clock stability
has a large influence on stability of the analog part.

Si5340 From can be used as a very low jitter clock gen to feed MCU timer/counter external pin, maybe with this baby we could solve it too >:D
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 30, 2020, 10:50:35 am
Even with only a little help (e.g. using some 8 bits) from the µC internal ADC the numerical resolution is sufficient at 20 ms integration. The slight point to improve may be the speed of the ADC: the AVR needs some 10 µs for sampling and this time could be reduces a little for the rundown phase. Having the full conversion ready helps with the latency and data format. A faster µC may make a small difference in the maximum speed.  I expect the quantization noise to become only below some 1 ms integration time. There a little more resolution from the ADC may help a little. Because of mains hum it would be rare to need more than 22 Bits at 1 kSPS.

I even consider to extend it intentionally to some 200 µs, so that for averaging over 100 conversions one would get one extra power line cycle. This should give an slight extra boost to the 50 / 100 Hz hum suppression. To get a stable clock I decided not to use a PLL for the clock and thus no perfect synchronization with the mains frequency. With a slightly variable mains frequency there is possibly a small part of the mains period missing or too much and thus non perfect suppression. With 100 conversions spaced by some 200 µs extra shift one would have these short extra times quite evenly spaced over a mains phase. So those tiny bits would to a large part cancel out. So at least for the average over the right number of consecutive reading one could get an improved hum suppression (e.g. an extra 40 dB if the frequency is not off by too much).

If changing the µC it would be more because of an integrated DAC, hardware buffered UART and better EMI / clock stability. The current code is quite compact (some 2.2 KB with maybe 1.5 K actually used) , but it is still quite tricky to port to a different µC. It is ASM code with well defined run times for the critical part.  It may be simpler with something like the STM32, if the event system can take over the direct reactions or at least measurements.  There is nothing really wrong with the AVR mega48 or mega88 - the IDE has a really nice simulator, that really helps with time critical code. Clock wise I am more considering to go from 16 MHz to maybe 8 MHz to reduce the power consumption and maybe EMI issues.
Title: Re: DIY high resolution multi-slope converter
Post by: magic on December 30, 2020, 12:03:36 pm
In the last few years Microchip introduced new "1-series" and "0-series" AVRs such as ATtiny1614 and friends and some ATmegas.

They have the same 8 bit CPU architecture (some instruction timings are different), new but more generous and logically organized peripherals, faster ADCs, 8 bit DACs, synchronous/asynchronous event system and a small bit of asynchronous programmable logic. No buffered UART, I'm afraid.

The parts are programmed and debugged using 1-pin interface based on half-duplex UART, use less power and are 5V capable.

I haven't used them yet although I have a few in my parts stash. Are they worth it for you, :-//
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on December 30, 2020, 02:52:22 pm
To work in assembler with timing by cycle counting may be some thrill, but not very productive.

Let me mention the MSP430. In 2004 we selected it for a mixed signal application (pulse oximetry) and it became a big success. The oximetry application is somewhat "high end", where you need to measure a modulation of 0.1 % with 1 % accuracy (100 dB noise free). Not easy on a small OEM board. The MSP430 has a 16-bit single cycle CPU without cache. Its complex timer peripherals made it possible to implement everything by interrupts. For example it can play a waveform on the DAC using DMA. The main loop is "sleep" and it sleeps a lot. We are using its 12 Bit on chip ADC and one of its 12 Bit on chip DACs, at 6 MHz. MSP430 is not 5 V compatible, but low power and very quiet. It includes a "marginal flash read" method to detect pending flash failure, so you can refresh the flash before it fails, and it will live forever.

Two or three years after introduction of the product we separated system from application code and even 16 years after introduction the firmware is still flexible with normal effort. Sometimes after firmware work we have to verify interrupt latencies, but we can do that with a scope - no more cycle counting.

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: coppice on December 30, 2020, 04:06:53 pm
To work in assembler with timing by cycle counting may be some thrill, but not very productive.
If you are inspecting code in great detail to ensure it will unconditionally meet a deadline, allowing for all the caching, and collision resolutions, you may well be doing something productive. If you are trying to get the code to unconditionally make an event happen on an exact machine cycle, you really should look at getting the peripherals to do that timing instead.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 30, 2020, 04:34:30 pm
I know that cycle counting is not very effective and can be quite time consuming for programming. So the programming was relatively slow, but that part is done for the AVR code. For the AVR, there is no caching or wait states that complicate the timing, so it is doable and the simulator in the IDE is really great support for this. The part that may be additional needed for faster conversions or controlling a DMM front-end is to a large part not so time critical. There are windows for some 50 µs or so (most of a µC internal ADC conversion) where the code does not have to be cycle accurate. The still open parts are also the more simple code, like check for command and if found do something simple.

If the hardware provides enough support on a more powerful µC one could use the hardware for the critical parts. In a simple version, just have input capture channels to measure the control outputs. The actual control does not have to be absolutely the same - the main part is that the actual times are measured accurately. There can still be minor effects if the timing varies: very short (e.g. < 1 µs) pulses  can behave a little different from the simple theory as the integrator may not be fully settled. So a fixed length there is desirable.
Using the periphery function to do the critical job can also be quite tricky. Chances are one could get away with PWM control for the run-up part (so the short pulses are well defined). The rundown has variable length parts anyway and simple software control and only HW measurement should be good enough. There can be ways to us the comparator to automatically stop a PWM signal - this is kind of advanced use of the periphery functions which can be just as tricky as ASM programming. One may still be fixed to a certain µC, as the periphery functions can vary. 

Chances are good many different  µCs could be used, with little difference in the result. I selected the AVR, because it is the µC I know best. Someone who knows the MSP430 well could probably get a similar solution with that µC too. On more advanced µCs the cycle accurate run time may not be a practical option. For the AVR hardware I found no way that hardware could directly control the run-down.

Only running at 3.3 V would not be a problem - there is a LVT4053 variant of the switch to work with 3 V control signals. A separate regulator for the switch chip may not be so bad - the HP34401 uses this. The measured effect of supply voltage variations is not so bad, so I think I can get away without it.
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on December 30, 2020, 04:49:42 pm
That's what i meant. If you run code only in interrupt handlers, it can't do cycle precise input/output and that needs to be done by hardware instead. Our MSP430s work like this. For example the hardware will sample waveforms on various ADC inputs and save them to RAM without CPU action. If you want to sample at irregular intervals, you change the timer interval in an interrupt procedure. Can do that once every 10 usec. Wakeup from sleep mode is about 5 usec.

Regards, Dieter

PS: The MSP430 is quiet due to it's simplicity and the low power process. A working solution starts at about 1 mA. That would include a UART running at 57.6 KBd, voltage reference on, ADC sampling continuously and DAC output, plus some CPU activity.
Title: Re: DIY high resolution multi-slope converter
Post by: ogden on December 30, 2020, 07:31:05 pm
Our MSP430s work like this. For example the hardware will sample waveforms on various ADC inputs and save them to RAM without CPU action.

Most ARM MCUs are doing ADC /w DMA ouf of the box today. Usually for lower price compared to msp430.
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on December 30, 2020, 08:08:07 pm
Meanwhile we also have an implementation of our OEM module based on Arm technology.
For somebody coming from AVR an Arm SOC may be a tremendous hurdle, though. I think a typical STM32 datasheet is ten times the size of a MSP430 datasheet. That's why i wanted to mention MSP430 - still a nice product. Its existence has been the foundation of 16 years of production with very little rework. The only major step was the introduction of the extended architecture with 20 bit address registers.
After a module shrink with BGA / LLC two years ago i hope it will sell another 10 years or so. With respect to product life cycle the market for clinical medical equipment is very special.

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: ogden on December 31, 2020, 08:10:28 pm
I think a typical STM32 datasheet is ten times the size of a MSP430 datasheet.

Complex does not necessarily mean "inferior". Usually it is "more capable".

Quote
That's why i wanted to mention MSP430 - still a nice product.

Well, yes. Nice, old 16bit MCU indeed. I has had many excellent engineering "features" like constant register to mention just one. Unfortunately low power, low cost ARM happened :)
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on December 31, 2020, 09:52:21 pm
Can't understand your comments in this context. Using MSP430 may be a path for Kleinstein, who is currently stuck with AVR, while using Arm technology may be unrealistic for him. Of course it's up to him.

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: ogden on December 31, 2020, 10:24:54 pm
Can't understand your comments in this context.

I do not understand what you do not understand. You think all ARM MCU's have complex peripherals as stm32 of your choice? - You are mistaken. There's MSP432 - ARM MCU with peripherals of msp430 and documentation of comparable size/weigth.

Quote
Using MSP430 may be a path for Kleinstein, who is currently stuck with AVR, while using Arm technology may be unrealistic for him. Of course it's up to him.

Exactly. You will not be one deciding which MCU is too complex for Kleinstein and which is not.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 31, 2020, 11:02:51 pm
I am not really stuck with the AVR - it is working. I doubt the INL comes from the µC type - more like a layout question and maybe the clock.

I am thinking to make the ADC work together with the BB3 unit and this would prefer to have an SPI slave interface. Here the AVR can be rather tricky and an STM32 µC would be the obvious choice, as other cards use it.  I already did the step of reading the relevant part of the rather long data-sheet and find a way to couple the timers in a way to do most of the control in hardware.  Chances are good it would work as planed.  The main difference to the outside is an SPI (slave) interface instead of UART.

I want to learn about the STM32 anyway - I even already have a cheap Nucleo board there. The question is a little wether to test the ADC first, or get a board ready before the Chinese new year. with a slight chance that  the SW will not work as planed.

The way I plan to to make the comparator control the PWM outputs synchronously it to link the comparator to an output_compare_CLR signal and than use the output_compare signal internally to trigger another timer that actually does the output and have a 3rd timer use input capture to measure the time when the 2nd timer changes. It still need the program to set up the next step. So the control may add short stop phases and take a few µs longer than the pure software solution with the AVR. The few µs lost would not really matter as the ADC is a little faster and can make up for it. 

More complex periphery makes the change a little slow, but much of the complex part can be just ignored if not used.

Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on January 01, 2021, 12:04:40 pm
Can't understand your comments in this context.

I do not understand what you do not understand. You think all ARM MCU's have complex peripherals as stm32 of your choice? - You are mistaken. There's MSP432 - ARM MCU with peripherals of msp430 and documentation of comparable size/weigth.

Quote
Using MSP430 may be a path for Kleinstein, who is currently stuck with AVR, while using Arm technology may be unrealistic for him. Of course it's up to him.

Exactly. You will not be one deciding which MCU is too complex for Kleinstein and which is not.

Wish you a happy new year and please calm down a little. You can't contribute anything useful in that mood.

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 01, 2021, 05:52:32 pm
My quick INL ist to compare 2 run-up variants, that differ in the exsact timing delays. This should ideally give the same result, but some of the more lokal linearity errors will show up as a difference. It is not a full INL test, but needs littel hardware and can be very sensitive and relatively fast.  The tests do still show an error of a few µV - so something to improve about.

I was trying to find the reason behind the errors by appliing small changes to the circuit (e.g. extra decoupling cap, extra resistors, ...). For a long time the changes had no effect and the curve is hardly changing at all (it changes with a different runup timing of cause, but not that a reasonable slow mode would be perfect). Finally I found a change that does make a difference  -  adding 68 Ohms in the clock line to the µC, but sending the clock from the oscillator still directly to the flipflops for synchronization.  It did not improve things but makes things worse - but at least some change  :phew:.  The curce show the difference before the change at the bottom and two runs with the resistor (the blue one with an additional ground link). Much of the differnce betwenn the upper 2 curves may be a thermal effect - there is a little drift in this type of measurements.   

So it looks like the clock part is somehow responsible for the stabbrun errors.

Now comes the question: how to improve one the clock circuit. I have a old style DIP14 size) canned oscillator with a local 100 nF cap and 39 ohms + a ferrite bead isolation from the 5 V supply.  Adding an extra electrolytic cap to the oscillator supply did not change anything. The clock goes to the µC with short (~10 mm trace) and some 30 mm bodge wire to 2  74HC74 Flipflops. Does one need an extra buffer or added load capacitance ? 
For the next PCB version the oscillator would likely be 3.3 V and smaller and closer to the flipflops and maybe a little longer to the µC.
Title: Re: DIY high resolution multi-slope converter
Post by: ogden on January 01, 2021, 05:59:00 pm
I am not really stuck with the AVR - it is working. I doubt the INL comes from the µC type - more like a layout question and maybe the clock.

INL could come from software-induced jitter. I am not familiar with what and how you are doing things on AVR, but to say obvious - running timing-critical stuff in software is challenging. I would suggest to add some GPIO "logical debug trace" outputs to look at the timing of ADC code using multichannel scope, see if there is any unwanted jitter.

Quote
I want to learn about the STM32 anyway - I even already have a cheap Nucleo board there. The question is a little wether to test the ADC first, or get a board ready before the Chinese new year. with a slight chance that  the SW will not work as planed.

I would suggest to test everyting about timer setup and routing first, only then route board. You can easily run into need to change timer/event routing from inernal to external - using connections between MCU pins, thus need PCB redesing. Stm32 is fine choice BTW mainly because it is diy & maker-popular. Never ever consider MSP432 I mentioned as an "easy peripherals" argument. It was dead before release.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 01, 2021, 06:26:16 pm
I am not really stuck with the AVR - it is working. I doubt the INL comes from the µC type - more like a layout question and maybe the clock.

INL could come from software-induced jitter. I am not familiar with what and how you are doing things on AVR, but to say obvious - running timing-critical stuff in software is challenging. I would suggest to add some GPIO "logical debug trace" outputs to look at the timing of ADC code using multichannel scope, see if there is any unwanted jitter.


The jitter type error is way smaller than a clock cycle. 1 cycle wrong would result in some 50-100 µV error. That would be very visible.  The simulator is really nice to check the run time in the code.
It takes some time, but one gets used to program with a fixed time. The skip instructions are very handy here. 
 
The problem is more subtile - I have seen the running ADC clock (something like CPU clock / 256) to have an effect on jitter, though the effect only gets visible when repeatedly getting in coincidence with reference switching. To reduce the chance for repeated conincidence the loop leght is chosen to be an not so simple number like 102 or 174 cycles, especially not a multiple of 16 and 13.  The external flipflops solved this problem. The current problem is something like a one time 1 ns shift, possible split over some 100 transitons, or some 1 ppm range modulation of the frequency.
Title: Re: DIY high resolution multi-slope converter
Post by: Andreas on January 01, 2021, 06:54:33 pm
The problem is more subtile

Just a (silly) idea: perhaps you should introduce "symmetrically" switching on the port pins.
So when one pin does a rising edge another compensates this by creating a falling edge (on the same port of the controller).

with best regards

Andreas
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 01, 2021, 07:23:12 pm
The problem is more subtile

Just a (silly) idea: perhaps you should introduce "symmetrically" switching on the port pins.
So when one pin does a rising edge another compensates this by creating a falling edge (on the same port of the controller).

with best regards

Andreas

For most of the part (the run-up phase and the fast part of the run-down) the switching is already this way. Both the positive and negative reference are switched active with a positive signal and during run-up it is always either positive or negative. The 3 control bits are on the same port and written together.

1 of the 2 boards has extra flipflops - so the exact timing at the µC does not matter, it is synchronized externally. It is only one stage flipflop, but the setup time looks good: the µC port changes about 3/4 of the clock period before the flipflop switches. So some 45 ns setup time and 15 ns hold time after the edge. So the exact timing at the µC does not matter any more. The flip-flop is bodged on dead bug - so maybe not the best wiring there.
Title: Re: DIY high resolution multi-slope converter
Post by: ogden on January 01, 2021, 07:26:48 pm
The jitter type error is way smaller than a clock cycle. 1 cycle wrong would result in some 50-100 µV error. That would be very visible.

Oh, I see. Then back to your 68 Ohms experiment. - You shall check output waveform of "canned" oscillator you use. It could be source of jitter if clipped sine or just slow dv/dt.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 01, 2021, 08:02:22 pm
On my scope the output from the oscillator looks OK - however not much difference to expect with a 16 MHz clock and 20 MHz scope  :-X.

I agree that the waveform and slope can make a difference. I still wonder how much buffer is inside the cans. If it is just an inverter and crystal, the output may also reactor to capacitive loading.  So maybe I'll try some kind of buffer for the reference - probably 74HC14 now, and some  ..AC14 or similar for the PCB later.
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on January 02, 2021, 02:49:22 am
It kind of sounds like AC coupling / EMI to me, the resistor would increase how much signal can get picked up by the really sensitive integrator inputs,

I'll clean up my layout to support the current public KiCad release, as prasimix was interested, If you could note any significant changes you have made to the design since, I'll update it.
Title: Re: DIY high resolution multi-slope converter
Post by: jbb on January 02, 2021, 05:49:26 am
Probably not it, but I wonder if there might be problems with setup/hold times on the flip flops. If the uC output toggles too close to the clock edge the flip-flop may do odd stuff
Title: Re: DIY high resolution multi-slope converter
Post by: ali_asadzadeh on January 02, 2021, 07:12:30 am
IF you put the project in Github, I can help you with the PCB design in Altium ;)
Title: Re: DIY high resolution multi-slope converter
Post by: RoGeorge on January 02, 2021, 09:09:32 am
Now comes the question: how to improve one the clock circuit. I have a old style DIP14 size) canned oscillator with a local 100 nF cap and 39 ohms + a ferrite bead isolation from the 5 V supply.  Adding an extra electrolytic cap to the oscillator supply did not change anything. The clock goes to the µC with short (~10 mm trace) and some 30 mm bodge wire to 2  74HC74 Flipflops. Does one need an extra buffer or added load capacitance ? 
For the next PCB version the oscillator would likely be 3.3 V and smaller and closer to the flipflops and maybe a little longer to the µC.

When I was learning about about how the phase noise, in time, adds up as a bigger and bigger time jitter, I also compared a few oscillators I had around.  You can estimate the phase noise of the oscillator by looking at the time jitter with an oscilloscope (observe the edge position of the studied clock many, many periods later after the trigger event - I was looking 1..10 seconds later after triggering).

The best in terms of phase noise (so smallest time jitter) of all I had on hand was the Rigol DG4102 DDS/Generator, followed by the internal Quartz+PLL of the DS1054Z (oscilloscope).  Then, it was a SMD canned oscillator from a very old GSM mobile phone, and on the last place out of all Quartz based oscillator were some old canned oscillators from the TTL era (the ones in a 4 pins metal can, about the size of a 14 pins DIL).

Another thing about oscillators, I was "calibrating" an PlutoSDR by generating a 39 MHz square wave with the DDS generator, and looking at the 25th harmonic received with the SDR radio, a waterflow chart centered on 975 MHz.  The SMD canned oscillator from the PlutoSDR was so sensitive that the 975 MHz line was visibly wiggling by simply waving my hand about 30 cm nearby the SDR.  When blowing air on the ascillator, the 975 MHz line was going crazy.

Same with some nRF24L01+ unshielded 2.4GHz modules, a wave of hand nearby the module will show a frequency wiggle in the signal waterfall view.

My point is:
- all Quartz oscillators (including the canned ones) are sensitive to the surroundings.  Always shield them against external fields and against surrounding (variable) capacitive couplings.
- the few square wave canned oscillators I tested from the TTL era were performing the worst in terms of jitter, when compared with more recent SMD canned oscillators, or with good (specified phase noise) canned Quartz oscillators.
- good frequency stability does not necessarily imply good phase noise performance (and thus low time jitter).

Search for low phase noise (or low jitter) Quartz oscillator part models.  They are more expensive than normal ones.

Look in the datasheet for the phase noise of the Quartz canned oscillator you want to use.  The low jitter ones _must_ have the phase noise specified in the datasheet.  If it has no phase noise (or time jitter) guaranteed by the datasheet, then it be very bad at it.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 02, 2021, 10:11:05 am
Probably not it, but I wonder if there might be problems with setup/hold times on the flip flops. If the uC output toggles too close to the clock edge the flip-flop may do odd stuff

As noted before the setup time for the flipflop should be OK: some 45 ns setup and some 15 ns hold time. 74HC74 calls for a minimum of 15 ns setup and 3 ns hold time. So this looks good, like a near perfect phase setting.

I have not checked with the extra resistor. The resistor is expected to delay the clock to the µC and would thus reduce the setup time and increase the hold time.  Getting too close to the limit may let some jitter through even if inside the set-up specs.  A slightly lower clock may help - something like 8-10 MHz clock should be OK for the rest.
 
How the clock is effected is still not clear. I have 3 main suspects: one is capacitive coupling directly to the clock output pin of the oscillator and this may upset the actual oscillator inside. So the upset may cause some frequency modulation.
A 2nd possible way could be the internal state of the µC effecting the input capacitance of the clock pin and this way effecting the load to the oscillator. This may effect the frequency and the delay to the µC. I was hoping the 68 ohms resistor would reduce this effect, but the 68 Ohms are probably to low and the additional damping could be just as bad.
The ground path may introduce transient shifts for the µC and this way effect the load from the µC - however this would be more short time.

So for a new board an extra buffer is definitely a good idea.

The circuit has not really changes much in the last year or so:  I went one small step back at the slope amplifier, using diodes only and no longer the transistor as a diode substitute. With the transistor there was quite some drift in the DC level, so the ADC needed some 30 minutes of warm up before working. This was probably from to much reverse recovery with only the BE junction. It may get better with the collector connected to the base, but I have not tested yet. The diode is also not perfect - it shows a little more drift in the gain for the µC internal gain.
I think I would skip in the option to use the scaled down main reference for the µC internal ADC: The gain of the slope amplifier is not that stable anyway and the supply as reference is good enough.

For the resistors the ORN or MORN resistor array seem to be the best bet now, as they offer 50 K with low noise (comparable to LT5400) - I have not tested (only ordered), but they should work OK. The TC matching may differ, but chances are good to get good enough matching. 
I have tested the already optional ground buffer OP - it works about as good as with the direct ground. The difference is that with the ground buffer one can better use an external reference module as there would be very little load to the reference ground. Some of the candidate OPs for the integrator are available in duals - some, like OPA1678 even as duals only. A dual OP makes sense, as the current is switched between the 2 OP outputs. 

A point may be reducing the µC voltage to some 3.3 V, as the modern crystal oscillators are often only some 3.6 V max.. This would not change much with the board: The 74LV4053 switch would change to a LVT4053 and get a separate regulation - just like in the 34401.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 06, 2021, 01:40:56 pm
So I did some test with clock buffers. I have 2 gates of a 74HC14 as buffers for the clock to the µC and 74HC74 flipflop for synchronization. The buffers have 100 Ohms each at the input to reduce interaction between the buffers.  The chip is dead bug in the bottom of the board with 10 Ohms an 2.2 µF for the supply. The circuit is little similar the the clock buffers at the HP34410.

The result looks a little better (see attached curve), but not that much. The more short scale errors sill stay essentially the same, but as positive aspect the overall curve is more straight.  The curve shows the differences for 3 run-up modes. All with the same frequency, but different lengths (500 ns , 750 ns and 1125 ns) for the fixed phases. The curve with the 500 ns mode has a slope of some 30 µV over the range, that is subtracted, as it would not contribute to INL, but only to the gain.
It is not such a surprise to see a sight effect on the gain, as 500 ns are quite short compared to the settling time as the ADC. So short pulse at that level can behave different.  It is more a surprise that the shorter pulse version looks a little better than the case with sufficient time for settling.

So far for the good side. As a negative effect the extra buffers made the board quite sensitive to the shield and exact position of the cables. This looks like some nasty EMI problem, e.g. spooky RF going to the cables and coming back. In part this may be due to the not so ideal dead big construction - it was a lot better without the buffers. The scope shows quite some crap RF background on the ground and 5 V supply at some places. So this part needs some more attention.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on January 08, 2021, 01:58:54 pm
Happy New Year to everybody here!
AVR vs ARM - the issue with MIPS and ARM is they are not cycle precise so you cannot do the same "precise clock counting" as with an atmegaXXX or a pic16/18/24/30/33.
I always pleaded to introduce a small fgpa (or cpld) into this design.
I made a reciprocal counter with stm32duino and the smallest fpga at that time - the ICE40LP384 (384 cells around 25 i/o, 32pin qfn, low power). You may fit everything inside and it will be clock edge accurate.
You may load the bitstream from the MCU's flash into the fpga easily (a few lines of code).
You may use schematic capture (instead of verilog) if you are more comfortable with cmos/ttl hw.

PS: fyi - atmegas have got 2FF synchronizers at their I/O pins, so there could be a random delay, when you are messing with input edges..
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 08, 2021, 05:03:02 pm
For the ARM version I would use timer hardware to do the part that needs to be cycle accurate, and at least use the timer capture function to measure actual times. The important part is to know the exact times, not even to have it eactly to the cycle as planed.  I allready have quite good idea which timers to use and as far as I understood the manuals it should work in the way that the comparator signal can be used to start a timer and this creates the control signal via PWM. Another timer's capture function would measure the time when things happend. So far it looks like the signal can be all linked internally.
The delay should be about comparable to the AVR version and one would have the option to add a variable delay to replace the trimmer in the current circuit.

The nice point of using a µC is that it has the low grade ADC for the residual charge and the comparator inside. A FPGA solution would need to have an 10-12 bit ADC and comparator extra. The ADC and comparator don't need special performance, but add to the board.  Quite a few tasks would kind of need a kind of state machine in the FPGA and are more suited for a µC.  It is definitely possible to use an FPGA, but not the way for me.

I have tested a ORN resistor netzwork on one of the board:  the noise is lower than with the NOMCA resistors, though not yet so much. However this is only with the 50 K resistors replaced the divider for the reference part is still PTF56 on that board.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 12, 2021, 08:00:17 pm
Replacing the PTF56 resistors for the reference amplification with an ORN array gives the expected improvement in noise. So the noise is now good (some 500-550 nV RMS) for relatively slow modulation. The is still a little 1/f noise left, but not very much.  The board were I have changed the resistors seems to have still some switching related noise., like clock jitter of variations in charge injection. So faster modulation gives more noise.
Title: Re: DIY high resolution multi-slope converter
Post by: ogden on January 12, 2021, 09:31:59 pm
PS: fyi - atmegas have got 2FF synchronizers at their I/O pins, so there could be a random delay, when you are messing with input edges..

Very good point actually. Many MCU's latch input signals with peripheral clock meaning worst case jitter equals 1/Fclk.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 13, 2021, 01:00:09 pm
PS: fyi - atmegas have got 2FF synchronizers at their I/O pins, so there could be a random delay, when you are messing with input edges..

Very good point actually. Many MCU's latch input signals with peripheral clock meaning worst case jitter equals 1/Fclk.

There is no critical timing signal going into the µC - the final last part is from the µC internal ADC and this can correct small errors from the stages before. So noise  / jitter at the comparator does not contribute (at least not much). The AVR internal comparator acltually seems to perform quite good, with less noise than had hoped for. The residual charge ADC shows a rather sharp boundary.

The 2 FF sync seems to the standard inside chips. It can be needed for signals that are asynchonous. If the signal transition comes just a t the wrong time the first FF may go in a metastable state and take a little time to decide. The 2nd FF gives it near 1 clock cycle and only than does the final sync.
I use the FF only to remove jitter - the control-signal from the AVR is allready in sync. So the 1 FF solution should be sufficient, as the timing is in the well defined range.

The weak point seems to be more like coupling troung the supply or ground, so that something effects the oscillator itself.
There may be some resonances in the RF range, that can effect the coupling and it may take only minimal disturbance to shift resonances or change coupling. I currently have no good idea how to measure - nearly looks like one may need a VNA to do DC precision design.
Title: Re: DIY high resolution multi-slope converter
Post by: ogden on January 13, 2021, 08:59:51 pm
The weak point seems to be more like coupling troung the supply or ground, so that something effects the oscillator itself.
It could be, could be not. I would test - disconnect existing oscillator, build external osc powered from AA batteries + cap, no LDO. Connect it through coax + decoupling cap, look for difference if any.
Title: Re: DIY high resolution multi-slope converter
Post by: SilverSolder on January 13, 2021, 09:04:56 pm
[...] nearly looks like one may need a VNA to do DC precision design.

It isn't really a DC design, in fairness?  More an AC/DC design that measures an average DC?
Title: Re: DIY high resolution multi-slope converter
Post by: Castorp on January 13, 2021, 09:53:08 pm
One has to be mentally (and technically) prepared for such exercises  :)

Pure DC is a concept comparable to pure analog audio. AC will find its way in, either as auto-zeroing, or phase noise in adc, or something else. One should be grateful if it's actually measurable. I'm saying it from the perspective of someone who has debugged a Sigma-Delta ADC built of discrete parts... and DC SQUIDs, where the DC response is the result of black magic quantum interference and oscillations happening at many GHz.
Title: Re: DIY high resolution multi-slope converter
Post by: SilverSolder on January 13, 2021, 10:02:38 pm
I had a rude awakening when I swept the output of a well respected linear lab power supply with a spectrum analyzer from 5Hz to 1MHz.  Let's just say that "DC" was present, but it was not alone!  :D

Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 13, 2021, 11:25:08 pm
The ADC circuit is using AC and timing needs to be quite accurate in some cases, so it's not pure DC.
The need to look for AC effects already starts with AZ OPs, where the AC part is not that obvious. Many modern ones include EMI filtering - but I doubt this would avoid all the possible trouble.

Luckily a VNA is no longer very expensive as it used to be. So it is a real option - no longer a funny side note. My hope is to reduce the blind try and error with decoupling.
I am afraid it needs a littel more than the simple layout rules made to avoid excessive EMI emissions.
The funny part was that the initial version of the ADC was working surprisingly good, with the analog part on a bread-board.
Title: Re: DIY high resolution multi-slope converter
Post by: SilverSolder on January 14, 2021, 02:50:57 am
[...]
The funny part was that the initial version of the ADC was working surprisingly good, with the analog part on a bread-board.

That is due to the engineering discipline known as "Black Magic"!   :D
Title: Re: DIY high resolution multi-slope converter
Post by: antintedo on January 18, 2021, 02:48:53 am
I have discovered an interesting noise source, not sure if you are compensating for it already as I'm not following the thread very much.

When measuring small signals, where integrator effective swing (caused only by ADC input) per measurement cycle is less than one runup step worth of voltage, large differences in average integrator voltage can occur between adjacent measurement cycles. A simple runup algorithm will randomly start the conversion in positive or negative direction based on the noisy comparator output. Under the right conditions, there is a good chance the average voltage will stay always positive or always negative for the whole cycle. As a result, assuming the reference sources cause 2V integrator swing per step, the average voltage can randomly flip between -1V and 1V. If a flip occurs, some of the charge stored in the capacitor as DA in the previous cycle will appear in the current cycle, visible as increased noise.

Take a look at this chart of 100 samples. Left and right part of the chart run at constant integrator average voltage, arrows represent 3 events where it flips back and forth. If the input voltage happens to fall in the right spot, the described effect can swamp other noise sources. At the moment this is the most significant noise source in my ADC project when measuring around 0V. Stable chart regions are around 450nV RMS (without AZ), frequent flipping can increase noise to ~800nV RMS. Estimated DA recharge of my capacitor is 150ppm for 20ms charge time.

So there is definitely some room for improvement in the runup algorithm, not only to improve noise at low voltages and during AZ cycles but to keep the DA related INL errors low. The region around -0.5V to 0.5V input is the most chaotic and simple threshold compensation like in old HP meters (34401A R406) does not handle it very well. I will try a software approach next.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 18, 2021, 09:31:11 am
There are a few special cases (the most obvious in the center) where the pattern of the run-up changes quite a lot. I see this as a change in the average integrator voltage. I would not consider this so much a noise problem, but more a problem for the linearity (here more DNL, as a more local problem).
If everything else is working correct the result should not be influenced by the integrator pattern / average voltage so one can use this more local possible linearity problem to also judge about the more general quality and INL effects that are more difficult to measure.  For the test phase it thus makes sense to not use some averaging over different run-up starts to suppress the error, but make sure the result is good despite of the changing patterns.

For the final solution it absolutely makes sense to have different start parts for the runup and this way a kind of dithering to reduce the DNL. I have not implemented this, but only planed as a possibly last step improvement for slower conversions.

In some of the plans I already have a modified feedback (using an extra DG419 switch) in the run-up phase, to also use the signal for the average voltage. This should give a more constant average voltage and less stable run-up patterns. I have not tested this in real world hardware.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 18, 2021, 02:58:38 pm

Take a look at this chart of 100 samples. Left and right part of the chart run at constant integrator average voltage, arrows represent 3 events where it flips back and forth. If the input voltage happens to fall in the right spot, the described effect can swamp other noise sources. At the moment this is the most significant noise source in my ADC project when measuring around 0V. Stable chart regions are around 450nV RMS (without AZ), frequent flipping can increase noise to ~800nV RMS. Estimated DA recharge of my capacitor is 150ppm for 20ms charge time.

The noise level looks really good.  The excursions in the critical region also still look quite good - not as a noise level but as contribution to nonlinearity. This may be the point of worst DNL error.

It is a little odd to measure the noise in the non AZ mode - because of 1/f noise one would normally use the AZ mode anyway in a precision application. So this would be the more relevant number - it may not be so much higher: the difference gives 1.4 times the noise for white noise, but low frequency noise is suppressed.
Even if one has no switching at the input yet, one can use the difference of adjacent samples (the first point of the Allan deviation curve) as an approximation of what the AZ mode would look like.

150 ppm DA  for the capacitor already looks reasonable good. The number depends on both the charging and discharging part, so one usually has at least 2 times involved - so the comparison of just the number is difficult without knowing the exact conditions. I think I got lower DA with a C0G cap from TDK  - they are not even expensive.

I would not be so sure the error at the critical point is only from DA. There are other parasitic effects that change at the same point and can contribute to the error.
Title: Re: DIY high resolution multi-slope converter
Post by: antintedo on January 18, 2021, 04:30:56 pm
This may be the point of worst DNL error.
I agree. I did some preliminary tests with a slowly slewing input voltages as well as theoretical runup simulations and this seems to be the worst region.

Quote
Even if one has no switching at the input yet, one can use the difference of adjacent samples (the first point of the Allan deviation curve) as an approximation of what the AZ mode would look like.
The noise in simulated AZ mode is around 600-650nV rms, perfectly fine. I refrained from implementing AZ until I resolve the runup issue - the discontinuity happens to be right in the spot where AZ measurement is being done at 1PLC. The result is a noise increase up to ~0.9-1.5uV no matter what the input is. The chart above is a measurement of a small voltage at the input. I can keep applying bandaids and shift the problematic region a bit but I don't think it's the correct approach.

Quote
150 ppm DA  for the capacitor already looks reasonable good. The number depends on both the charging and discharging part, so one usually has at least 2 times involved - so the comparison of just the number is difficult without knowing the exact conditions. I think I got lower DA with a C0G cap from TDK  - they are not even expensive.
Thanks for the recommendation - I am using that TDK cap I believe, at least the same series. I can recall the DA testing chart you published - what was the discharge time in your test, same as the charge time? My estimation came from observing runup patterns and their effects, I'm yet to perform standalone DA testing. Selecting a better cap alone might not be enough to mitigate DNL/INL errors related to the average integrator voltage as this DA performance is already close to what the best C0G/teflon caps achieve. It would be a good idea to reduce known and controllable error sources as much as practical.

Quote
I would not be so sure the error at the critical point is only from DA. There are other parasitic effects that change at the same point and can contribute to the error.
Which effects do you have in mind? Offsetting the comparator threshold voltage by 2V or more doesn't seem to reduce the error, so it might not be related to the sign of the integrator average. On the spot I can't think of any other sources that would be equally significant.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 18, 2021, 05:49:33 pm
600-650 nV RMS noise is really good and shows that there is not much 1/f noise. It took my quite some time to reach that noise level. The NOMCA resistors contributed about that much to the noise.

For may DA test I used some 40 ms charge time, a discharge time of some 50-100 µs (more or less the normal rundown, slightly accelerated) and than multiple readings of the reappearing voltage. A first reading sets the effective discharge time and the final reading sets the end time. So from a single curve I can get DA values for different time scales, up to the time spend for charging.
Ideally one has a charge time much longer than the rest and than effective discharge time (til initial reading) and the final reading as 2 times to set the time window. For the ADC the relevant time window should be some 100 µs (rundown time) to 20 ms (conversion time). This is still an approximation as the very fast part depends on the voltage at the end, not the average over the full conversion. So one may separate the DA part to the more fast part up to maybe 2 ms and the slow part from some 2 ms to 20 ms.

The brute force way to reduce the DA error is to increase the frequency of the modulation.
The HP way with the extra part to the comparator only gives a linear correction: not real effect of INL, but a smaller integrator swing and less effect of the DA on the ADC gain and thus still some advantage. The worst case in the center is really hard to correct - my crude idea of adding a fraction of the average voltage to the feedback in the run-up should work for most of the range, but it would not help just in the center - so I am not sure it is worth it.

Another option would be a drastically different form of the run-up, with a more continuous PWM - this would avoid trouble in the center, but may show INL errors when approaching the extremes  (e.g. > 90% or the range) when the pulses get short and the settling is no longer perfect. The simple fixed pattern type feedback is surprisingly resilient against non perfect settling and can thus use a higher modulation frequency.  The continuous PWM feedback can and must be slower. Because of the faster part of the DA it would help to have some waiting time in the run-down, like 1 run-up period.

I have a crude Idea to use the timing of the comparator for control - it needs more math (especially 1 division) and would be tricky though may work with the AVR. Chances are the continuous PWM type FB could give better performance for slow conversions (lower INL and less noise because of less switching related noise) - but it may not be as good for very fast conversions, because of a larger capacitor.

Changing the run-up (e.g. the start) to make sure the critical region is not in the AZ mode (the zero reading is not just at the bad spot) is definitely a good idea. An linearity error of some 1 µV for the worst case part would already be very good, especially if limited to a very small known range. The worst part are those errors that come unexpected.

As additional contributions to the INL I have seen some circuit parts to effect the oscillator circuit. This was especially bad with just a crystal at the µC for the clock (e.g. some 100 µV turn over error). With the canned oscillator it gets much better, though still not perfect.  I still don't know the exact source of the disturbance - it looks like some is via the supply voltage. So supply decoupling / filtering may be very important.
Another possible nasty coupling would be from the comparator to the reference or from the comparator to the integrator. Another nonlinear effect that was visible on the scope was an effect of the load current to the integrator on the OPs response and settling speed - well visible on the scope, but essentially no net effect on the INL with the simple 1 comparator test per period version. Chances are it contributes with the 2 steps per period version.

It does not need much to get an overall effect of 1 µV for the result.
Title: Re: DIY high resolution multi-slope converter
Post by: RandallMcRee on January 19, 2021, 04:47:38 am
What value of integration capacitor does the ADC require?

You should try a polystyrene cap--they have lower DA than polypropylene or C0G. Of course, they are only available in size under 22nF. (Teflon is ridiculously expensive).

If it's a size that I have I will send some along. I acquired a bunch for filter matching. I would be curious.

Randall
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 19, 2021, 10:52:57 am
I currently have 2.2 nF for one board and still 2x2.2 nF in parallel for the other (still from times with 10 K and 20 K resistors at the integrator).  Depending on the frequency for the modulation a smaller cap, like 1-1.5 nF can be sufficient. The frequency is a compromise between the DA caused error that gets larger at low frequency and the switching related errors that get larger at higher frequency. A large cap would also increase the noise for very fast conversions (e.g. < 1 ms integration).

From my tests PP, PS and the usual C0G caps had a similar level of DA, with indeed a slight lead for PS. The TDK brand C0G caps I currently have are something like 5 times lower DA than the other caps I have tested. The DA measurements are in this thread at around post 90.

My test is at the time scale relevant to the ADC - for the usual DA testing at a much longer time scale (e.g. 10 min instead of 20 ms), PS may have a slight advantage over PP, as there are less leakage currents from the surface / potting. The potting part can be a problem especially with the smaller PP ones.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 19, 2021, 08:24:42 pm
With the changes (better decoupling) to the ADC I repeated the difference test for the region around the center of the span, where the sudden change in feedback pattern happens.
The curve showns the diffence between 2 conversions with slightly different feedback mechanism ( different fixed times and slightly different  point in time when the comparator is checked - this effects the exact feedback pattern. The average (low pass filterd and measured after the conversion) integrator voltage is also shown for the 2 modes. Because of the filter there is still some combination from the other mode included.  Because of the assymetry the critical region is not at zero in my case, but alittle off. The points are the average over 50 conversions at 1 PLC. Much of the higher freuqncy noise is the normal ADC noise (~80 nV rms , ~ 500 nV_pp).

There is a little residual linearity error ( the curce shown the difference for the 2 cases), but it does not look like what one expects for the slower part of the DA (should follow the difference in average voltage).
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on January 20, 2021, 12:10:26 am
A crazy idea which is rather an attempt to entertain you a little bit in these times  :D :
2+ years back I made a Mecrisp Forth port (https://github.com/igor-m/UPduino-Mecrisp-Ice-15kB) for the Lattice UP5k fpga part supporting its full BRAM space for the forth dictionary.  Added some features.
The forth's 16bit cpu fits in the half or less of the 5k LUTs.
There is also 128kB of SPRAM still free for use (and more resources as well).
The forth's basic dictionary occupies around the third of the 15kB BRAM.
There is 4MBytes large external flash used for the fpga's bitstream, where you may also store/load many of your forth's dictionaries with a single command off the running forth.
The "stock" cpu includes serial and 8 interrupts and a timer. The multiplication is supported in hw. Thus you have got ~2500 LUTs free for your additional hw. That is a _huge_ amount of potential space for everything related to this converter design.
Programming in forth is much easier compared to asm. 16/32bit math forth words available. Entire forth development runs on-the-chip. Only a terminal is required.
The hw part is done in verilog. There is the open source "icestorm" dev tool and free Lattice's Radiant and IceCube tools available.
The forth machine runs ok at 24MHz clock with that part, and you have ~35 I/Os available. The device is low power. An external 12bit cheapo ADC (ie. an 8pin serial one) could be wired to the fpga easily, the verilog code is easy to do (or available for some ADCs). 
The chip is 7x7mm qfn. There are small pcb modules available as well (called UPduino v1, v2, v3..)..
The author of the Mecrisp Forth has done a port to that Lattice device (supporting full BRAM) as well recently.
Title: Re: DIY high resolution multi-slope converter
Post by: ogden on January 22, 2021, 02:46:19 am
If we look at such kind of options, then I would rather suggest Cypress Psoc 5LP. Maybe even Psoc4 could do the job.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 22, 2021, 10:04:07 am
One is free to use a different device. The demands on the µC/FPGA are not that high:  The code is some 2 kBytes with about half of this actually needed for the ADC - the rest is more for test like difference run-up versions, the DA test and so on. For the ADC even 8 bits would be suffifient and there is no high performance needed for the comparator (a LM339 quality is sufficient - though the AVR internal one seems to perform quite good). The only tricky part is to set or measure the timing during the run-down accurate. So higher porformance µCs that are hard to program cycle accurate would likely need hardware measurement of the timing, which would be enough. The simple  2 cases run-up version (like used in many other meters like 34401, 3458,..) also does not need much computational performance.

A µC instead of a FPGA is interesting as it includes the ADC and comparator - at least initially the projet was more about a simple solution.
My first version used a arduino like board (µC, clock and UART interface) and had the analog part an a bread board. From the hardware side it is still similar and on the simple / cheap side.
Title: Re: DIY high resolution multi-slope converter
Post by: SilverSolder on January 22, 2021, 04:13:55 pm

I like the simple approach with an Arduino (Atmel chip) -  if it does the job, it keeps the concept easily within reach of most engineers and hobbyists.

Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on July 28, 2021, 06:32:40 am
A short up-date:

I noticed that the 74LV4053 chips from Ti and Nexperia are different: the Ti part is relatively low resistance (23 ohms typ) the Nexperial part is considerable higher resistance (old 70 Ohms , new even higher in the datasheet). So the switch chip should be the Ti version, or other manufacturer with low R_on.

Attached is an update to the software - mainly for the PC side. The PC side program is for Freepascal/Lazarus and can also run under Win10 and similar and support USB to UART converters.  The µC part has not changed much, mainly going towards slower modulation (change in the constant xdel and maybe a few updated comments). The µC and PC side have to match in this respect, so both sides are included.

Slower modulation reduces the noise a little (less noise from jitter). The INL is expected to get a little better for the switching effects and a little worse for the capacitor DA (likely the smaller part with a good capacitor).

I am currently working on a version with STM32L0x1 µC and a DVM input section. Except for the µC and some required level translation not much change for the hardware side. But things are slow with poor parts availability  (even MCP6001 were out of stock at mouser  :rant:).
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on August 10, 2021, 07:18:07 pm
Here a short teaser about the front end: The curve shows the discharge of a 1000 pF capacitor connected to the input.
For the start the capacitor is charged to a voltage near the full range.
The slope of the curve is an indication of the input current for the voltmeter.

The observed leakage is quite a bit better then the specs of the parts used. So I may just have been lucky here.
The curve deviates a bit from a simple exponential RC discharge, as there is some extra bias current and also variations in the leakage resistance with time and voltage.
Title: Re: DIY high resolution multi-slope converter
Post by: DeltaSigmaD on August 14, 2021, 12:58:50 pm
Some aspects of theory of high-resolution ADCs here should be discussed.

The leakage current of an integration capacitor is usually no problem for ADCs, e.g. >1 TOhm for a  600V WIMA MKP4. With my measurements, the time constant of such capacitors was much higher than the 8h specified in the data sheet. However, the dielectric absorption of the capacitor is a real problem for a switched-current-integrator topology if the integrator output voltage is evaluated. The dielectric absorption causes a non-linearity as function of capacitor voltage and timing. This effect can be suppressed if the mean value at the capacitor is kept constant while the "timing" is also well-controlled. "Timing" must be explained: the voltage across the capacitor must have no frequency components which have a lower frequency than a frequency where the suppression by a suitable digital lowpass filter is already sufficiently high. A Delta-Sigma technology satisfies this demand directly, and the suppression of the digital filter can be easily better than 120dB.

Common to high-res ADCs discussed here is the first analog current integrator. As far as I know, the differences between the 2 main technologies are :

1. Multiple-slope technique: the integrator output voltage is digitised with an ADC, and a digital algorithm is applied to derive a suitable timing of switch control. This algorithm is essential to avoid that the non-linearity by dielectric absorption is folded down to the final conversion result. The nonlinearity can be reduced by dividing the digitisation in a coarse and fine step. Coarse step: the input signal is integrated, and the integrator output is kept at low absolute voltage by applying relatively large, constant, and extremely reproducible charge portions. The duty cycle of the charge balance pulses must not be >0.5, since additional non-linearity is induced by small pulse pauses. Fine step: a down-scaled reference current is used to measure the remaining charge (for instance a charge-to-time conversion). In most designs the input signal must be disconnected from the first integrator, which point is a considerable disadvantage. The discontinuous integration is equivalent to the input modulation with a square wave with accordingly huge mixing products. The integrator voltage change during the fine step is small enough to obtain low non-linearity.

2. Continuous-time Delta-Sigma technique (CTDS): the output voltage of the first integrator is further integrated by one or more additional analog integrators (integrator chain). The timing of switches is derived from a weighted sum of integrator voltages (analog modulator output). Together with the feedback via the switches a stable mixed analog/digital filter with a well-defined filter function is formed. Higher order filters (3 or more) are prone to latch-up (caused by over-voltage), but it is simple to stop any latch-up. The CTDS-ADC performs a continuous integration of the input signal. Fine conversion steps are not required, high resolution is indirectly derived from timing. The errors of the digitisation step (required to get the switch control signals) are filtered by a third or higher order highpass.

An additional third method shall be proposed, which is a certain combination of the 2 methods above:
3. The input signal is continuously integrated by only one analog integrator. The integrator output is digitised by a fast high-resolution ADC. The ADC output is integrated at least by 2 additional digital integrators, and the latter digital signals are combined to a digital modulator output (third or higher order). Closing the control loop via current switches, the errors of the ADC are highpass filtered, but only with 1st order filtering. The differential linearity of the ADC is essential for obtaining low "noise" at medium frequency. The output result is extracted from the switch control by suitable digital lowpass filtering (4th order or higher). 

It seems that the MS-ADC shown in this forum doesn't follow one of these techniques. A FPGA or uC is used to control the switches. I would be interested on the theory behind this control which is essential for good linearity. Are there publications describing this?
Title: Re: DIY high resolution multi-slope converter
Post by: Echo88 on August 14, 2021, 02:16:56 pm
 :) JFET-Frontend based on a existing known design like 34420A i expect? Or is it something of your own cooking?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on August 14, 2021, 02:25:42 pm
The dielectric absorbtion can cause some INL errors, but with a good grade capacitor the INL problem due to DA is not so extreme. I totally agree that reducing the average voltage in the capacitor is a good idea to suppress the DA effect. This does not have to be perfect and already a moderate improvement (e.g. a factor of 2)  would help. I don't think intrinsic capacitor leakage is a big problem, but it is a possible error source and external leakage, e.g. on the board can add to the capacitor itself. The integration cap is relatively small (e.g. 2.2 nF here) with a MS ADC. So it does not take much boad leakage (100 G range) to cause trouble. A reduced average voltage would also help against this leakage part. Leakage is kind of zero frequency DA.

For the classical muli-slope ADC, as is the HP 3458, 3456, Keithley200x or Fluke8845 as examples there is no auxiliary ADC. The integrator is reset to zero and charge after run-up is measured for the time needed to discharge back to zero. For more resolution 1 or more fine slopes are used.

The ADC in the HP 34401 (Multislope 3, continuous integrating) is continuously integrating like an SD ADC and uses an auxiliiary ADC to measure the charge at the start and stop. So there is no reset and also no fine slope. The feedback during run-up is still from a comparator and with a simple modulation with 2 extreme PWM cases: eihter mainly positve or mainly negative, but no in between cases.

There is a similarity to the old mark-space ADC in the Solartron DMMs: these also use continuous integration, but the feedback is with a more continuous PWM modulation and a much slower modulation. The final charge reading is from just the exact timing for zero crossing. Because of the rather limited resolution these ADCs need a rather long integration (e.g. a few seconds to 50 seconds for a single conversion). These DMMs have relatively high noise (low speed), but good INL despite the simple circuit. The rather accurate feedback avoids DA related errors despite the slow modulation.

The ADC proposed/shown in this thread is a bit in between the classical MS ADC and the HP3401: using a seprate rundown with a slow slope, but no reset and a reading of an auxiliary ADC instead. So it is a bit different.
The modulation in the run-up is the same as with many MS ADC: the 2 extremes and a comparator to decide, as this is the easiest to implement. The ADC started off as a simple solution - it only later turned out that is works quite well.

The sigma delta ADC is kind of similar to the MS-3 with contiuous integration, but usually with additional integrators and also looking at more than just the first and last zero crossing / charge reading to get more information to use in a higher order digital filter. The classical form uses just on/off moduation and a rather fast modulation. More advanced forms may use PWM modulation an an ADC for the feedback. The theoretical background is in the frequency domain. The noise shaping idea works well with an AC signal present and on average over many input voltages. However it does not work that good with constant input signal at some special levels. This causes a rather low frequency signal (idele tone) at the integrator output and quite some swing and still possible DA related or similar problems, so the SD ADC is not immune to the problems. In modern SD chips the idle tones are suppressed with more or less secret / patented techniques, like dithering. I think some of the INL errors I see look quite a bit like the idele tones in a simple SD ADC.

In many DMMs there is an Auto zero cycle around the ADC. So the input signal is not continuous sampled, but there is switching between the input signal an zero. So there is some modulation and possible aliasing from the input. So the additional, relatively short run-down phase (e.g. some 100 µs to 1 ms) does not make a realy different with some thing line 20 ms input and 20 ms zero integration. Switching and initial filter settling also need extra time with some SD ADCs. So there usually still is a dead time in between.

I don't think the DA is really the limiting factor to the INL - faster modulation is a kind of brute force way to reduce DA effects. The weak points are more settling of the integrator input and coupling through the supplies and ground.  Also the resistance of the FET switches is a potential source of INL. A better modulation to avoid DA effects can still be interesting, as it could allow a slower modulation and thus less switching related errors. A more contineous PWM and control from an auxiliary ADC (or the comparator timing) would be an option. This does not really need an extra analog integrator, one could get a good approximation for every cycle.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on August 14, 2021, 04:24:02 pm
:) JFET-Frontend based on a existing known design like 34420A i expect? Or is it something of your own cooking?

The front end is probably a bit similar to the input of the Sigilent SDM3068 and Rigol3065. I don't know the details there, but they only have a +-15 V supply and still get a +-20 V (+ some overrange) with high input impedance. So I expect them to use a similar configuration, though with a differential ADC and an additional divider stage and possibly no gain. With a differential ADC the input configuration is a little more obvious - it is one known way to suppress the common mode signal, when you have floating signal source.

To get the large input range the low side is not fixed at ground but driven to -1/2 the input voltage. So the signals to the ADC are +1/2 the input voltage and -1/2 the input voltage. Instead of the classical signal and zero AZ loop the ADC read +- half the input. The resistors to set the 1/2 factor are not critical as the difference does not depend on the resistors. The input amplifier is an AD8628 Az OP (like in the SDM3068) with a bootstrapped supply and a 2nd OP to make it a compound amplifier and drive the full output range. With an ADC that can read up to about +-12 V this gives a +-24 V range with high input impedance. The switching at the input is kept to a minimum ( 1 JFET (on) and 2 CMOS (off) switches are at the input). The 2nd CMOS switch is not even absolutely needed, but there for a 2nd input. The observed bias level is still a positive surprise and likely with quite some luck. I had expected slightly more (e.g. 20-50 pA range). Input protection is with MOSFETs and PV opto-couplers, a bit like some Keithley (200x) meters to keep resistor noise low, though at the cost of not that perfect a protection.

A nice side effect of the configuration is that 2 ADC readings are summed up and the input is sampled for most of the time (e.g. 2x20 ms out of some 41 ms). This reduces the noise bandwidth for the input and this also applies to the input amplifier for ranges with gain. So the relatively low bias AD8628 OP can give a pretty low noise also for the 2V and 200 mV range. It would not directly compete with the 34420 in the 1 and 10 mV ranges, but still pretty low noise.
Title: Re: DIY high resolution multi-slope converter
Post by: DeltaSigmaD on August 15, 2021, 01:02:07 pm
@Kleinstein:
Thanks for the overview of AD technologies used by DMMs.

One thing I want to comment: it is not too complicated to obtain a continuous-time Delta-Sigma ADC (CTDS) almost free of idle tones. The modulator should have third or better forth order. The first integrator must be sufficiently linear, what can be obtained with a composite amplifier. The open loop gain is typically >300dB. If there is no parasitic feedback, for instance by stray capacitance in the fF range, the latch-up eliminator, or power supply lines, then the idle tones are forced into a higher frequency range where they are suppressed by the digital filter. It might be interesting, at least some of the PREMA DMMs had an only 2nd order modulator, so that idle tones had to be present and the measurement rate for high resolution was very slow compared to competing DMMs. PREMA called the technique not DS - I assume that this was a kind of work-around for american patents active at that time. Due to parasitic coupling, it seems to be very expensive to use CTDS-technique on an integrated circuit (see e.g. "Wide-Bandwidth Single-Bit Continuous-Time-Sigma-Delta-Modulation for Area- and Power-Efficient A/D Conversion with Low Jitter Sensitivity", diss. Sebastian Zeller, Erlangen; "A High Speed/High Linearity Continuous-Time Delta-Sigma Modulator", diss. Chao Chu, University of Ulm).

DSADC ICs are using complicated differential signal processing (and perfect layout) in combination with switched capacitor technology (SCT), so that parasitic coupling e.g. over the substrate - in the ideal case - is canceled. However, SCT is always limited by the kT/C-noise, and in combination with IC technology constraints there is a fundamental noise limit for SCT-DSADCs. Therefore, in recent years new designs were presented which use a SAR-ADC with digital filtering in order to yield a step forward, e.g. the according LTC23xx family.

It is very interesting that there is a remarkable convergence of circuit techniques while coming from the MS- and DS-method sides. The basic differences between the MS- and my DS-approach (started 1 year ago) are:
-  in order to obtain up to 1000 meas./s, the switch PWM frequency is 200 kHz. A fixed PWM frequency is required for a 200:1 overampling ratio. For lower meas. rate and improved linearity, a modified pulse density scheme could be applied (I already used that successfully in an older DS design).
-  the first integrator is a composite design: a very fast discrete JFET amplifier is corrected by a slow, but dc precise JFET-OP. The 2 gains are combined smoothly without causing steep phase slopes or peaks. LTSpice says that the gain is 162 dB at 10Hz, 67dB at 100 kHz, gbp is 68MHz at 1MHz, the transient response to 125uA current pulses is a <250uV <30ns peak at ni-input (I'm curious to test the real PCB). This high bandwidth (or fast settling time) is essential to obtain mean reference currents independent on duty cycle (a weak point of this topology).

I think it makes good sense to develop 2 different designs and to learn from differences. It will take still several months until I can report here.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on August 15, 2021, 03:36:35 pm
A 250 µV and 30 ns pulse at the integrator input sounds really good.
The pulses I see in real hardware and also in the simulation are quite a bit longer (e.g. 200 ns range) and also a bit higher - they are visible at the scope (though using more current (550 µA step) and looking at an intermediate test point with some gain). As long as the switching frequency is fixed there is not much effect. It gets even better when the number of short pulses is well behaved (e.g. about proportional to the voltage). So I think the importance of the integrator speed can be a bit lower than often though.
It also makes a difference if switching is at the integrator input (as I have it) or at the reference side (as many DS ADCs, e.g. the ADC in the KS 3446x). Switching at the integrator adds some extra charge injection pulse and also adds to the capacitance. So the switching pulse is expected to be a little worse, but there are other advantages (e.g better compensation of switch resistance, no need for ref buffering).

200 kHz switching does not sound very fast for the DS ADC. My upper limit is at some 300 kHz, but I prefer slower as long as the DA effect is not yet an issue.

I think the switched capacitor technique has not only the problem with kt/c - that is only slightly worse than the resistor noise in a contineous time integrator.  The SCT also has nonlinear resistance of the MOS switches.  In the calculated noise the resistors are often the largest noise sources. So the kT/C noise part is expected to be similar an important part of the noise. Larger capacitors also need more area and thus cost. Still the chips got quite good with the AD7177. Noise wise it is impressive.
The other point is that the SCT technique has very low offset drift and thus does not need an extra auto-zero switching. With continuous integration this at least gets a bit challenging.  One can use a zero drift OP in the integrator, but there are other source of offset drift (e.g. the resistors).

I think it makes good sense to develop 2 different designs and to learn from differences.
Having 2 "designs" and look at the differences is a nice way to look at INL effects. Already just slightly different modulation is enough to move nonlinear effects to a different voltage and thus create a visible difference from 2 reading with essentially the same HW, but lightly different control. It is a nice and simple (no need for an expensive super linear calibrator) test for my MS design. Chances are this could also work with a DS design, if there is room in the FPGA. Compared to classic INL tests this can be fast and quite sensitive, though not catching all.
Title: Re: DIY high resolution multi-slope converter
Post by: DeltaSigmaD on August 16, 2021, 08:14:40 am
To obtain a higher measurement rate you have to apply a PWM feedback in order to get "many bits each pulse". But if you have a PWM, the switching frequency is limited by the extreme values of the duty cycles which can be allowed for acceptable linearity error. For instance, if you want to have a ADC working range of 15% to 85% of reference voltage range, then you have pulse widths from 750ns to 4.25us with 200kHz PWM frequency. The settling into the ppm range after switching must be completed within these 750ns, otherwise you can forget linearity. I gained experience with this difficult demand. Also if a pulse density method is applied, you must maintain a pulse pause larger than the settling time to a few ppm. A suitable scheme is here for instance >=2us pulse pause for 2us pulse width.

Just today I found that I missed the introduction of the switch TMUX1133 of Texas Instr. (2019). Assuming that I understand the datasheet correctly, this SPDT would be excellent for DS-ADCs - with the exception of the reference voltage limitation to +/-2.5V. This part seems to include a much faster unipolar-->bipolar digital level translation than with 74HC4053. I'm afraid that I have to redesign of my PCB layout to paste this new IC into the ADC circuit hoping that it is worth for the additional work. Unfortunately, the tight dynamic demands exclude alternative switches in the layout (there are no packages common to 74LV4053 and TMUX1133).
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on August 16, 2021, 08:22:40 am
Would be great to create a detailed description of the "MS switching algorithm" of the latest design.
My current understanding is an fpga verilog source for it would be something like 200 lines of code with an SPI interface.
It may even fit into a smallest fpga, like ice40lp384.
That may help with experiments..

PS: Jaromir's MS he published in past is 300 lines verilog long inclusive an uart interface (I would prefer SPI one).
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on August 16, 2021, 12:06:38 pm
My latest version has 3 different run-up versions to choose. The basic one (AFAIK also used similar by Jaromir and in the 34401) is really simple, but still good:
  each period of the run-up has 3 phases:
 1) a phase with the positive reference (e.g. 1 µs)
 2) a phase with a ref. Setting that depends on a single comparator reading (e.g. some 8 µs)
 3) a phase with the negative reference (e.g. 1 µs)
So there are only 2 cases. The time for the comparator reading is a possible parameter, typically at the start of the positive phase. Depending on the integrator speed the short fixed phases can be shorter (e.g. 500 ns for my fastest version). The number of short pulse linear follows the input voltage and this makes it quite forgiving to incomplete settling.

Another version has a 4th phase also depending on another comparator reading. This version is however not as good as settling is more critical.
There is even an old patent (US5200752) on this idea - but it is not really working well. I have kept it only for test purposes.
 
The 3rd version has a slight modification at the transitions. So there is no direct step from positive to negative, but a short (e.g. 500 ns) phase with zero reference in between. The idea here is to reduce the effect of clock jitter and that 2 smaller steps may be less disrupting than 1 large step. As the sequence is fixed, the short zero phase does not need full settling, so the time could be quite fast (like 100 ns). It probably depends on the HW details if this works better or worse.

The more PWM like feedback is a different alternative - I have not tested this, as there is more effort for the feedback control. For the MS ADC the switching frequency can be lower, especially if the feedback control is good. The requirements on settling is higher and thus longer minimum pulse width. So the maximum modulation frequency is also lower.  I would consider PWM like control with some 10 kHz as an alternative to the 2 pattern type modulation with some 100 kHz. With the lower frequency there is more time for settling (e.g. 5-10 µs), but also much closer settling needed. The 3 phase type modulation wants something like 1% settling after 1 µs, while the PWM like method wants some 0.01% so it may need some 5 µs.

The more accurate FB is however demanding for the AVR and programming a complicated math heavy algorithm in ASM (with constant run-time constraints) is tricky. It can be an option for my new version with a more powerful µC with code in C.

The run-down part is for the first part similar to other many MS ADCs:
It starts with the stronger (positive) reference about 300 ns past zero crossing (or a minimum length if the comparator already is the right sign).
The next step is the negative reference, a little past zero corssing.
The 3 rd part is the slow slope with both reference combined, again till zero crossing of the comparator.
Than comes some waiting time with the references off (e.g. 96 µs from start of rundown) and the µC internal ADC is started to sample the residual charge for some 10 µs followed by the actual conversion ( ~ 50 µs).
I currently use an extra ADC reading for the average voltage (not directly relevant for the result) and than a separate ADC reading for the start charge before the start of the next conversion. For fast modes a single residual charge reading could be used for the end and start of the next conversion.

IN addition to the actual conversion one would also need the extra loops for the measurement of the slow slope/reference ratio (still relatively easy) and the auxiliary ADC scale factor (a bit more tricky). So my ADC version with the auxiliary ADC may be a bít longer to implement in a FPGA. It would also need an extra external ADC.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on August 16, 2021, 12:32:42 pm
Just today I found that I missed the introduction of the switch TMUX1133 of Texas Instr. (2019). Assuming that I understand the datasheet correctly, this SPDT would be excellent for DS-ADCs - with the exception of the reference voltage limitation to +/-2.5V. This part seems to include a much faster unipolar-->bipolar digital level translation than with 74HC4053. I'm afraid that I have to redesign of my PCB layout to paste this new IC into the ADC circuit hoping that it is worth for the additional work. Unfortunately, the tight dynamic demands exclude alternative switches in the layout (there are no packages common to 74LV4053 and TMUX1133).

Both the LV4053 and TMUX1133 are limitd to low voltage. So they are OK for switches at the intgrator input, but would limit the ref. voltage to some +-2.5 V. With a low ref voltage settling and the integrator noise get more important. The S/N ratio for the resistor contribution scales with the power - so one would also need a higher current to get the same noise level.  A higher voltage really makes it easier on the amplifiers: less sensitive to noise, less current and less critical settling level.  The downside of switching at the intgrator side is that there is additional kt/c noise from the gate charge. This can be a problem with very fast modulation. So switching on the voltage side gets more attractive with very fast modulation.

I found the LV4053 sufficient low resistance for the 280 µA current level I use, so no real need for even lower R_on. It may be requited if a 2.5 V ref is set and a higher current (e.g. 1 mA) is used.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on August 17, 2021, 07:47:51 am
.. Both the LV4053 and TMUX1133 are limitd to low voltage. So they are OK for switches at the intgrator input, but would limit the ref. voltage to some +-2.5 V. With a low ref voltage settling and the integrator noise get more important. The S/N ratio for the resistor contribution scales with the power - so one would also need a higher current to get the same noise level.  A higher voltage really makes it easier on the amplifiers: less sensitive to noise, less current and less critical settling level.  The downside of switching at the intgrator side is that there is additional kt/c noise from the gate charge. This can be a problem with very fast modulation. So switching on the voltage side gets more attractive with very fast modulation.

I found the LV4053 sufficient low resistance for the 280 µA current level I use, so no real need for even lower R_on. It may be requited if a 2.5 V ref is set and a higher current (e.g. 1 mA) is used.

Imagine a +-5V design, with +-2.5V reference (and 3.3V fpga/mcu logic). What resolution MS would you expect is doable then?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on August 17, 2021, 11:01:08 am
With a +-2.5 V reference I would think of reducing the resistors at the integrator by about a factor of 10 compared to the +-14 V ref case. So maybe 5 K resistors and thus 500 µA reference current.  The resistor noise would go down by a factor of about 3. The noise from the integrator does not get lower and thus gets more important. So overall noise may be lower by a factor of 2, while the ranges is reduces by a factor of 5 to 6.  So the reduction in the voltage would cost a little more than 1 bit in the SNR if slightly worse INL is accepted. If the integrator current is not increased much there is a little more loss in the SNR.  So I would expect something like a 200 nV_rms noise level for the difference of 2 conversions of 20 ms as the noise limit.

The quantization limit could still be very low (e.g. 28 bit level at 20 ms), but less integrator swing would still mean a larger cap and thus more noise for the residual charge. So the cross over where the limit is from the residual charge would move a little to longer integration times (e.g. 2 ms instead of 1 ms).
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on August 22, 2021, 08:35:10 pm
My latest version has 3 different run-up versions to choose. The basic one (AFAIK also used similar by Jaromir and in the 34401) is really simple, but still good:
  each period of the run-up has 3 phases:
 1) a phase with the positive reference (e.g. 1 µs)
 2) a phase with a ref. Setting that depends on a single comparator reading (e.g. some 8 µs)
 3) a phase with the negative reference (e.g. 1 µs)
So there are only 2 cases. ...
As far as i understand this is the description of a PWM DAC running at 100 KHz and with only two pulse widths (10% and 90 %). It is made into an ADC by a sigma-delta type control loop that lets it follow the input signal.
Why does it have to be 100 KHz? PWMs in calibrators usually run at much lower frequencies, like 1 KHz or even below. In the Solartron mark and space scheme it seemed to be about 200 Hz and the PWM is using more different pulse widths to be a little more "agile".

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on August 22, 2021, 10:10:49 pm
The feedback at the integrator is kind of like a 1st order sigma delta converter. So look at the integratgor output and than decide between the 2 cases of e.g. 10% and 90% PWM.

The frequency does not have to be 100 kHz - this number is just an example and roughtly to order of magnitude. Different meters use different frequencies in multi-slope and related converters.  The Solartron and related are at the slow end with some 1 kHz and even a bit below. The Advantest 6581 is also quite slow with some 5 kHz (in slow mode). The Prema custom SD ADC is also relatively slow modulation. AFAIR the Keithlthey 2000 and similar run at some 25 kHz. The 34401 and 3458 use some 330 kHz and the 3446x even more.

The frequency for the modulation is a compromise:  The run-down get longer with a slow modulation as the worst case charge is larger. A slower run-down also means the slow slope gets more important. The noise in the measurement of the final charge gets higher with slow modulation as this requires a larger capacitor and thus less votlage for the same charge. Another factor favoring a high frequency is the error from DA : the more charge is stored in the cap, the larger the DA related error. Fast modulation is kind of the brute force way against DA.

On the other side a fast modulation also produces disadvantages: it needs a faster integrator to allow relative short minimal pulse length. The error from Integrator settling and similar switching related erros gets more important as more cycels sum up. Similar more cycle increases noise from jitter more impartant (scales about with the square root of the frequency).

So far I have tried a frequency from some 20 kHz to 350 kHz. The best choice depends on the integration time: shorter conversion are more sensitive to the final charge noise campared to jitter and a quick rundown is also impartant than.
At 1 PLC, noise wise the best freuquency is relatively low, maybe in the 10 kHz range. At least 40 kHz work a little better than 80 kHz. For the INL error it is hard to tell and I have not tested very much with the lower frequencies. There is a hope to reduce the coupling effects and it does no yet look like there is much DA effect (the good capacitor helps). For improving in the errors it helps to use not the best case first - it is allready hard to measure the INL.


For rather slow modulation more than just the simple feedback can help to reduce the DA error. The Solartron and similar ADCs use a more contiuous PWM and this gives less (my estimate is about 4 x) charge with the same frequency.
The 34401 and similar continuous integrating ADCs need the high frequency also to get enough resolution for 1 PLC conversions. At 1 PLC it is quatization limited as the auxilary ADC is only 10 Bit (though fast). I think the main driving part for the fast modulation in this case was the quatization limit.

The relatively fast simple feedback is about as simple as it gets - after all the whole ADC started as a simple MS-ADC - at least form the HW side it still is simple. There are a few good perfoming parts (OPA1641, LV4053 switches, TDK C0G cap and ORN resistor arrays), but these are not especially expensive. It only later turned out that the simple ADC is also very low noise.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on August 26, 2021, 04:15:39 pm
A short update:

I got the main part of the STM32 based ADC version running. So it looks like the hardware is working like planed. Despite the slightly faster µC the rundown seems to be a little slower, as the comparator in the µc is a bit slow. The software still needs some polish and the part to measure the slow slope and ADC scale.
The software is not yet putting the result together, but this is the relatively easy / predictable part. So I have not yet tested the noise and linearity.


The ADC principle is still the same as with the AVR based version, but the µC and software is different: The AVR version uses program run time and thus ASM code for the timing and was thus not so easy to program. Control of the voltmeter input section is possible, but limited (e.g. 1 byte commands).

The new ARM based version uses more support from the µC internal timer hardware, with a trigger signal from the comparator to the timer and between timers.
As the critical timing is in hardware, the program can be more flexible C code. The hardware control for the ADC is a bit tricky, but the extra parts (communication and input control) are much easier.

The board shown on the photo has the ADC and a voltmeter input stage.
The actual ADC is the part about 50x50 mm down and left from the µC.
The lower left corner is the reference and reference amplification. For the test phase it is still only a LM329, but an upgrade is easy.
The central part with the PTF65/ PTF56 resistors is the main amplifier.
3 of the SO16 chips are for input switching (including parts for 4 wire ohms).
The 4 THT fets are for input protection and switching for the 2 inputs.
The relay is still not soldered in, just there for the picture - it is better to wash the board without the relay.


As there were some questions about the run-up modulation, here is the code for it. It is run inside a an interrupt service routine triggered about half way through the PWM cycle, the exact time does not matter.
Code: [Select]
if (ru_count)
{                                  // normal ru-up step
  if ((COMP2->CSR & COMP_CSR_COMP2VALUE))    // test comparator
  {
TIM2->CCR1 = ru_high;          // PWM registers for the references: positive is active at the end, negative is active at start
TIM2->CCR2 = ru_high;          // switch late -> more negative ref. , uses preload: effective only for next period
  }
  else
  {
TIM2->CCR1 = ru_low;           // switch early on both, more positive phase
TIM2->CCR2 = ru_low;
    ru_sum++;                      // count number of positive phases
  }
  ru_count--;
}
else
 .....   // run-down part

Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on August 26, 2021, 06:44:14 pm
Recently i thought a little about that single bit SD runup phase you use. If i understand right multi-bit SD means using more than two different PWM settings. I think that terminology is about the details of the time division scheme, while the hardware still remains a single bit DAC. Using a multi-bit PWM scheme can reduce the PWM frequency. Avoiding superfluous switching reduces noise and errors.

In order to implement that one would need a link from the ADC input to one of the MCU ADC inputs, probably with a divider to match the input ranges. Isn't that something easy to do? Everything else would be in the firmware. The first step the firmware needs to learn is determine the AC content of the input signal.

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on August 26, 2021, 08:00:04 pm
Yes the way of multi bit feedback (e.g. auxiliary ADC to read the charge and than adjust the PWM ratio of the feedback) is a possibly way. For the STM32 version there is a suitable divider on the board.   This can use a lower frequency and also has to use a lower frequency: the distance between swiching changes and the intergrator really has to be settled before the next switching happens. The run-up periods will usually have a very similar PWM ratio and errors would add up for the periods.

On the other side the simple 2 pattern feedback has only discrete cases for the time between switching and in the simple form the number of critical short phases is essentially (as far as it works with integer numbers) proprotional to the input voltage. So an error would be mainly an error in the gain. The INL error would not add up.

The ideal case (DC signal) residual charge can be pretty small, but the worst case charge can be quite large. An input signal with lots of AC can upset the feedback quite a bit (e.g. worst case jump just after the last reading to adjust PWM). So the worst case run-down would also be slow, even though the average rundown could be OK.

It is relatively easy to implement - though not so easy in ASM with the additional need for a fixed runtime (my AVR version). In C and HW assisted run-down the software is also easy.

I see no real need to look at the AC contend - one can't do much about the worst case anyway .  The system is fixed (asuming the input signal as DC) and this only needs to be tuned once to get a well stable feedback. Quite a lot of this could be done in theory - so just get the math right. The problem would be a bit similar to a PLL.

With the current setup one can also lower the frequency of the 1 bit feedback far enough (e.g. 40 kHz) to have jitter as only a smaller part of the noise. So the possible improvement in the noise is limited (maybe 10-20%). It would be mainly for the INL.
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on August 26, 2021, 09:05:02 pm
Yes this is about gain stability. I think i know how to make an 8 digit stable PWM at 10 KHz, but not at 100 KHz.  I mean a DVM with 7 or 8 digit capability in terms of noise should also have a reference of similar quality and an ADC with stable gain.
As far as i understand, worst case would be an unexpected large input voltage change. Shouldn't there be a lowpass filter? The idea of sampling the input voltage at enough bandwidth would be to capture rapid input change and select a proper next PWM bit to avoid large integrator swing.
Anyway my idea would be that good linearity and gain precision is required for measurements with low AC content, lets say < 1 %, while other measurements with more AC could be a bit more rough. I am pretty much convinced Keysight and others are cheating there, too. Maybe i can test it with the R6581T.

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on August 26, 2021, 10:10:36 pm
The KS meters ( 34401, 3458, 3446x use pretty fast beedback, of > 300kHz). AFAIK there is a little filtering at the input (maybe 1 K sereis resistance and some 100 pF or a bit more) so this would be only a little fitlering. The way the AZ switching is done does not allow for much filtering, as the ADC must be quite fast with starting integration. The 3446x use the same ADC also for the digital RMS, so the use with AC is well tested and not only by accident.

The R6581 is using slow feedback, but AFAIR also not much filtering, a little more when the extra cap is enabled.
The negative effect would be mainly a slightly larger worst case charge and this slower rundown The run-down part is quite slow anyway with the R6581.  The solartron meter may react with higher linearity error if there is added AC, as the integration time may not be a nominal with more AC and this can even happen with mains harmonics normally well surpressed.
Normally one has a low AC contend with precision measurements. The mains hum suppression is usually limited - a mains PLL is tricky and easily adds jitter noise. I have some idea to improve mains hum suppresion even without PLL, but this gets a bit off topic. Some AC background may also act as dithering to reduce the effect of idle tones - so some AC may even improve the INL / DNL.

A few meters have an extra low pass filter, at the input (e.g. the DA1281). The older fluke ones need it because of there odd ADC (recicculating remainder and thus a sampling ADC with relatively little oversampling). A filter at the very input is tricky, as th source impedane has an effect and settling gets slow. A fitler behind an initial amplifier / buffer (e.g. like Keithly 200x, Datron 1281) could be nice, but I only know of one in the K2182.
I have a little input filtering planed as an option, but not much (maybe comparable to the R6581). A larger cap is however possible.

The ADC gain is pretty stable - the small extra settling effect is only a small correction and the settling does not change that much. The main factor for gain stability is the resistor ratio in the arrays - so far a got about 1 ppm/K for the 2 AVR based version and expect a similar one for the new one. With the NOMCA or separate resistors there was some 1/f noise is the gain - kind of random variations in the resistance, like the resistor excess noise.

The new PCB connector for the reference can have a lower noise one later.
A high ADC resolution (7-8 digit) can also have some advantage with only a LM399 ref.: At 1/10 the full scale the demand on the ref. is lower than at full scale and a good ADC still helps.  Another point is that a good ADC enables to use some ACAL way to measure the amplifier / divider gain. If the extra ADC resolution does not come at much extra costs, this could be an option even for a lower cost DMM. For a DIY solution it is also interesting as it can simplify the gain calibration. With low noise of the ADC but a drifting ADC gain, there is the option to do a gain cal step for every conversion: the Keithley K19x do it this way. I can see an improvement when poor quality resistors are used.
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on August 27, 2021, 08:50:01 am
You know the 3458A uses proprietary parts to implement the high PWM frequency. Don't know whether a 4053 of whatever make can compete. Concerning precision with AC presence, when i think about it once more, it's an undefined corner anyway. As you write, with asynchronous AC and integration the result will be more or less random at a % level. So one could just watch out the integrator doesn't clip and forget about nonlinearity due to dielectric absorption.

Thanks again for your comments, i guess after finishing that PWM calibrator with a redundant LM399 14 V reference, i may try some supplement to make it into an ADC. Hope it doesn't take forever.

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on August 27, 2021, 11:09:15 am
The LV4053 switches perform quite well.  With a good quality capacitor, and / or a better FB algorithm the error from DA is not large and one does not need such a high switching frequency. A lower switching frequency reduces the demand on the switches a little, when it comes to jitter and charge injection. The main downside is a slightly longer time for run-down. This would be an issue for high speed (e.g. > 1 kSPS), but not a 1 PLC.

The resistance of the Ti 74LV4053 is low enough to get low square contribution (see some earlier posts in ths thread) even without an extra driven substrate like in the 3458. The jitter is at an ecceptabe level, especially with a slightly slower modulation. A jitter contribution to the noise is visible, but it is not dominant at 100 kHz. I can still reach a noise level a little lower than the 3458.

The HP3458 needs special switches as there are different resistors for the input, refrence and the small slope. However the small slope, is not so critical with the resistance and could get away without a matched restance.   I consider the choice of different resistors (40 K and 50 K) an odd point in the 3458 desig.  3x50 K and +-14 V instead of +-12 V ref would be better in essentially all aspects. Equal resistors for the ref and input are the obvious choice when using of the shelf resistor arrays and they allow to use 3 equal switches for the main ADC switching.

Title: Re: DIY high resolution multi-slope converter
Post by: iMo on August 28, 2021, 09:10:44 am
.. The board shown on the photo has the ADC and a voltmeter input stage.
The board is nice but already more complex (number of parts) than my 34401, it seems..   :D
What is the transformer upper left?
PS: do you plan to put the sw on the Github (for example)?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on August 28, 2021, 12:02:07 pm
The upper left corner is an isolated DCDC converter. The PCB was made for an SN6505B, but this was not available. So I switched to the SN6505A with a lower switching frequency and this needs a slightly larger transformer than originally planed for. Chances are the transformer could be smaller, but this was what I had at hand.

The input part is a bit more complicated.  This starts with using bootstapped supply to the amplifiers to ensure good linearity. The extra part to get a +-20(25) V input range also adds a bit complication.

Just counting the chips is also a bit misleading with the 34401: it has a special input hybrid for the input switching, that replaces several chips if done with standard parts.

The ADC part is acturally quite similar to the 34401:  4053 switching, 74AC74 for synchronization, the 2 OP integrator and using the µC internal ADC for measuring the residual charge. I don't need the extra ASIC, but 2 OPs instead.

I will likely put the SW on github or similar, but that part is not yet finshed.  I just got it sending out the raw data via UART.  The part to measure the slow slope and ADC scale and the control for an AZ cycle are still missing.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 05, 2021, 07:10:48 pm
A short update:

I think I got the software for the STM32 µC so far ready to give useful results for the ADC.
The code part to measure the ratio of the positive and negative reference or better the ration of the difference divided by the sum of the references finally seems to work. The expected result is 43 and the measured ratio was 42.85 - so well in the range of the resistor tolerances. IT looks good enough to not get much DNL error from there.

The hardware is still using only 1 OP in the integrator (the 2nd OP is intentionally not yet populated, to do the test with only 1 OP at the integrator).
As far as I can tell the noise is still a bit higher than with the AVR version, but not much, and the reference filtering is still missing, and no shielding. So there is still a bit improvement expected.  The curve in the attachment shows the difference between the results when using the ADC with 2 slightly different run-up variations (longer and shorter pulse length). The range from -0.4V to -0.3V is the critical range, where the high low ratio is near 50% for the run-up and thus relative large variations in the integrator voltage. The curve shows some variation (some +-8 µV) on top of noise in the 6 µV_pp range. Compared to the AVR based ADC, there is more short range variations, but not much longer range effect.  So far the modulation is relatively slow and the AVR version also has a chance to get lower INL with slower modulation. At least no large INL error so far.

Much of the shorter range effect is similar to the error expected when using only 1 OP at the integrator: The voltage at the input of the integrator is exactly zero bu varies a bit. The integrator has an input impedance of about  1/ (C * GBW* 2*pi) or some 7 Ohms for the 10 MHz OP. This causes less effect of the references in the run-up phase than in the run-down phase, when there is not extra resistor to a fixed signal at the input. The difference is about in the calculated oder of magnitude.  So chances are the 2 nd OP could suppress much of the shorter range errors.
One may be able to compensate numerical too.

From the circuit on the picture I had to remove 1 inverter chip: Murphy got me with exactly the wrong phase of the clock when the IOs at the µC change and I got nasty errors from violating the setup time for the FF. Looks like the STM32L051 changes it's ouputs at the rising slope of an external clock. 
Title: Re: DIY high resolution multi-slope converter
Post by: ali_asadzadeh on September 06, 2021, 07:32:08 am
That's great, when do we expect to see a github repo with the STM32 schematics and code? :-+
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 07, 2021, 08:17:40 pm
I first want to do a few more tests on the INL for the STM32 version.  The code also needs a bit more polish - switching programming languages can be a bit confusing. Currently the output is ASCII text send to a terminal program, with a few cryptic 1 key commands.

The circuit is still very close to the AVR version, mainly a different µC and a flipflop for external resync (I had tried that dead bug with the AVR too) and level shifting (the LV4053 is not perfectly happy with only 3.3 V signals). Level shifting is a bit unconventional with a chip with intermediate supply voltage in between.  Kind of 3.3 V  -> 4 V -> 4.7 V steps for the supply.

So I repeated the test with the 2 nd OP installed. In addition I have a filter cap for the reference voltage. The filter cap give a significant reduction in noise: from some 5-6 µV_pp to some 3 µV_pp with the filter cap. I did remember that the filter cap did help with the AVR version, but I did not remeber that it was so much. So filtering the reference can be worth the effort, as it is relatively easy. Even near zero signal some of the higher frequency (e.g. 50 kHz range) noise of the reference gets through and gets visible. I think some of the commercial DMMs miss on this as it is not that obvious.
 
There are a few small waves still visible in the curve, but the level looks OK for me, at least for now  :-/O.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on September 07, 2021, 09:52:59 pm
A couple of month ago I decided it would be interesting and educational to build one myself.
It is based on the PCB from Rerouter with some minor modifications and uses parts from mouser (see partslist (https://www.mouser.com/ProjectManager/ProjectDetail.aspx?AccessID=e76d4bfca5)).
Eventually I had some spare time to build it, which was straight forward but took quite some time.
Had to modify the FW for 16MHz and different input mux configuration, but then it worked with great help from Kleinstein  :-+

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1264963)

At least kind of :( - there are two major problems, the noise is way too high (~10x - ~10µV StD) and the offset is too high for input short & ref (>10µV).

Did some investigation and it seems the input mux DG408 shows weird behaviour, it overshoots by a decent amount and takes really long to decay, that would explain the offset in the readings.
Filtering with 100nF at the input of the buffer did not change anything significant and isolating the output (NC) of the input mux did not change anything either.
It cannot be charge injection - that would decay quite fast through the low resistance of the mux switches into low impedance GNDS and ref at the mux input.

Regarding the noise I have no idea where to start :-//
At least the reference/Ref+/- shows no visible noise/oscillation on the oscilloscope and no significant differences with external or onboard Ref nor connecting the ops outputs directly to Ref+/-.

With AZ mode there is a problem with the program, the results are just crap & the screen values and recordings are totally different.

Attached some pics, measurements and all data logs (4x 3R, 2x 2R, DA test, Slope K1 K2)
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on September 07, 2021, 09:55:20 pm
Attached the details of input MUX DG408 output overshoot
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 08, 2021, 05:22:45 am
The MUX itself should not create much overshoot. It is possible that the buffer creates some obershoot / slow settling. An amplifier with bootstrapped supply is always a bit tricky with the stability / settling. I would expect the overshoot more from the buffer than the mux.  Anyway for looking at the noise offset drift of the ADC only, one could use the case where the input signal is not connected to the ADC, so the 4053 channel allways off (modus T).

The integrator waveform looks as expected. 

To get low noise, the values for the slow slope (sum) and aux ADC should be reasonable correct.
The slow slope part looks reasonable, though the result of the k1 measurement shown is 20.88 while the other files use 20.90. This is not far off, and should not cause that much different in noise.  The part with K2 seems to be not working. So there seems to be something wrong with the residual charge measurement. The reading of the µC internal ADC look suspiciously constant at 506. So there may be a problem with the last amplification step (MCP6002 ?). So far this is kind of only the classicl MS ADC without a working res. charge measurement for the last bit of resolution.

Most of the mubers in the file are still raw ADC units and not yet scaled to mV.

I don't have much time now, so just a short note.

Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 08, 2021, 01:19:49 pm
It looks a bit, like the ADC channel that is supposed to read the residual ADC reads something different, like the scaled down input voltage or maybe the average integrator voltage.  So there may be a small difference in the plan, like using different ADC channels / pins at the µC.
Which is the schematics for the PCB used ?

An interesting signal to look at is the ouput of the slope amplifier (NE5534). This signal should be about -700mV to 1400 mV near square wave in the runup, and somewhere in the 0 - 400 mV range after the rundown part and slightly, variable ( ~50 mV) between conversions. The trimmer will effect the level where the signal be approximately.

The DA test part seems to be net yet correct/fully implemented in the new Pascal program. I think I never used it with the new program. This part is more like an extra if everything else works.  It can be used to check the cap qualtiy and see leakage currents at the integrator.


Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on September 08, 2021, 07:35:49 pm
The MUX itself should not create much overshoot. It is possible that the buffer creates some obershoot / slow settling. An amplifier with bootstrapped supply is always a bit tricky with the stability / settling. I would expect the overshoot more from the buffer than the mux.  Anyway for looking at the noise offset drift of the ADC only, one could use the case where the input signal is not connected to the ADC, so the 4053 channel allways off (modus T).

Changed MUX DG408 already 2x with no difference.
I have set scale = 6951.95, what do you get as offsets for short and ref?
Someone an idea how to measure those overshoots with µV resolution and sufficient bandwidth? :popcorn:

The integrator waveform looks as expected. 

To get low noise, the values for the slow slope (sum) and aux ADC should be reasonable correct.
The slow slope part looks reasonable, though the result of the k1 measurement shown is 20.88 while the other files use 20.90. This is not far off, and should not cause that much different in noise.  The part with K2 seems to be not working. So there seems to be something wrong with the residual charge measurement. The reading of the µC internal ADC look suspiciously constant at 506. So there may be a problem with the last amplification step (MCP6002 ?). So far this is kind of only the classicl MS ADC without a working res. charge measurement for the last bit of resolution.

It looks a bit, like the ADC channel that is supposed to read the residual ADC reads something different, like the scaled down input voltage or maybe the average integrator voltage.  So there may be a small difference in the plan, like using different ADC channels / pins at the µC.
Which is the schematics for the PCB used ?

An interesting signal to look at is the ouput of the slope amplifier (NE5534). This signal should be about -700mV to 1400 mV near square wave in the runup, and somewhere in the 0 - 400 mV range after the rundown part and slightly, variable ( ~50 mV) between conversions. The trimmer will effect the level where the signal be approximately.

Plot with Slope output & ADC0 @PC0/PIN23:

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1265770)

Both residuals change a bit from cycle to cycle and when adjusting trimmer for null setpoint - runnning program L (Slope K1 K2) K2 changes significantly and in extreme gives out of range.
Schematics are same for ADC0 Edit: difference between old and new schematics from Kleinstein ADC0 -> ADC1, ADC1 unused (U20 not populated).

Rerouter:

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1265776)


Kleinstein:
EDIT: updated to latest version

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1265782)


The DA test part seems to be net yet correct/fully implemented in the new Pascal program. I think I never used it with the new program. This part is more like an extra if everything else works.  It can be used to check the cap qualtiy and see leakage currents at the integrator.

You could not, I added that part to the code to get the numbers - in hope somebody could decrypt it ;):

Code: [Select]
241: {DA-Test 26 chars}
begin
write('DA result: 0x');
das := '0x';
for n := 0 to 25 do
begin
da[n] := ord(Readcom);
write(IntToHex(da[n]),' ');
das := concat(das, IntToHex(da[n]));
end;
writeln('');
writeln(f, das);
}
end;
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on September 08, 2021, 07:51:04 pm
FYI - there is a third schematics by Kleinstein:
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on September 08, 2021, 08:21:11 pm
Could you bypass that input buffer?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 08, 2021, 08:33:18 pm
I get an offset of some 0.5 to 3 µV, for some reason dependent on the channel of the 408 and the speed of the modulation (choose runup with keys P,Q,R,V,W).
I think the higher offset is still from the ADC function not fully working and having the limited resolution in the current configuration. 

I looked at the schematics, and it looks like the AD0 and AD1 signals are swapped: I have the residual charge signal at AD1, rerouter has the resudual charge signal at AD0. So this would need a slight modification to the software.

As far as I have found there are only 3 accesses to the chanel choice of the µC internal ADC (register ADMUX) in the program. So ideally define a 2nd constant for the ADC setting and than use this instead of    "ADMUXval-1" .

Having U20 not yet polulated is good: the program does not yet suport it. In addition the DG419L in the BOM list is wrong - it should be the non L version. The extra switch would be an option to reduce the DA related error - I  kind of doubt this would be very relevant anyway.
Anyway get it running without first.

Measuring the fine settling of the ADC buffer amplifier to the µV range is tricky. I remember seeing artifacts from the scope, when coming out of saturation. The scope may need some time to recover after overload. One may have to measure the settling to the mV range and than assume some exponential decay for the rest.  Chances are it would need some extra clamping with fast diodes (not low leakage as likely in the scope) or anouther switch and than a scope with a good input amplifier and plenty of averaging. There are app- noted on how to measure OP settling. This may use similar techniques. A simulation could give clue on what to about expect.

Alterntively one can try a few different delays with the ADC ciccuit to see how much waiting is actually needed from switching the DG408 to starting the conversion. Usually one does not ned full settling to µV (ppm of the signal) - the missing part to full settling is only a small part of the integration time and thus a little more initial error is allowed.

For the buffer amplifier behind the DG408 a first point to check is of the OPA145 actually gets enough supply voltage (e.g. > 4.8 V). I had a problem with this in my STM32 version - the zener diodes may have quite some tolerance and leakage, so not all the 5.6 V zeners are equal, but normally it should be OK (I had a 5.1 V one that did not work).

p.s. :
the waveforms for the slope amplifier out and MCP6002 out look good - so likely just the ADC channels swapped.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on September 08, 2021, 10:05:10 pm
I looked at the schematics, and it looks like the AD0 and AD1 signals are swapped: I have the residual charge signal at AD1, rerouter has the resudual charge signal at AD0. So this would need a slight modification to the software.

As far as I have found there are only 3 accesses to the chanel choice of the µC internal ADC (register ADMUX) in the program. So ideally define a 2nd constant for the ADC setting and than use this instead of    "ADMUXval-1" .

p.s. :
the waveforms for the slope amplifier out and MCP6002 out look good - so likely just the ADC channels swapped.

First I thought I have a "Knick in der Pupille", but your schematics differ between versions in this point. :palm:
Freely adapted from Bob Pease: My favorite programming language is solder  :-/O:

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1265842)

Attached the results  :-DMM

CU@MM
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on September 08, 2021, 10:29:30 pm
Both adc signals went throught a 4.7K resistor. Would recommend you flip them there :)
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 09, 2021, 05:18:32 am
I would have simply changed the software. The is not really that much to change: just the 3 cases the ADMUX register accessed.

I see the resistors R99 and R36 populated. So the SW should also change to use that refrence. It is nearly the same place where to change the ADC channels, at the  ".equ  ADMUXval " part relatively close to the top
In my program / PCB the ADC still uses the supply as the reference. The extrernal ref should be lower noise - so this time really better change the SW.


Anyway the quick hardware change also has its good side: there are now 2 consecutive readings of essentially the same signal (column 9 and 10 in the file with 3 readings).
These 2 should normally be rather close, with relatively little noise. So there is something a bit noisy around the µC internal ADC.
With the old program the ADC reading of the filttered channel was quite stable. So it is not the µC internal ADC itself, more like some higher frequency noise from the amplifier, maybe not enough settling time for Q2 and Q8 (transistors are a bit slower than diodes)

I have something like 3-5 x the gain and still less noise for consecutive readings.  A small difference in the circuit that I spotted is 22 pf for C15 - I have 47 pF (AVR) / 39 pF (ARM version). Not sure if the this makes a lot of difference, likely not.

Another point may be C37 - I don't have it populated and it may contribute a bit to the noise, though I don't expect that much extra noise.

Still before removing C37, I would have a look at the integrator settling (the LSP6 test point in the plan), just to see how much C37 effects it.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on September 09, 2021, 05:48:34 am
Bodge was just to get it done quick, changing FW would have taken much longer incl. burning.
Will take quite some time before the suggested fixes are made to FW, due to MM and other priorities.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 17, 2021, 06:32:20 pm
a short update:
Most of the input section seems to work, but there is still some odd EMI like effect.  With a short at the input, it makes a difference if there is addional parts connected. This can shift the signal some 10-20 µV. So a bit too much for a real INL test.

I first simple test shows some 5 µV difference when testing a 8 V battery in the 10 V (more conventional) range and the 20 V (kind of diffenrential, so the ADC would see +4 V and -4 V to convert). So this looks a bit like some INL problem (e.g. turn over error) of some kind.
The difference between 2 conversions modes so far looks good, but I have not yet ran a longer test.

With just a short, the input is quite stable and the noise can be really low. Some tweeks with the DCDC part did not help much with the EMI effect, but it did improve the noise. So the noise is now lower than with the AVR based version, rather close to the calculated noise. This may be in parts due to a relatively slow modulation (some 32 kHz).

Attached is a measurement in the change of the ADC gain (read the internal reference back) after turn on. The noise is a little higher than with a short, as the measured reference in not filtered and has a bit of noise that gets effective with the reference to the ADC filtered (some 2 Hz LP).
The numbers on the left are part of the raw data send to the terminal window.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on September 18, 2021, 08:53:34 am
Could you calc the stddev from 800secs up till the end, plz?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 18, 2021, 09:21:55 am
Could you calc the stddev from 800secs up till the end, plz?
The std. dev (RMS noise) for the 800s to 1500s part is 0.045 ppm which is 315 nV for the voltage reading.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on September 18, 2021, 09:59:52 am
For reference - my running stddev of a 399 (10.5V output, 34401A 100PLC) during a peaceful period..
PS: horizontal axis is samples num.
The stddev for entire set of 1544 samples is 890nV.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 18, 2021, 10:59:17 am
Measuring an external reference is a different test. This gives to a large part noise and drift of the external and internal reference.

The ADC gain measurement is reading the same reference used for the ADC. In the simple picture this would not include reference noise and as the noise is the same on the input and reference side of the ADC. There is also essentially no effect of reference drift.
However with filtering of the reference for the ADC (but not for the input) the noise that is filtered out on one side will now becomes visible. This would in this case be to a large part noise at around 25 Hz as part of the off/on modulation in the auto zero cycle. This 25 Hz range part is the reason why so much filtering is at the ADC ref. This especially helps when comparing 2 external signals, like 2 external reference measurements or 2 different RU modes of the same signal, which is used as a test for linearity.

The reference filtering can reduce the noise for normal measurements visibly (e.g. 2 x), though this is not just the 25 Hz part, but also some higher frequency part (e.g. 10-100 kHz). Attached is a curve that shows the effect of adding the filter cap (added while the measurement was running). For some reason I don't know the usual DMMs don't inlcude much reference filtering, though this is a relatively simple way to reduce the noise a little. Usually the effect is smaller than here, because not many combine a very low noise ADC with a relatively noisy reference (LM399).
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on September 18, 2021, 01:29:49 pm
..For some reason I don't know the usual DMMs don't inlcude much reference filtering, though this is a relatively simple way to reduce the noise a little. Usually the effect is smaller than here, because not many combine a very low noise ADC with a relatively noisy reference (LM399).
Something like this (34401A)? Not sure the resistor there would be a good idea - would need adjusting, imho..
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 18, 2021, 02:09:38 pm
The position for possible filtering would be about the right positions. However the 34401 ADC has so much more noise, that one would not notice the difference. So for the 34401 I would not mind the missing fitler. It would be more a point with the Keithley 2000, maybe 2001 and even the 3458.

The ADC in the 34401 can be used to learn how to get low noise - by learning from mistakes. The cicuit has some good aspects (e.g. the switches), but noise wise it also has weak spots. There are 3 major noise sources in the 34401 ADC.
1) the current noise of the OP27 in the intgrator is a mayjor factor for longer integration, like 10 PLC.

2) the noise from the resistors at the integrator. With 100K from the input and 30 K from the references (and the additional 42 K to ground) there is quite some resistor noise. The 100 K give voltage noise and the other provide noise current - so lower resistors are on the bad side there. The resistor ratio also give noise gain (AFAIR 6.6 ) for the voltage noise of the OP27 - with low voltage noise to start with, this noise souces is still relative small. The noise gain may have been a reason why the started with the OP27.

3) Quantization noise: even with the small integration cap and thus fast modulation the resolution for the residual charge is limited. This limits the resolution at 1 PLC and even at 10 PLC is still can contribute a little.  This is kind of a limitation of the system with the reading on the fly.
The get at least acceptable resolution it needs the rather fast modulation.

My hardware is a bit similar (e.g. similar switches and integrator configuration) and addresses these 3 points:
The critical OP at the integrator is a OPA141 / OPA145 or OPA 1641 with essentially no noise current. Though slightly higher voltage noise. 
The resistor ratio at the integrator is 1:1 and thus a noise gain of 2 at the integrator.
With the extra rundown before the residual charge reading the quatization noise is much lower, and no need for very fast modulation in the FB that makes jitter more important.
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on September 18, 2021, 02:16:50 pm
Your previous remark about strange design decisions of high resolution DMMs also applies to using resistor dividers in the reference section of the ADC. When i see the elaborate time division scheme of the ADC in our Advantest R6581T and then look at how they rely on lots of precision resistor networks, that are known to be bad below 1 ppm or so: "It can't be true". As far as i know other 8.5 designs are as bad in this respect.
I was wondering to what level of precision the internal calibration procedures of those meters can determine and later correct shifts of all those resistors in their resistor networks. I mean there are lots of unknowns and internal calibration will suffer from noise as well. I'd prefer a voltmeter without any precision resistor networks.

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 18, 2021, 04:32:37 pm
The resistors for the small slopes are not that critical, especially not for longer conversion as 10 PLC at a piece. The rundown part, especially from the first slow slope part on is only a relatively small part. So the relative error there can be relatively high before it causes trouble. AFAIR the 3458 only needs the resistor ratios to be accurate to some 1% or so (for 10 PLC mode) . The 1 PLC mode would need about 10 times better ressistors to get the same error level. The slower clock gives another factor. I use 1 PLC also for the highest resolution and aim for something like a 0.02 % stable ratio. However I don't need the resistors to be close to a nominal ratio, as I can measure the slope ratio and use the measured ratio and not a nominal ratio. So far the resistors are reasonable stable and no real need to repeat the measurement very often. A measurement together with normal ACAL may be an option, once a year is likely OK too.

AFAIK the R6581 also includes some measurements of the slope ratio. However I don't know if this is for a seft test only and would just give an error message when the error gets to large. In theory they could also use the measured value to use it as a kind off correction term. One does not absolutely need an integer ratio for the reference levels - it just looks funny and needs a little more math, but it still works with arbitrary ratios.

I was also confuse on how they could make sure that the negative reference is exactly opposite to the positive reference. This is critical with the dual slope ADCs like the ICL7135. The trick with the MS ADCs is that the run-up part is in such a way that the relevant reference is the difference between the positive and negative side. The sum of the two has only very little effect and than mainly as an offset. If one does the math right it does not matter if they are not exactly opposite or not. I have them some 5% off.

Many of the resistor ratios in the R6581 are not that critical and would only effect things like the offset or gain. These 2 are corrected with ACAL.
I don't expect the normal ACAL to correct the slope ratios in the ADC. It would only be the overall ADC gain and resistor ratios in the divider, gain stages and the shunts. The ADC gain in the R6581T is reasonable stable. So the resistors seem to be quite good, despite of the not so spectacular case.

With the measurend ADC slopes and ACAL, I don't need any of the resistor ratios to be long time stable. Some should stay within some 1% to get TC compensation, but that is not a very stringent requirement. They can all be measured and use the measured values. So the resistors (except one for current and ohms) are only relevant short time.
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on September 18, 2021, 05:33:24 pm
What do you mean by long term stable? Let's assume one hour after the last ACAL temperature has changed by 1 °C. So the resistors changed, changing the positive and negative ADC gains. By how much depends, but i would assume 1 ppm as a typical gain change.
I mean you just presented the turn-on behavior with an initial drift of 0.6 ppm, if i read the diagram correctly. That's a fantastic result for your DIY meter but undesirable for a 8.5 multimeter, unless we can spend a good fraction of measurement time on ACAL runs, like we spend half the time for Autozero.
Will try and look at the internal calibration data of the R6581T. Maybe one can understand a little bit what they are doing.

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 18, 2021, 06:50:51 pm
I have not measured the TC of the ADC gain for the new ADC. For the 2 AVR based version the gain changes by something like 0.3 to 1 ppm/K, depending on the resistors used and temperature range.
I would consider the warm up after turn on to be some 1-3 K. The circuit is relatively low power (some 1.3 W - most in the half with the ADC) and relatively open, so not very much temperature rise. The matching of the ORN resistors is typical quite good and the other resistor is only used for some 5%. The very first part of the turn on is missing - it just took some time to set up the data recording. So it is 0.6 ppm from 1 min to final, which is still surprisingly good.

With long time stable I mean more than the time between ACAL , maybe more than weeks or so.

To really get 8 digit stability and 7 digit accuracy it needs a relatively stable temperature that is the same with other high end meters too.
The 0.5 to 1 ppm/ K range is what I get from the resistors and for me this is good enough - espeically with still only a LM399 ref.

Some keithley meters spend actually quite some of the time in a kind of ACAL to measure the ADC gain as part of the AZ cycle. The Keithley 19x supposedly do that for every cylce. They may do some averaging over mutiple cycles to reduce noise. I tried this cycle too with the AVR based version and for poor quality resistors at the ADC (e.g. thick film, or low grade thin film) it is really worth it, as the gain changes not only from temperature but also with some random component from resistor excess noise.  AFAIR even with the cheap resistors the gain TC was low (in the < 2 ppm/K range), but there were still variations in the gain, more than expected from the TC.  If really needed, spending half the time in ACAL is a real option. However it may not be a good idea to directly interleave it with the AZ cycle like with the old Keithley meters. At least in the AVR version there was some delayed effect, that could than lead to an INL error.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 19, 2021, 01:19:49 pm
I got a first higher resolution test for the difference of 2 variations of the run-up.  So the same, slowly changing voltage (capacitor charge and discharge) is measured with 2 different versions of the run-up.  Ideally the 2 versions would get the same result, but the details can vary, e.g. due to errors from DA in the integration capacitor and also coupling effects at the clock. One can see the curve (deviations from a stright line) as indication for the more wiggly parts to the INL.  INL from the amplifier, ADC input buffer and thermal effects (e.g. in the resistors) are not included. The main effects included are DA, integrator input settling and unwanted electrical coupling / supply variations.

Compared to a classic INL measurement this test is easy (not much extra instruments needed) and relatively fast (some 3 h for the curve), but still quite sensitive (low noise).

The curve is still not perfect, but allready quite good and better than in the AVR based version. The improvment is not from the different µC, but more with a better layout / better decoupling. Using a slower modulation may also be part of it: so decoupling gets less important but DA gets more important.
The points are the average over 192 conversions or 2x20 ms each.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on September 25, 2021, 10:50:57 am
Put together the major issues with PCB of Rerouter, see the github issue (https://github.com/Rerouter/Multislope-ADC-PCB/issues/1).
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 25, 2021, 01:03:25 pm
I had a quite look at the plan from Rerouter / Midi:

There is no problem to use 4.7 K resistors where 5 K is in the schematics.
The capacitors C28 and C26 should be OK with only 47 nF and likely even 10 nF, which are better available.

The capacitor C31 is quite large, a smaller value, more like 1 nF or maybe even 1 pF may be more suitable as the settling of the butter could be faster, though the difference would be hard to see, but it could be the last missing fraction of a ppm.

When using an OPA145 for U11 the resistor R10 should be smaller, more like 2.2 to 3.3 K. This resistor set the compensation / settling speed of the intgrator. The 6.8 K values is about right it U11 us as fast as U2 (e.g. OPA141 or OPA1641 for U11).

The capacitor C37 is more like optional and not sure if it helps or is more like a problem. I don't have it populated.

The capacitor C15 is quite small at 22 pF. I have 47 pf (AVR version) resp. 39 pF (ARM version) to give a slightly lower BW and betterst stability for the NE5534. I am nor sure this makes a big difference.

For the µC  the mega88 would be OK too (may need to change the include in the ASM file, but that should be about it).

The part around Q5 and Q6 is optional. I had this for tests and it does improve the settling of the integrator seen on the scope (e.g. at LSP6): the settling is no longer depending on the input level. However the overall effect on the INL is no measurable. I now also understand why:
The slow op in the integrator (U11) makes fixed steps following reference switching. For each step it needs a fxied pulse area at the input. The loading of U2 changes the shape of the pulse for the integrator input, but it hardly changes the area. The relavant part for the linearity is the area only and not much the shape of the pulse.  The change in settling with loading of U2 was one of the candidate mechanism for INL, but it looks like it is not a significant one.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on September 25, 2021, 01:59:52 pm
Remarks/suggestions for Rerouters version rev 2 from 22 Mar 2020:
Enable (2) DG408 U7: should have e.g. 1k resistor to 5V for protection Edit: or a diode from 5V to 15V as suggested by Kleinstein
Mark components/areas as optional (e.g. U1 GND buffer, U202 DAC heater, U20 slope switch, C37, Q2 [add JP], U10, R84 JP) -> see former post from Kleinstein
RN201/2/3: footprint hard to solder by hand (0.65mm) -> option for e.g. ORN (1.27mm)
Differential frontend (LTC2057 & OP07) needs some investigation, it happily oscillated (removed it for now)
Ref+/- buffer needs some investigation, measured high ripple on output of OP07 U8/9

Ideas/questions:
C13 4.7µF foil @ LM399 that large useful? (I must admint, that I do not fully understand why it is put there and how it will effect Ref+ and Ref- output)
U8/9 OP07 Ref-Buf dissipation/temperature: bipolar supplies needed? Could have single supply to GND (via separate trace) to cut disssipation in half
ATMEGA as SMD: cheaper & takes less space
(Alternative) SMD footprint(s) for X1 oscillator (TBD if SMD osc has influence on circuit - Kleinstein had bad experience, mechanism not clear [at least to me])
Remove unused/not (yet) supported parts in FW (same as in "Mark components/areas as optional") -> see former post from Kleinstein
RN202/3 integrator input resistor networks: support for one resistor network without bodges (e.g. 1x (M)ORN 4x50k)
Current version needs quite high AC input voltage due to quite high ripple on input caps, removing AC input capability and leave that to the PSU could be an option (lower EMI?)
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 25, 2021, 03:52:21 pm
U9 does not need the -15 V. It can rund from GND and +15 V. No problem there.
U8 needs to operate around 0 V. So in therory it could run from +5 V and some -15 V or whatever is there.

If power / heat is an issue, there is the option to use the more modern OPA202 instead of old classic op07. It has slightly lower noise and lower supply current. If power is an issue there are a few other OPs that could be lower power or use a lower supply.

Normally there should not be ripply on the supply. I have run my board from a 2x18 V transformer with extra series resistors. A 2x15 V transformer should be about right. The Fitler caps may need to get a bit larger though.

C13 is there to filter the reference noise. The size depends on the needs. For just simple tests 470 nF or 1 µF would be good enough. The ciruit work also without the cap, just slightly higher noise. The higher value is mainly to help with the measurements for the linearity. There are 2 main frequency band to fitler out : one is at some 10-100 kHz from the modulation. This easy and would only need a few nF. The second band of interest is at around 25 Hz and maybe extending down to some 10 Hz (for the slower AZ loop with 4 readings). This helps as the normal AZ mode cares about the reference low frequency noise only half the time and thus also reacts to reference noise from the 25 Hz band. This is not really much, but still relatively easy to filter out.  Some 4.7 K and 1 µF with the addiotional gain of nearly 3 gives an cross over frequency of some 10 Hz. With 4.7 µF the cross over is at some 2 Hz and thus already quite some attenuation for the 25 Hz noise part.  It helps mainly with the difference test as this is not sensitive to even lower frequency noise. So the reduction at 25 Hz makes a big difference. For the more normal measurements it can not really replace a lower noise reference. 

I don't think protection is needed for the enable input, but it would not hurt either. The point would be more care with power sequencing or preventing the 5 V to be much higher than the +15 V with a diode.

A SMD oscialltor is definitely possible. However the SMD ones are often 3 - 3.6 V only. Very few run from 5 V. The LV4053 switch is not really happy with a 3.3 V logic signal, though the µC may run with this. In the ARM version I have an addition buffer for the clock signal to reduce the chance to effect the clock from this side and it seems to work well. So a SMD 3 V oscillator and AHCT14 or similar gate as level shifter may be an option and even lower power than the old large oscillator.

The Q2 and Q8 part at the Ne5534 is a bit odd. I had not so great experience with transistors as diode and for the ARM version use 3 diodes that work quite well. The BAS21 seems to be a good compromise between leakage and recovery time for the 1 critical diode. The other 2 can be simple fast ones (e.g. 1N4148 / BAV99). With just 3x 1N4148 the weak point is dirft of the gain (likely temperature dependent leakage). With a transisistor instead of 1 diode the problem with relatively large drift of the DC level / trimmer position, likely from slow recovery. With a relatively low gain for the final amplifier the drift of the DC level may be still acceptable.

Just a crystal is not working well, as the frequency is effected by the µC operation. Modulation of the frequency was a major reason for INL with my AVR version. So good supply filtering at the oscillator is important.

For normal operation just 1x50 K resistor network is OK the integrator. If one wants very good INL there can be a slight advantage from 2x25 K to reduce the self heating effect (1/2 the temperature rise and a chance to get better TC matching) so that the INL contribution would be expected to be reduced to about 1/3. I expect the INL contribution from the resistor array to be in the 0.1 to 0.5 ppm range, depending on the luck with the relative TC.

With the ARM based board I have an input stage relatively similar to the LTC2057 and OP07 part. I also tested this on the bread board - though I don't recall the exact parts (likely MCP6V51 and OP07).  It worked OK, though it needed some tweaks for the case with gain. The OP07 part may need a little more slow down. The filtering caps were a bit tricky. On the BB I had the capacitor equivalent to C21 towads the OP07 output instead of GNDS.  It is not directly related to the ADC, but would give a +-20 V input range with the same noise level and less need for reference filtering.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on September 26, 2021, 11:05:50 am
FW is now changed as suggested by Kleinstein and works (see attachments).
Difference is very small and could even come from closed alu case now (was formerly open).
Currently a beefy linear bench PSU is used, could have some influence.
Next thing is to swap DG408 against new Vishay batch and test ADI/Maxim version (Reneseas could be cheaper option, but n/a at the moment) -> Options now added to mouser BOM (link see earlier post).

Edit:

FW diff to Kleinstein July 28, 2021 (https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/msg3616117/#msg3616117)
Code: [Select]
    Changed mux7 from Nr. 5 (S6 buffered 7V) to Nr. 6 (S7 unbuffered 7V) - there is no buffered 7V awailable
    Refined comments on mux0/1/Temp

--------------------------- Multislope ADC/main.asm ---------------------------
index 5df8705..f61ee93 100644
@@ -91,10 +91,10 @@
 #define portMUX portc            ; MUX port   , rest is input, e.g. ADC inputs
 
 ; mux setting, including fixed part (currently 0)
-#define mux0  8*7               ; Mux channel for 0 V = Nr. 7
-#define mux7  8*5               ; mux channel for 7 V ref = Nr. 5 = buffered 7 V
-#define mux1  8*2               ; mux channel 2 
-#define muxTemp  8*4            ; mux channel for diode (Temp) = Nr. 4
+#define mux0  8*7               ; Mux channel for 0 V = Nr. 7 (S8 = GNDS)
+#define mux7  8*6               ; Mux channel for 7 V ref = Nr. 6 (S7 = unbuffered 7V)
+#define mux1  8*2               ; Mux channel for Input3 = Nr. 2 (S3 = J2 Pin 3)
+#define muxTemp  8*4            ; Mux channel for diode = Nr. 4 (S5 = Temp)
 
 
 .equ  ADcontr  = (1 << aden) +  (1<< ADSC) + (1<<ADIF) + 6     ; ADC enable + start  + Flag (to clear) + clock / 64 (6 -> 125 kHz bei 8 MHz)
 
 
 
     Use external Ref for ATMEGA ADC

--------------------------- Multislope ADC/main.asm ---------------------------
index f61ee93..9e33073 100644
@@ -101,7 +101,7 @@
                                            ; include Interrupt flag to clear flag on start
 .equ  ADcontrStop  =  7        ; Disable ADC, set ADC divider to different values
 
-.equ  ADMUXval = 1 + 64      ;ADC channel (1) + Ref. (64=VCC , 192 = internal , 0 = external)
+.equ  ADMUXval = 1 + 0         ; ADC channel (1) + Ref. (64=VCC , 192 = internal , 0 = external)


    Swap ADC0 and ADC1 (change in rev of Kleinstein)

--------------------------- Multislope ADC/main.asm ---------------------------
index 9e33073..3c51ea1 100644
@@ -96,13 +96,15 @@
 #define mux1  8*2               ; Mux channel for Input3 = Nr. 2 (S3 = J2 Pin 3)
 #define muxTemp  8*4            ; Mux channel for diode = Nr. 4 (S5 = Temp)
 
+; ATMEGA ADC setting ADMUX – ADC Multiplexer Selection Register
+#define REFS 0                  ; Reference Selection Bits (0 = external, 64=VCC , 192 = internal)
+#define ADMUXICh 0 + REFS       ; ATMEGA ADC input channel for integrator charge level - output of U13B (ADC0 = 0 ... ADC7 = 7)
+#define ADMUXSlp 1 + REFS       ; ATMEGA ADC input channel for slope output level - output of U13A (ADC0 = 0 ... ADC7 = 7)
 
 .equ  ADcontr  = (1 << aden) +  (1<< ADSC) + (1<<ADIF) + 6     ; ADC enable + start  + Flag (to clear) + clock / 64 (6 -> 125 kHz bei 8 MHz)
                                            ; include Interrupt flag to clear flag on start
 .equ  ADcontrStop  =  7        ; Disable ADC, set ADC divider to different values
 
-.equ  ADMUXval = 1 + 0         ; ADC channel (1) + Ref. (64=VCC , 192 = internal , 0 = external)
-
                           
 
 start:
@@ -120,7 +122,7 @@ start:
  ; ADC initializing
  ldi temp, ADcontr     ; ADC config mit start
  sts ADCSRA,temp
- ldi temp,  ADMUXval         ; ADC channal + speed +  Ref. . for AVCC ref. (no link needed)
+ ldi temp,  ADMUXICh         ; ADC channal + speed +  Ref. . for AVCC ref. (no link needed)
  sts ADMUX,temp
 
  ldi temp, 1+2         ; Disable digital input for ADC inputs  0 and 1
@@ -955,7 +957,7 @@ mslope2:                  ; call point for just data collection of rundown
  st x+,coutBL
 
  rcall readAD_wait     ; ADC right after rundown;
- ldi temp, ADMUXval -1 ; MUX to auxiliary (for next conversion)
+ ldi temp, ADMUXSlp    ; MUX to auxiliary (for next conversion)
  sts ADMUX,temp
 
     lds temp,par_syncdel  ; extra delay to check delayed effect  (some gets hidden by wait for ADC)
@@ -963,7 +965,7 @@ mslope2:                  ; call point for just data collection of rundown
 
 
  rcall fullADC         ; 2nd reading for simpler data format , make drift visible (e.g. DA)
- ldi temp, ADMUXval    ; MUX to res charge
+ ldi temp, ADMUXICh    ; MUX to res charge
  sts ADMUX,temp
 




    Local uncommitted changes, not checked in to index

--------------------------- Multislope ADC/main.asm ---------------------------
index 3c51ea1..34272bc 100644
@@ -54,7 +54,7 @@
 #define  par_syncdel   0x105    ; delay in ADC sync (for testing)
 #define  par_runup_ver 0x106    ; runup version
 
-#define F_CPU 12000000
+#define F_CPU 16000000          ; Clock frequency of µC - change accordingly
 #define BAUD         9600       ; should be more than about 8000 Baud to transmit data during 20 ms conversion
 #define UBRR_BAUD   ((F_CPU/(16*BAUD))-1)
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 26, 2021, 11:26:14 am
I don't think the DG408 makes a big difference. The point is more with the supply, maybe EMI. One could also try to slow down the NE5534 a little with a larger capacitor.

 The 2 reading cycle may also show less noise, as reading the 7 V ref. can effect the reference a little. So this may add a little more noise. With stable resistors there is usually no real need to also read the reference in every cycle.

It is normal to see more noise with the reference reading, as the reference used for the ADC is filtered quite a bit and the one used to measure has only minimal filtering.

An interesting point could be using the 3 conversion cycle and use the temperature sensor as input. If one than warms up the circuit and lets it cool down, one can see how stable the ADC gain is.

Edit:
Looking at the raw data, there is still quite some change in the residual charge readings that are done direct after another ( end of one conversion and start of the next conversion). I have much lower noise (e.g. +-1 LSB) there. So this points to something like the slope amplifier with noise, too much BW, or maybe the signal not yet settled when the ADC reads it. The clock for the µC internal ADC is also alread boarderline high (250 kHz) with the 16 MHz clock, though I also have a 16 MHz clock on one of my baords.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on September 26, 2021, 09:58:06 pm
Attached 1/2/4/8 PLC, different runup modes and µC ADC slow down by 2, raw data in zip.

Diff µC ADC slow down by 2
Code: [Select]
    Slow down ATMEGA ADC conversion by 2

--------------------------- Multislope ADC/main.asm ---------------------------
index 3c51ea1..4ca82e4 100644
@@ -101,7 +101,7 @@
 #define ADMUXICh 0 + REFS       ; ATMEGA ADC input channel for integrator charge level - output of U13B (ADC0 = 0 ... ADC7 = 7)
 #define ADMUXSlp 1 + REFS       ; ATMEGA ADC input channel for slope output level - output of U13A (ADC0 = 0 ... ADC7 = 7)
 
-.equ  ADcontr  = (1 << aden) +  (1<< ADSC) + (1<<ADIF) + 6     ; ADC enable + start  + Flag (to clear) + clock / 64 (6 -> 125 kHz bei 8 MHz)
+.equ  ADcontr  = (1 << ADEN) +  (1<< ADSC) + (1<<ADIF) + 7     ; ADC enable + start  + Flag (to clear) + ADC Prescaler clock (6 = /64 -> 125 kHz bei 8 MHz, 7 = /128)
                                            ; include Interrupt flag to clear flag on start
 .equ  ADcontrStop  =  7        ; Disable ADC, set ADC divider to different values
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 27, 2021, 08:28:54 am
The noise goes down quite a bit with the longer conversions. So there is not much 1/f noise. Still the noise is not going down all the way like 1/ NPLC, so the residual charge noise is not the only source of noise.

The noise with the runup version "W" (= half the modulation frequency) is lower noise. Case "P" ( doubled frequency) is higher noise. This points to some noise from jitter. I also see this trend.
The version "W" also has a bit different reference reading (not much, but still visible) - this could be due to the resistor ratio after the opa145 in the integrator that slows it down a little too much. So the relative short pulses may behave different.

The offset with a short going down with more PLC is also what I see, though a little higher here. I am not so sure where this comes from. In the 3 reading cycle part of it can come from a delayed effect. The ADC has some kind of memory for the least reading and a little from the last conversion spills over to the next. This could be DA (though the effect is quite large for this) and thermal effects. I still don't fully understand that part.

I have not looked much at the ADC gain ( reading the own ref.) at different PLC settings. It is still a bit surprosing to see so much change. part of the effect could be memory effect.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 27, 2021, 06:22:44 pm
I did a more basic INL test. The idea is to check if the sum of 2 voltages actually reads as the sum. As an example have a 4 and a 5 V source in series and check if 4 + 5 is really 9. In my case the sum is fixed to some 9.4 V and a few different points in between are used.

For the connections this uses the 2 inputs from the DVM board (switching in software) and 1 external mechanical switch. The 2 ref voltages are generated from a single reference source with a divider - same as used with the AVR based board before. In addition to the 3 readings there is 1 more 0 reading.  This way each DVM input and each setting of the switch is used twice and offset errors for the inputs or at the switch should cancel out. With everything stable this test is relatively easy. However there is the complication that the LM399 references used at the DVM and for the external reference circuit are not that stable, but shows popcorn noise. So there can be jumps of some 0.5 ppm at either side. A know the external ref. is a bit noisy.
Trying to see an error in the 0.1 to 1 ppm range such a jump can cause a significant error. The idea is to get cycles of the 4 measurements with stable reference.
With a more manual process (switch and selecting data) brute force averaging is not so easy, but would be a theoretical option with a little more automation.

Attached it the result and a curve showing some raw reading. To get the data all one one screen the data are reduced to a little more than the last 2 digits (the digits further up do sum up correctly). So one can do the math with only looking on the end (100 nV resolution, 20 µV wrap around). The right scale / green symbols give the coarse voltage to see which step.

The known mechanism to cause such an error (voltage contribution proportional to U³) is the self heating of the resistor network from the input current. For comparison I did a short test for the TC of the ADC gain:  heat up the board to some 40 C and than on cool down record the board temperature and ADC gain (read the own ref.). The resulting TC is surprisingly low : ~ 0.4 ppm drop in the gain for some 4 K of temperature drop. I think I got lucky with the resistor this time (the AVR version was more like 0.5 ppm/K). This is still the combination of the 2 resistor networks, so no direct comparison to the nonlinear effect. Testing the networks separately was a bit tricky: the 50 K network showed the same positive sign fitting the sign of the nonlinear effect (more gain with a higher voltage). The 10 K network for the reference did react on temperature gradients too and could show positive and negative effects. There is also some mechanical effect on the resistors. Bending the board can change the ADC gain. So the rel. TC of the 50 K network may be a little larger than the total 0.1 ppm/K gain TC.

First quick turn over tests showed pretty low errors - may have to test a little more patient.
However the results so far not really sum up to the comparision of the 10 V range (more normal 0 and signal AZ mode) and the 20 V range (differential U/2 and -U/2 signal to the ADC). This comparison does show an higher error. So there still seems to be some additional error I don't understand so far.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on September 27, 2021, 09:41:32 pm
Changed slope amp C15 from 22pF to 44pF - no difference in noise with short
Operation from battery - no difference in noise with short

Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on September 28, 2021, 11:48:41 am
Seems I found magic denoise button  :-/O
Noise now down to 100 / 110nVacrms (short / Ref @1PLC & 5min) and values now very close to where they should be:

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1284121)

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1284127)


Magic parameter in Pascal program:
Code: [Select]
xd = 1000*3;                 // extra  delay 3x xdel in ASM code
Went a bit crazy with 1000*3, formerly it was set to 0*3 (Kleinstein seems to use 12*3).
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 28, 2021, 12:55:03 pm
In most of the later data files the raw ADC reading look good, so little residual noise for the 2 consecutive readings (e.g. columns 10 and 17) of the µC internal ADC. The version with the slower ADC clock still seems to have some problem (more noise and the last column is allways 0). So one can probably go back to the faster ADC clock.

The comparison of the noise for the different modulation speeds show quite some difference: for the cases P,Q and W ( double, normal and half the speed) I get noise of 2.9 µV , 2 µV and 1.4 µV for the 3 cases.  So there is quite some noise related to the switching / jitter.

One could try to slow down the modulation, e.g. about to make the slow case W mode like the more normal case, by increasing the xdelay constant in the ASM program (e.g. from 12 to something like 40). The slight higher clock (16 vs 12 MHz) makes it start a bit faster anyway. The integration cap is still large enough for this.
The other point would be trying to find the actual jitter source. The main candidates are the oscillator, the HC74 and the LV4053. This could be the chip itself, or there supply / decoupling. For finding the weak point in the HW side the faster modulation would be an advantage. Normally the HC74 and LV4073 should not be so bad, unless there supply is unstable.  Trouble with the clock decoupling would likely be also visible in the INL test via the difference test (B).

A very short xdelay (in the ASM program) could explain a little, though I still think there is more jitter than it needs to. A values of 1000 is likely way too high and may drive part in saturation. The upper limit is likely at around 63, as there may be some 4xdelay that has to fit in 1 byte. The numbers in the ASM and Pascal program also have to match !

A noise of only 100 nV would be too good to by true. The Johnson noise of the resistors should contribute about 300 nV. The best noise I got with the AVR version was with slow modultion, at some 420 nV. With faster modulation the noise is more like 500 nV. With the ARM version and an slightly slower modulation I get down to 360 nV, which I would consider well good enough and better than hoped for.

edit:
I lookes at the raw data: there is still some scattering in the raw resuslt, just the math for the 7 V ref reading is way of an this than divides down the result so much. WIth the slower ADC clock the reading also show more scatter. The values for the K1 and K2 factor should normally be relatively stable. So no real change needed unless some HW change or very different temperature. If K2 changes with the setting of the trimmer ( no need to be strictly in the center of the ADC range, just avoid hitting the bonds) this would indicate going to high in the residual votlage. I don't exactly know how the 2 transistors behave.

2nd edit:
If the ASM code still has xdelay=12 and the pascal code had 0, than the scaling was wrong (and massive INL/DNL errors) before too. So the actual noise may already be better by about a factor of 2.  So the appearent 1.4 µV noise would be more like 700 nV noise for the slow mode. Still not very good but already useful. One can get a quick check of the linearity by watching a capacitor discharge an error in the size of the runup steps is quite obvious.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on September 28, 2021, 04:07:35 pm
You always need to do compromises, so it´s the button to adjust noise vs. inl  :-DD

Meanwile the board got different XO (cheap Reichelt (https://www.reichelt.de/quarzoszillator-16-00-mhz-oszi-16-000000-p13686.html?&nbc=1)) and noise got a lot worse - around x2 (4µVacrms vs. 2µVacrms prior XO).
Seems the XO has quite high influence on noise - @Kleinstein, which one do you use?

The FW always had delay 12, but missed to change it in Pascal program :palm:
Did comparison of delay 12 & 0 in program with cheap XO and as proposed the noise with delay 0 is around 2x (4µVacrms vs. 8.1µVacrms) - this applies to the diff to the expected value as well (5.3µV vs. 10.3µV for short).

One thing I want to try is to have more delay after DG408 input mux switching, but have no idea where what to change.

The Q2 and Q8 part at the Ne5534 is a bit odd. I had not so great experience with transistors as diode and for the ARM version use 3 diodes that work quite well. The BAS21 seems to be a good compromise between leakage and recovery time for the 1 critical diode. The other 2 can be simple fast ones (e.g. 1N4148 / BAV99). With just 3x 1N4148 the weak point is dirft of the gain (likely temperature dependent leakage). With a transisistor instead of 1 diode the problem with relatively large drift of the DC level / trimmer position, likely from slow recovery. With a relatively low gain for the final amplifier the drift of the DC level may be still acceptable.

BAS21 diodes are in the pipe (with some other components) to try out.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 28, 2021, 05:01:24 pm
For the oscillators I have more like cheap parts. The 12 MHz one was an old recycled part from the 1980s  (AFAIR an old Comodore floppy drive). The 16 MHz one has a NKC mark - no idear were I got it, but should be nothing special.
The ARM Version uses a 8 MHz cheap  (some 1.2 EUR) ECS brand SMD crystal oscillator. I think it has 1 ps jitter specs.  It should be a true quartz crystal and not an PLL chip or MEMS chip. The old large can were usually true crstals, but often quite high in power.

Besides jitter the other point with the oscillator can be how easy it can be effected by supply or ouput load. This was a nasty INL part with my AVR version.

AFAIK the 74HC74 would have Jitter in the 2.5 ps range and AC74  would be at around 1ps. The LV4053 may also have some 1-2 ps of jitter, but I am really not sure here. The expected noise from jitter should be about 28 V * sqrt(2*mod frequency) * jitter.  Something like 3 ps total jitter would still be no big problem if the modulation frequency is not very high.

The delay / length of the runup steps have to match between the 2 programs. If not the INL is really bad, like % range, not just a little.
I think I had tested the 16 MHz board with very fast moduation and thus still had the zero there. Sorry for the confusion.
With the wrong setting the comparison between the speeds is also useless, as the factor is different for the speeds.

There is a bit of compromising noise versus  INL / speed, but it is not so simple:

Faster modulation allows a slightly faster rundown and gives less INL from DA, but more DA from switching artifacts and supply coupling. So there is no simple faster is better. Already for the INL there is some optimum value. Chances are this is about in the 25-100 kHz range, depending how good the decoupling on the PCB is. I don't think one would need a higher frequency just for the DA with the good TDK cap. It looks like the DA contribution is below 0.1 ppm even with only 32 kHz modulation.

Slower modulation can give slightly (goes with the square root) lower noise from jitter, but if very slow also needs a larger integration cap and than more noise for the final charge reading. The current 2.2 nF should be OK down to some 15 kHz or so and the residual charge noise would be an issue mainly below some 1-2 ms integration.

Adjusting the delay for the settling would be with the length of the rundown. This is the
#define rundown_wait   6 
part in the ASM code. This is the main part of the time from the start of rundown to start of ADC reading. The code will add a few more µs. The 3 ADC readings come extra to the rundown.
Title: Re: DIY high resolution multi-slope converter
Post by: Henrik_V on September 29, 2021, 10:59:55 am
Concerning the jitter of the µC: Awoid or check the internal PLL.... usually a cheapo BangBang .....   have seen nice sawtooths in the f_cpuclock/timer over time ..
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on September 29, 2021, 11:32:07 am
The AVR does not have an internal PLL.
The ARM version is not using the PLL. In theory one could use the PLL and higher clock, but it makes things more complicated. The critical ref. signals are synconized externally. This has a small window for the phase where the synchronization does not work ( I had that in my first try and had to remove a inverter to fix) and this is to be avoided. So one would have to somehow measure the phase of the external clock relative to the internal one.
For the AVR at some 10-16 MHz the same signal to the µC and HC74 flipflop is about perfect. For the STM32L051 the same configuration is at the wrong phase, violating the FF setup/hold timing. So one of the clocks needs to be inverted.

The problem is with the modern canned clock oscillators. They look similar, but can be quite different inside:
1) crystal at the right frequency or a simple mutiple and than a simple divider - that is the good way. For the lower frequencies in a small case I would expect a divider.
2) crstal at some frequency and a fractional N PLL chip to output a different frequency. This way they can provide many frequencies from the same HW, but the jitter is usually poor, especially if the PLL is not in a simple ratio.
3) mems oscillator and than maybe a PLL too. I would expect these to be relatively high jitter even without a PLL.
 The mems ones got surprisingly good, but I don't think good enough here.

The good ones are not necessary expensive, just have to read the data-sheet and if in doubt (the DS are not all very specific), use a different type. There are plenty of types to choose from and I don't think the requirements are very high. I would consider 1-2 ps period jitter (down to some 10 kHz) acceptible. AFAIK this should correspont to about -140 dBc phase noise for a 10 kHz frequency offset.
Title: Re: DIY high resolution multi-slope converter
Post by: Andreas on September 29, 2021, 07:30:32 pm
Concerning the jitter of the µC: Awoid or check the internal PLL.... usually a cheapo BangBang .....   have seen nice sawtooths in the f_cpuclock/timer over time ..
Hello,

Sometimes a spreading of frequency is done intentionally to reduce EMI (at least for the small band EMI receiver).
But for precision measurement this or using PLL or R/C oscillator is cruical and leads to increased noise.

with best regards

Andreas
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on October 01, 2021, 09:47:00 pm
Meanwile the board got different XO (cheap Reichelt (https://www.reichelt.de/quarzoszillator-16-00-mhz-oszi-16-000000-p13686.html?&nbc=1)) and noise got a lot worse - around x2 (4µVacrms vs. 2µVacrms prior XO).
Seems the XO has quite high influence on noise - @Kleinstein, which one do you use?

The FW always had delay 12, but missed to change it in Pascal program :palm:
Did comparison of delay 12 & 0 in program with cheap XO and as proposed the noise with delay 0 is around 2x (4µVacrms vs. 8.1µVacrms) - this applies to the diff to the expected value as well (5.3µV vs. 10.3µV for short).

One thing I want to try is to have more delay after DG408 input mux switching, but have no idea where what to change.

The Q2 and Q8 part at the Ne5534 is a bit odd. I had not so great experience with transistors as diode and for the ARM version use 3 diodes that work quite well. The BAS21 seems to be a good compromise between leakage and recovery time for the 1 critical diode. The other 2 can be simple fast ones (e.g. 1N4148 / BAV99). With just 3x 1N4148 the weak point is dirft of the gain (likely temperature dependent leakage). With a transisistor instead of 1 diode the problem with relatively large drift of the DC level / trimmer position, likely from slow recovery. With a relatively low gain for the final amplifier the drift of the DC level may be still acceptable.

BAS21 diodes are in the pipe (with some other components) to try out.

Weird things happening: when the original 16MHz XO was put back, noise stayed at same level as with cheap XO - have to withdraw conclusion that XO has quite high influence on noise  :-BROKE
Have tested couple of things (e.g. another 16MHz XO), but not found the source yet - maybe easier to build second ADC.

The XO is now 12MHz and FW & Pascal program now back to standard settings.
Noise ~1.3µVacrms (short 5min), but noise distribution is not gaussian anymore as it was before.
Swapping Q2 & Q8 against BAS21 & 1N4148 @NE5534 as in Kleinsteins schematic did not change anything significant regarding noise.

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1287142)

Setting high delay after DG408 switching did not change anything significant regarding the offsets.
Seems overshoot and settling on DG408 output is not relevant or measurements give wrong picture  :-//

Code: [Select]
#define rundown_wait 200          ; Length für rundown  (256 cyles = 16 µs units) standard = 6
(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1287148) (https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1287154)


Edit:
Another run, sitting on my bench gave different picture of noise, if just considering values >= 6µV the noise is in the ballpark at 0.53µVacrms:

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1287166)
Title: Re: DIY high resolution multi-slope converter
Post by: Rerouter on October 02, 2021, 04:08:02 am
I'm implementing the suggestions today, out of curiousity, could you try bodging C13 to connect to ground instead of negative ref, to see how it effects things.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 02, 2021, 05:48:24 am
C13 to ground instead of the neg reference would not make a large difference. I had this in my original PCB and it works, but with a slightly higher (some 2.9 times) fitler cross over. The difference is likely only really visible with the testmode for INL with 2 different run-up modes. Especially the noise for reading a short is not significantly effected by noise of the reference. This only needs filtering the really high frequency part like > 10 kHz.

The non gaussian histogram shows some DNL problem. I would guess this could be some error in the constants K1 or K2. Changing from transistors to diodes in the slope amplifier would not directly effect the noise, but it can effect K2 and the main reason for a change is to get a more stable K2 value. The transistor or 2 diode form may also depend slightly on the setting of the trimmer, as the linear range is limited.

It may be worth to now check the linearity first. Without the 2nd group of points the noise looks OK (last graph with only the upper points). So fixing the linearity problem could also improve the noise. Chances are the noise would be also a bit lower with the slower modulation mode.

edit: I looked at the raw data, and it looks like the K1K2 value may be off a little. When the board is still new there is a slight chance that the resistors may still drift a little.

One of the data files includes a result of the K1/K2 meaurement:
# 9/30 22:1 with k0=150 k1=20.9638 k2=150.50
# 3R short XO 12MHz.txt
# 12 Mhz XO, long delay after switching DG408
; k1= 20.963542
; k2= 122.81373 150.326  95.301  SF= 56.55118
So the k2 values should be more like 123  and not 150 as used for the data.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 02, 2021, 07:46:22 am
I took one datafile  (3R short P-Q-R-V-W Runup.txt) and did a correction of the k2 factor from the raw data.  This way kind of cheating - fitting K2 to give the least correlation of the resuadual ADC readings with the result and thus about the lowest noise.

Looking at just the columns 10 or 11 also support the wrong K2 values assumption: the difference from the min to max value is a bit over 120 and no way reaching 150. 

The noise goes down to to 0.78 µV rms over the data, excluding the start with mode "P", that shows more noise
This is a reasonable good noise value. Chances are just taking the slow modulation case (mode W) would give lower noise.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on October 02, 2021, 11:23:24 am
I took one datafile  (3R short P-Q-R-V-W Runup.txt) and did a correction of the k2 factor from the raw data.  This way kind of cheating - fitting K2 to give the least correlation of the resuadual ADC readings with the result and thus about the lowest noise.

Looking at just the columns 10 or 11 also support the wrong K2 values assumption: the difference from the min to max value is a bit over 120 and no way reaching 150. 

The noise goes down to to 0.78 µV rms over the data, excluding the start with mode "P", that shows more noise
This is a reasonable good noise value. Chances are just taking the slow modulation case (mode W) would give lower noise.

My fault, took first K2 reading of console, but in console it is last value, in logs it is first :palm:
Now K1 K2 corrected:
Code: [Select]
     adcclock = 12000000;      // clock on ADC board
     scale = 6951.95;             // Ref voltage in mV 7106.8384
     xd = 12*3;                 // extra  delay 3x xdel in ASM code !!! has to match FW !!!
     k1 =  1.0 / 20.96333;   // measured ref ratios from adjustment - was formerly 20.9638
     k2 =  4.0/ 121.74;  // fine step / adc LSB - was formerly 148.5

Cold start - 50min K1 K2:
(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1287466)

Short/Ref with corrected K1 K2 values after > 1h warmup
(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1287484)(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1287490)

Edit: Quite impressive noise figure already, for a short at 100PLC it translates to <0.5µVpp or 0.05ppmpp - already on par with lowest noise 3458A (Dr. Frank)
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on October 02, 2021, 10:31:17 pm
Some more results and comparison of different PLC settings with mode W runup and different runup versions.
Better cable for UART (sacrificed USB cable) and reduction of possible EMI sources has improved noise further and is now in the ballpark of Kleinsteins AVR version.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 03, 2021, 06:31:44 pm
The noise data now look good. The relatively large difference between the mode P,Q and W shows that the switching is a quite important contribution to the noise. The main switching related noise contributions I know are
1) jitter (clock, 74HC74, LV4053)
2) charge injection variations (from my estimates this should not be very large)
3) maybe variations in the supply to the 4053 chip. Normally the 7805 regulator should be good enough for the supply, so I don't think this would be a major part.  This part should scale linear and not with the square root and would thus effect more fast case even more.
   
For the jitter the oscillator itself should be OK (e.g. < 1 ps) and the LV4053 is kind of fixed. For the flip-flop an AC74 or similar faster chip could improve things a little.

From the software side, there could still be a slight improvement, by using a 3 step run-up mode with 0 in between. This could reduce the effect of jitter a little without going to a lower modulation frequency, as the transitions are split in 2 parts and thus some averaging. Though only a small change from the 4 step version with 0, it's not so easy, as that part of the code is quite optimized and convoluted. As a downside the useful range is reduced a little, but with not too fast a modulation this should not be so bad (like 12.5 to 12.2 V max).

The offset part is still an effect I also don't fully understand. Using the 2 conversion AZ cycle the offset should be nearly gone. A large part of the offset seems to be some delayed effect from the reference reading: A reading of a large signal somehow effects the next conversion as well, like a carry over of some 1 ppm. One mechanism to cause such an effect is DA in the integration capacitor. However this part would get smaller with faster modulation. So the DA should be only a small part (maybe 10%) of the delayed effect. With DA I would also no expect the offset / delayed effect to get so much smaller with longer integration. So this looks more like a short time memory for less than 20ms.

A next part to check would be the linearity.

What software is used to generate the histogram plots ?
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on October 03, 2021, 10:28:15 pm
A next part to check would be the linearity.

What software is used to generate the histogram plots ?

How would you check linearity?
C||R charged to +-10V with Tau 1/2h?
Constant current source discharging C from +10V to -10V (and vice versa)?
For direct comparison 3458A parallel?
Which mode B or C?

All charts are made with Excel, there is histogram plot awailable and add-in "Analyse-Funktionen", the letter were used for this plots in conjunction with bargraph right manually sized to match both plots.

Attached plots reading own reference for different modes and plc with mode W.
Plc plots look strange with quite large jumps of the mean value.
ADC was warmed up for >2h and minor correction of K1&K2 was done before measurements.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 04, 2021, 05:37:38 am
There are different methods to check linearity, that check different aspects.
One is direct comparison to 3458, or a good calibrator if available. This usually checks a moderate number of points, like some 50.

With a less capable external source one can do the classic turn over test and with a dual external source also a sum test - this are usually only few points, testing the soft INL (lower order polynom contributions). These test would use modes A and / or C.

The test with C||R  and mode B is a special for this ADC. It tests more the wiggly part of the INL (more hard INL) exculaing some sources. This test check a relatively large number of points and low noise.  Instead of the R parallel to the cap a current souce would be good (more even coverage of the points).

The test with mode B is relatively simple, the main range of interest is from about -4 V to -0.1 V. With C||R one can as well cover the -10 to -0.1 V as the higher voltage don't take much time. One can have the resistor to a different voltage (e.g. +-15) too, to get a slightly more even covering.

Full linearity testing would need more than 1 test.

The refrence readings show more noise, as there is additional reference noise, especially from the 2.5 to 10 Hz range. So it is normal to have more noise there and the ADC itself is only relatively small part.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on October 05, 2021, 06:55:26 am
How to get the 2 readings in V from logged data in mode B?

Samples taken from preliminary test mode B runup W:
Code: [Select]
157945.754 153131.211 4814.537    -33 591 412 352 768 694 695 1221 524 340 867 723 690
 157945.759 153131.240 4814.533    -15 591 412 352 768 715 719 1221 524 340 867 725 710
 157945.762 153131.196 4814.544    -43 591 412 352 768 715 721 1221 524 340 867 753 710
 157945.738 153131.206 4814.538     85 591 412 352 768 758 749 1221 528 344 867 668 753
 157945.735 153131.191 4814.537    -46 591 412 352 768 676 665 1221 524 340 867 718 672
 157945.735 153131.179 4814.550     68 591 412 352 768 727 716 1221 528 344 867 655 723
 157945.713 153131.175 4814.536    -56 591 412 352 768 677 652 1221 524 340 867 728 672
 157945.727 153131.202 4814.539     83 591 412 352 768 740 724 1221 528 344 867 651 734
 157945.745 153131.158 4814.564    -67 591 412 352 768 652 647 1221 524 340 867 715 648
 157945.723 153131.160 4814.564     56 591 412 352 768 731 712 1221 528 344 867 671 727
 157945.710 153131.174 4814.543    -57 591 412 352 768 695 668 1221 524 340 867 747 690

Did you use interpolation for mode B to match readings in time for the different runup versions?
Otherwise the differences between two readings depend significant on slope of input voltage.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 05, 2021, 08:25:03 am
In the 2 readings loop there is averaging in time used for the 2nd reading. For the normal AZ readings (mode A) this means using the zero reading before and after the input and a slightly reduced noise. This suppresses the effect of the slope relatively good. Otherwise the rate of change is indeed a major problem. The data in the file are the first reading (selected run-up mode) and the 2nd reading (mode Q).
The 3rd column is the difference and thus the relevant result. The numbers are still in internal units, that are 1 clock cycle of the positive reference. So they still need to be scales with the scale factor (some 56 µV/unit for a 12 MHz clock).

The calculation only includes an approximate zero point, as for the normal modes there is always a difference and an offset does not matter. This leads to some offset to the difference of 2 run-up cases. So it is normal that the numbers are not so close to zero. Doing the full math to get the same zero point for both modes is tricky (needs more constants to describe the run-up versions). I use this with my ARM version and than use the difference of 2 run-up modes to get the slow slope ratio. It is not as exact and fast, but good enough.

The difference test works best with run-up modes that use the same modulation frequency (e.g. R,V,S,U). With a different modulation frequency there is some additional drift from changes in the charge injection (e.g if the 5 V supply drifts).
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on October 05, 2021, 04:49:10 pm
Result of INL test with mode B and runup V (vs Q).
Input1 with 33mF and 330k to -15V for discharge 6.5 .. -0.7V.

Scale of raw dU (3rd row in raw data (https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1290493)):
Code: [Select]
dU = RAWdU * 56µV + 840504µV
(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1290487)
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 05, 2021, 05:18:40 pm
The test resuslt looks quite good. The curve is quite linear, with most of the time less than 1 µV deviation from a straigth line. The slope kind of reprensts an effect from the no perfect settling in the short pulses. There is not much slope, especially for the integrator with the relatively slow OPA145.
There is a little "resonance" like structure near -0.7 V and 3 V. This are likely the regions close to stable simple run-up patterns.
So things look good and there is a good chance to get low INL. (e.g. 0.1 ppm FS range for the hard INL part).
The other polarity could complete the picture and allow a more meaningful line to subtract.

My AVR based version was not that good, especially not the original PCB.

With 2 resistors arrays in series the u³ part is expected to be good as well (should give about a factor 2.8 less thermal effect). There is still some randomness in how good the resistors are matched.

The u² part (measured from the turn over error) is to a large parte depending on the LV4053 on resistance - It should normally be OK.

I did a crude  test on the linearity of my ARM based version, including the front end: The amplifier gain and divider ratio measure for a postive and negative internal test voltage are reasonable close (some 0.6 ppm off).
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on October 05, 2021, 10:19:20 pm
The test resuslt looks quite good. The curve is quite linear, with most of the time less than 1 µV deviation from a straigth line. The slope kind of reprensts an effect from the no perfect settling in the short pulses. There is not much slope, especially for the integrator with the relatively slow OPA145.
There is a little "resonance" like structure near -0.7 V and 3 V. This are likely the regions close to stable simple run-up patterns.
So things look good and there is a good chance to get low INL. (e.g. 0.1 ppm FS range for the hard INL part).
The other polarity could complete the picture and allow a more meaningful line to subtract.

Resonance @-0.7V is of diode with lots of datapoints in there (~1/3), reduced them in the following plots.
Resonance @-0.5V is real and there in both slopes.

Result of INL test with mode B and runup V (vs Q).
Input1 with 33mF and 330k to +15V for discharge -9 .. +0.2V (blue) and to -15V for 6.5 .. -0.7V (orange).

Scale of raw dU (3rd row in raw data (https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1290754)):
Code: [Select]
dU = RAWdU * 56µV + 840504µV
(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1290742)
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 06, 2021, 08:08:33 am
The center part looks good.

The part below -7 V however is unusual. I have not seen a large change in this range, in my measurements that range was OK and only some effect very close to the end of range (with ru-version P this can be a bit below 10 V as with faster modulation the useful range gets a little smaller).
I don't expect the integrator voltage to reach extra high values - the 2.2 nF integration cap should be well large enough and it also support the slower modulation. The more gradual bend at some -7 V is also a bit different from what I normally saw (jumps, "resonances" and more piecewise linear).

If the circuit is still with the "original" R10 = 6.8 K the settling of the integrator is still quite slow. The slower OPA145 would more like a smaller value for R10 (e.g. 4.7 K or 3.3 K) to speed up the settling. With warm up the speed of the OPA145 may change, and this can than effect the settling and indirectly the ADC gain a little, especially for the faster runup mode Q. So the bend may be a warm up effect - though ususally this should be smaller for 2 RU modes with the same frequency.  The settling has more effect on the modes with higher frequency and shorter pulses - so the later used case (e.g. V or W) are likely the better ones in the comparison. It is mainly the DA related error that gets worse with slower modulation.

One could test temperature effect with a measurement of the ADC gain during warm up or cool down. This is an interesting point anyway to see how stable the gain is. One can use the 3 reading cycle C and chose the temperature measurement diode as input source. So the readings are zero, internal ref and the temperature. One gets the ADC gain and temperature in a single file. Normally the main part of the change in ADC gain is from the resistor relative TC, but there can also be a little contribution from incomplete settling. The settling part would give a different temperature dependence for different RU mode (e.g. P and W), while the resistor part should be the same.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on October 07, 2021, 07:23:33 pm
Measurements of INL with slope on input reversed from 0 ... +-10V.
Indeed the bend in the previous measurement is due to warm up (lid opened for short time), the slope is nearly linear.
The small downward tendence >10V keeps going, it was cropped due to range limit for one runup version.

If the circuit is still with the "original" R10 = 6.8 K the settling of the integrator is still quite slow. The slower OPA145 would more like a smaller value for R10 (e.g. 4.7 K or 3.3 K) to speed up the settling. With warm up the speed of the OPA145 may change, and this can than effect the settling and indirectly the ADC gain a little, especially for the faster runup mode Q. So the bend may be a warm up effect - though ususally this should be smaller for 2 RU modes with the same frequency.  The settling has more effect on the modes with higher frequency and shorter pulses - so the later used case (e.g. V or W) are likely the better ones in the comparison. It is mainly the DA related error that gets worse with slower modulation.


R10 is 6.8k, which op amp and value for R10 do you use in your circuits?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 07, 2021, 08:12:48 pm
With my ADC boards I have OPA1641 and OPA141. The resistors are 4.99 K and 6.8 K one the other board. The 4.99 K are a bit on the low side ( more ringing).
I had a OPA145 there before, but had to exchange it due to defect (some stupid error from my side - I don't remember the details).

The OPA145 is slower and could use something like 3.3 or 3.9 K.  So a 2nd 6.8 K ( or 10 K) in parallel (on top) would be an option. One could look at the testpoint at the OPA145 output to see the settling. There should be a kind of square wave like signal. In the current form likely more overdamped and a bit slow step. A smaller resistor should speed up the settling. Some ringing is OK, but it should not be very much. With a reduced resistor the OPA145 should be about as good as the OPA141, less divider can make up for the lower GBW.

The "resonance" near -0.6 V looks somewhat familiar. This should be the point of 50% H/L in the run-up and is one of the most difficult points. The excursion of +-1 µV is not ideal, but also not so bad.  I see 2 main suspects to cause such an error: one is DA, as the average integrator voltage changes quite a bit at that point. Another possible mechanism is some electric interference from the µC, HC74 or 4053 effecting the oscillator. At least with my AVR boards this was the likely main mechanism. Changing the decoupling at the oscillator had some effect, though this is not the only path.

One could try changing the modulation frequency (xdel parameter in the ASM program and pascal program). DA caused errors get larger with a lower frequency. Coupling type errors are expected to get smaller with a lower frequency.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 09, 2021, 05:16:10 pm
I did a little more INL testing on the ARM based ADC / DVM. The turn over and sum of 2 voltages test got a little automated. The DVM switches a sequence of 4 settings with 2 high side inputs and 2 low side inputs, to get all 4 combination in a sequence (16 x 16 PLC readings each). For most of the points I still looked at the data by hand, to find phases with low noise. The problem is especially popcorn noise from the references (external and in ternal LM399 based). There are low noise phases and higher noise phases. Brute force averaging needs quite some time to get to the level of quite phases. May have to teach the computer to see quite phases and do a smarter average.

For the more long range linearity (soft INL) I now have 3 tests:
1) the classic turn over test with the same external voltage read positive and negative. The sequence includes 2 additional zeros.
2) read the sum of 2 voltages that make up some 9.4 V from my reference. The 2 voltages are derived from a single LM399 with a amplifier, divider and buffer as used before.
3) use an external voltage source and read the same voltage in a classical AZ mode (0 and the voltage) and in my differential mode, where the ADC reads -1/2 U and + 1/2 U. The 2 voltages are not exactly opposite, but the difference should be accurate as only the ground shifts. So this is a little like the case 2, but with one voltage measured negative and fixed at half the voltage. For the DVM this is measuring the same voltage in the 10 V and 20 V range.

Attached are the results for the 3 tests.
The result of the turn over test is odd: it is more like linear, while the expected form is quadratic. I currently have no real idea what mechanism to give a slightly different gain for the positive and negative side. The main expected effect from the nonlinear on-resistance of the CMOS switch is square law.

The result for the sum of 2 voltages does not looks so bad, especially for the negative side. The positive side shows a little more error, but still not too bad with some 4.5 µV in the center. With the scattering it is a bit hard to tell if the curve follows the expected parabola form for the positive side - it at least looks a bit like it.
The test with the 10 and 20 V range gives some kind of v³ contribution, a bit like expected for the self heating of the resistors at the integrator input. The difference gets quite large - I had hoped for better performance. The difference is also larger than one would expect from the INL seen in the test with half the voltage (but with the same sign and with a different sequence).

The ACAL procedure also gives a slight hint on linearity, though this also includes the amplifier and possible nonlinear effects at the amplifier, especially the feedback resistors. The results for a positive and negative test voltage are reasonably close (-0.2 ppm , -1.8 ppm and -0.6 ppm for the positive side for gain 7, gain 100/ gain 7.4 and the divider), but still a tendency to have lower results for the positive side.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 11, 2021, 04:23:54 pm
A short addition to the last measurements:
The difference between the 10 V range and 20 V range is at least partially due to the amplifier / buffer settling, when switching between the positive and negative side.  With more delay (e.g. 300 µs instead of 70 µs) the diffenrence gets smaller (about half), though not all the way gone. More delay does not fix the problem however.

The DG408 multiplexer gives quite some current spike at the inputs, when switching between different voltages. Not sure of this is the amplifier or the CMOS switch, but it is strong enough to be visible on OP outputs used to drive the inputs.
Title: Re: DIY high resolution multi-slope converter
Post by: jbb on October 12, 2021, 02:14:36 am
The DG408 multiplexer gives quite some current spike at the inputs, when switching between different voltages. Not sure of this is the amplifier or the CMOS switch…

As a diagnostic, could you sneak a large-ish resistor in between the DG408 and the amplifier input? It might let you separate the two candidates (DG408 spike wouldn’t change much, opamp spike might be stretched or removed).
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 15, 2021, 05:25:12 pm
I did try it with a larger resistor (47 K) at the input side with not much change. With a next HW change I will also try a little more resistance behind the MUX.

The more interesting point was a measurement of the turn over error with a battery 9 V instead of the mains powered reference. With a little faster (8 x 16 PLC) switching between the 4 steps and more averaging this also works with the slightly drifting battery. With the battery the turn over error looks different:  only some -6.5 µV (instead of some -11  µV) in the classic mode and  0+-1 µV for the differential mode. Essentially no turn over error is expected for the differential mode.  So chances are the INL tests with the external source were effected by some EMI (either direction) and are not really refecting the nonlinearity.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 30, 2021, 08:53:51 am
A small update:

The INL testing got slowed down by some likely EMI related problems. Especially if the debugger (ST-Link) is still connected there seems to be some EMI effect. This makes the INL test with my external reference (mains powered) somewhat unreliable. I tried some INL tests with just a chain of 1.5 V batteries. This looks a little better, but there is still a possible catch: the input switching in one case causes a current spike, that may effect the batteries. So the drift on the batteries is not necessary linear in time.
The turn over error curve with the batteries looks more like the expected square law curve and not as linear as the older measurements. However there is still the point at some 9.7 V (6 new alkaline cells). I have checked that point, the measurement is repeatable. At least the more normal turn over error is not really my concern, as the 20 V range suppresses this INL part quite well. There is very little turn over error in the 20 V range.

The sum test looks similar to the old results with some 4-5 µV of error.

For the difference test with 2 run-up modes shown earlier, the 2 cases to compare may have been a bit too similar and the result thus a bit too optimistic. With more different run-up modes the difference looks a little worse, but still not too bad. The plot in the attachment shows 2 cases with different modulation frequency ( 23.5 and 61.5 kHz). The run-up parts are a bit more different and especially with some offset relative to each other. The slower modulation curve looks a little better, but not much.
The idea of the comparison at different modulation frequencies is that errors due to DA get smaller with a faster modulation. Errors from switching related interference should get larger with faster modulation. The curves look different, but no clear pointing to one culprit. It looks more like a combination of both types of error: The more shorter range periodic like part (e.g. at abound -300 mV and -1.5 V) seem to be stronger with the slow modulation (this would point towards DA).

The white noise from the ADC is at some 350 nV for the 1 PLC conversions and thus some 80 nV_RMS for the data points that are the average over 20 conversions. The averaging is a balance between noise and loosing very local details of the curve. So some 500 nV_pp is the expected scattering from noise.
Different from the AVR version the noise does not change much with the modulation frequency. So clock jitter does not seem to be a problem. Less jitter also explains the lower noise.

The more step and piece-wise linear part is worse with the green curve and may be more due to switching effects (like coupling to the clock). Still not the hoped for clear result. There is no direct comparison at the some applied voltage, as with at different frequency the features also move to different voltages. The only fixed point is the center of the range with a symmetric modulation at some -310 mV.

I did a comparison with the same 2 run_up modes (61.5 kHz), but some added capacitance at 2 places: extra capacitance at the AC74 flip flop did not change much, still essentially the same curve.  An extra cap at the oscillator supply does improve things a little, though it does not effect the more periodeic part. So it looks similar to the  AVR version that the clock is somewhat part of the problem. Supply filtering at the oscillator really seems to matter.
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on October 30, 2021, 10:34:14 am
Running the oscillator with a separate voltage regulator might improve isolation from other digital states. At low frequencies this is difficult to get with a filter.

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 30, 2021, 01:19:30 pm
An extra regulator is an option for a new PCB. With the current PCB additional filtering is simpler. I am not much worried about the really low frequencies, I am more worried about the harmonics of the clock.

I am also not so much convinced that the problem is directly with coupling via the supply. It could as well be coupling via the oscillator output and vaiations in the loading. Changes in the supply are than more a secondary effect.

I have currently running a new variation, with the extra cap still in place and a larger resistor (51 ohms instead of 14.7 ohms)  in the line between the osciallator and µC. So far the result is confusing: nearly back to the case without the capacitor.

Title: Re: DIY high resolution multi-slope converter
Post by: julian1 on October 30, 2021, 09:33:51 pm
Would it make sense to buffer the oscillator? I noticed the jitter specs on some canned cmos oscillators appear sensitive to the max capacitive loading (50pF). 

I think I calculated that the stray capacitance from traces and the 2 input cmos gates (mcu/fpga gpio and synchronization flip-flop) would be around that level.
For my simple prototype, I added an optional buffer/inverter after the oscillator, but then avoided it on the theory that introducing extra switch propagation would be more likely to upset timing.

Perhaps it would be possible to check the harmonic content (and possible interference) using an independent instrument - a spectrum analyzer/vna?


Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 30, 2021, 10:25:23 pm
Bufferig the osciallator is already there for the flip-flops. I have it planed for the µC too, but need to order a non inverting buffer. With 2 inverting buffers the phase relation is just wrong (violates setup and hold times and even seem to get random jumps, so really at the edge) with the ARM. The extra jitter to the flip-flops seems to be not an issue and jitter towards the µC would be no problem. There is currently not much trace : a 0603 size 14.7 Ohms resistor to both sides. U13 is currently replaced by a wire. Attached is the layout around the clock. U14 is the inverting buffer (NC7SZ14 , SOT 23-5 ). 

I don't have a spectrum analyser and my scope is very much on the slow side - just OK to see the approximate phase and realize that it needs 1 inverter and 1 non inverting buffer. Anyway even just the probe can make some difference and the parts are quite small. I don't see how a VNA would help, at least not a simple 1 channel version. A VNA may help with checking the supply filtering, but still a bit tricky.
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on October 31, 2021, 06:40:28 am
As i have a R6581T open here: Instead of R25 it has two 47 uH inductors with a 10 uF electrolytic cap to Gnd in between and close to the oscillator there is another tantalum cap with a small MLCC cap in parallel. The circuit is arranged such that the caps are used in a "feedthrough" mode, while in your case the oscillator is on the trace to the filter cap. They use a metal can oscillator and the can is grounded, too.

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 31, 2021, 07:17:05 am
So far I had not that good experience with inductors / ferrites in the supplies. I tried with the AVR version and finally went back to low value resistors.
47 µH are quite a large inductor - maybe that helps. So maybe a large inductor is indeed an option.
The small boxed oscillator also has the case (at least the upper half) grounded.
The "feed-through" layout for the capacitor would indeed be better. 


For the buffer to the µC I just realized that using the inverter and typ of the signal from after the other inverter could be an option. So remove R29 and have a bodge wire to the inverted clock instead.
Title: Re: DIY high resolution multi-slope converter
Post by: Tazz on October 31, 2021, 09:55:16 am
Perharps overkill but why not a LTC6957 family buffer for the clock fan-out ?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on October 31, 2021, 02:43:06 pm
The LT part is indeed overkill. A lower end clock buffer like LMK1C1102 may be an option for a new board. Those fast buffers tend to be tiny cases, not very friendly for hand soldering.
Normally standard logic (like LVC family) buffers / inverters should be good enough.

I still hope to get some improvement for the existing board. After all the error seen is already relatively small, 1 µV is only 0.1 ppm of the 10 V range.

With very little change in the last few tries, I start to think that there may be some other mechnanism behind the features. It was mainly that 1 case that was different.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on November 02, 2021, 04:08:21 pm
After not getting much change from the clock part, I did 2 different test to see the effect of integrator speed and dielectric absorption (DA):

For the test of integrator speed the divider between the 2 OPs in the integrator was changed. From the original 10K/1K to some 8.3 K/1K by adding 47K parallel to the 10 K. This speeds up the integrator settling somewhat - still a relatively conservative ratio.  The result is quite some change to the overall slope, but no real change to the nonlinear details. This is not such a surprise, as the number of short pulses is about linear. As long as the effect of incomplete settling is the same for each pulse, one would get a small change in the gain and not much effect on the INL, as the INL part goes not sum up and the effect of single pulse is small. The measured curve makes it unlikely that the integrator settling is reason of the INL error.

With a 1 nF film cap with high DA in parallel to the 2.2 nF C0G cap of the integrator i get an intentionally worse DA. The attached curves shows the expected larger difference. This is especially true for the more shorter period part seen in the detail part.
The short range periodic part is thus confirmed to be from DA. The about constant steps are also not a surprise: the DA error for both measurements is expected to change about in a saw tooth like shape, with a relatively similar slope and frequency. for the difference the slope part than compensated and one mainly get the steps up or down depending on the phase.  With the intentionally poor cap the amplitude increased some 20 fold. This would correspond to DA in the 1 nF cap to be about 60 times higher than in the 2.2 nF cap, which is about the expected ratio for Mylar and a good C0G cap.
To my surprise the more longer range part is also getting larger. So some of the longer range error may also be due to DA. This is a bit surprising as this longer range part more like looks to go up with frequency and not down, as is expected for an DA effect.

To make the ADC work with the larger capacitor I had to do some changes to the program (fix a bug that effected some cases and somehow did not effect the original configuration). This may have also changed the general shape a little. The larger capacitance by itself could also make a small difference.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on November 05, 2021, 05:06:13 pm
For the difference test with 2 run-up modes shown earlier, the 2 cases to compare may have been a bit too similar and the result thus a bit too optimistic. With more different run-up modes the difference looks a little worse, but still not too bad. The plot in the attachment shows 2 cases with different modulation frequency ( 23.5 and 61.5 kHz). The run-up parts are a bit more different and especially with some offset relative to each other. The slower modulation curve looks a little better, but not much.
The idea of the comparison at different modulation frequencies is that errors due to DA get smaller with a faster modulation. Errors from switching related interference should get larger with faster modulation. The curves look different, but no clear pointing to one culprit. It looks more like a combination of both types of error: The more shorter range periodic like part (e.g. at abound -300 mV and -1.5 V) seem to be stronger with the slow modulation (this would point towards DA).

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1311014)

Are you referring to this post?

I got a first higher resolution test for the difference of 2 variations of the run-up.  So the same, slowly changing voltage (capacitor charge and discharge) is measured with 2 different versions of the run-up.  Ideally the 2 versions would get the same result, but the details can vary, e.g. due to errors from DA in the integration capacitor and also coupling effects at the clock. One can see the curve (deviations from a stright line) as indication for the more wiggly parts to the INL.  INL from the amplifier, ADC input buffer and thermal effects (e.g. in the resistors) are not included. The main effects included are DA, integrator input settling and unwanted electrical coupling / supply variations.

Compared to a classic INL measurement this test is easy (not much extra instruments needed) and relatively fast (some 3 h for the curve), but still quite sensitive (low noise).

The curve is still not perfect, but allready quite good and better than in the AVR based version. The improvment is not from the different µC, but more with a better layout / better decoupling. Using a slower modulation may also be part of it: so decoupling gets less important but DA gets more important.
The points are the average over 192 conversions or 2x20 ms each.

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1276333)

Quote
The curve is still not perfect, but allready quite good
is a bit understatement, with linear regression by eye the wiggly part would be in the order of +-0.3µV = +-0.03ppm - what is your goal?
Top pink curve looks better than bottom one, despite the dip around -2.8V and seems to be noisier or more higher frequency wiggles between -1..-2V - difficult to compare properly.
It is a bit hard to follow which runup you used for comparison, the above curves are quite different from each other.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on November 05, 2021, 06:15:52 pm
The INL test form sepr. 19 was the one that was a bit too optimistic. Likely the 2 run-up mode where too similar, so I got the INL error too similar for the 2 curves. The residual error from that curve would be great, but it was to optimistic. The later curves show more like 1-2 µV of maximim deviation.

For the fast periodic part it is relatively easy to make sure that the 2 run-up versions are different: use different step size with the run-up and thus a slightly different period and thus areas where this parts adds, and where it cancels. With the other more longer range part this is not so easy, as I still don't fully understand where that effect comes from. The test with the intentional poor capacitor indicates that this is also related to the capacitor. On the other hand the effect got larger with faster modulation and also in one case (though only that one example) reacted to changes at the clock.

For the comparison of the 2 frequencies (oct. 30), what looks like extra noise in the upper pink curve is a repatable periodic part of the INL error. The noise should be rather close for both measurements, with the tendency to be slightly better in the upper curve due to less jitter effect.
Noise is a bit tricky, as more averaging also suppressed the fast periodic part.

The gaol with the difference tests and variations in the circuit was to find the mechanism that causes the nonlinearity. Somehow the measurements don't give a clear answer and are more confusing. It is definitely worth using a good capacitor and for the simple 2 pattern modulation 20-30 kHz seems to be about the lower limit for the modulation. If the noise from jitter permits faster modulation seems to be preferred.

Maybe I have to accept that there is some INL error (some 0.1-0.2 ppm range) of unkown origing. At least I could not find an easy solution ( the optional extra DG419 part could be an option). I somehow forgot to include it in the ARM based PCB  |O.

There are than still the 3 parts of soft INL of know origin:
The nearly periodic part from DA in the integration cap (some 0.05 ppm with 30 kHz modulation).
Some 0.7 ppm of turn over error (U² part for the 10 V range) mainly from the on resistance of the 4053. This one is compensated by the internal turn over in the differential mode (e.g. 20 V range).
Some 0.5 ppm of INL error of U³ type from self heating of the resistor array. It depends on the luck with the resistor matching. Chances are this part could be better with the 2 x 25 K in series (less heating and statstic averaging for the matching).
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on November 08, 2021, 12:05:34 pm
I just realized that my ARM program was averaging (N+1) instead of (N) readings. So what was assumed 1 reading at 1 PLC was actually the average of 2. So the calculated noise was too low by about a factor of 1.4 . So the noise of the ARM based version is not much lower than the AVR based version. The noise is similar at some 450-500 nV for the 1 PLC AZ conversion.  Some of the time scales are thus also wrong - though in most cases the time scale is not that critical.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on November 21, 2021, 05:53:23 pm
Here I share are the plans for the STM32based ADC version and voltmeter front-end (amps and ohms part are planed, but not yet build / final).
I have a working DVM unit with some bodges and limitations (e.g. output to PC only, no case yet). I still don't consider the project finished, but far enough to have the  main parts working. A photo of the board was already shown.

Like some older MS-ADCs, the ADC is build around a µC and not a FPGA as many new designs.
The principle of the ADC and the analog circuit is still essentially the same as in the AVR based version. Different from the AVR version the code is in C and thus a little easier to modify / extend. It is still not easy to port to a much different µC, as non standard details of the timer hardware (trigger timer start from comparator) are used to do the critical timing part. With the ARM CPU the µC can already do the conversion to a decimal format and thus no special software needed on the PC side - just a terminal program.

The µC is an STM32L051 in 48 pin LQFP. A few similar types (e.g. STM32L053 or L071) should work as well. The availability of the STM32 µCs is poor, with the STM32L0xx a bit less critical so far, but still not good. The code is a mix of using the HAL libraries / cube MX environment for the initial configuration and direct register access later on. So the code has some of the cube MX specific files and most of the code in separate files.
The actual ADC control part is in the ISRs. The non interrupt code is for the UI and converting the raw result to a final number.

The front-end part of the DMM/DVM is a bit more complicated than the low end commercial designs. I have considered a simpler version (e.g. more like the Keithley 2000), but the savings are not that large. Part of the extra circuit is to include extra features.

The front end includes the possibility to do internal measurements of the gain and divider ratio both for the positive and negative sign.

To support linearity testing there are 2 inputs (needed for 4 wire ohms anyway) and also switching between 2 low sides. This allows an automated turn over and sum test. While currently only a DVM, provisions for the ohms mode (2 and 4 wire ohms) and extra internal inputs for the amps mode are included.
The extension to a 20 V (some 24 V maximum reading) range with high Z also needs a little extra HW.

To avoid special, expensive and large relays the maximum input voltage is limited to some 200 V (up to 400 V when brave) and I would not give the protection a CAT2 rating. So this is for lower power and limited voltage, more like a precision DMM, not for mains work. There are no AC ranges anyway.
The voltage ranges are for some 200 mV / 2 V / 20 V / 40 V / 200 V .

The board was planed to also work inside the BB3 measurement system - though not yet tested there and the interface part is not populated and SW still missing.
The EMI sensitivity makes a stand alone use more practical, at least for the initial tests.
The front end part could also be used with a different ADC. The first tests were done with the AVR based ADC version instead of the ADC on the board.

There should still be a bit of hardware optimization and quite some additional functions in the software needed.
The main hardware issues still to address are:
 - the DCDC converter can be a source of interference. The DCDC part may need a make over anyway, as the SN6505 is hard to get.
 - EMI sensitivity
 - there is some extra low level (~20 nV) low frequency noise at the input. So the noise with longer integration is not as good as hoped for.
 - some offset voltage drift (around 2 µV on warm up), likely from the protection part as the 2 inputs drift different.
 - during start up the LM399 heater current overloads the DCDC - maybe add soft start from lower voltage (Ok for stand alone, but not good inside BB3)
 - The PCB still has a few errors and needs some bodges. So I would not recommend a 1:1 copy of the layout.
 - The ESD protection is likely not really good.
 - additional protection with fusible resistors would be good as a last resort
 
The output and control so far is from the PC only, so no display or keys, but just an UART-> USB interface with a terminal program at the PC side.
So far the user interface is a bit simple: 1 letter commands with 1 digit parameters, with the digit coming first. So something for the fans of RPN calculators.
The SW has some limitations
 - the control needs delay between commands (OK for manual typing, but could be annoying for a program)   
 - the user-interface is a bit cryptic
 - the ACAL results (gain, divider, offsets) are not yet included in the result. So some of the math is still on the PC side.
 - the parameters for ADC fine tuning are included at compile time. Should be added to the SW to include at run time.
 - limited to 1 PLC conversions and averaging for higher resolution so far.

The schematics are as a PDF. If needed I can also provide the KiCad (5.1.8) files. This still need a bit sorting out the local parts/footprints.
The LTspice simulation is for the amplifier in gain 10 configuration (2 V range). It may help to understand the configuration with the driven low side.
The Code files are zipped (I hope all the required files to use in ST Cube MX are included). The compiler should use optimization also for debugging.
Debugging still works reasonable, as there is not that much optimization possible with many of the variable as volatile.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on November 29, 2021, 10:14:26 pm
A short update, now got a more automated test setup with a K236/7/8 as voltage source.
4th order RC filter (4x220µF MKS with 2x4x1k) is used to get a smooth linear slope when stepping the SMU (~2.5mV/s +-10V).
Attached the measurements mainly done to evaluate the setup - quite different results for different runup modes.
Next will be real INL test against 3458A, for this the pascal program needs to be converted to python to gain more control and easier automation of the setup.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on November 30, 2021, 10:49:10 am
Are the measurements still with R10 = 6.8 K ? This would be with a relatively slow settling integrator. With the OPA145 a smaller value (like 3 K to 5 K) for R10 would be more appropriate. This would especially make a difference for the mode P with rather short time for settling. Overall the shape is similar what I have seen.

A real INL test to a 3458 would be interesting. With the relatively noisy LM399 ref. this may still take some time for averaging. So for the voltage source there is no need to have a much lower noise one, especially if the readings are at the same time. The tricky point are the jumps from popcorn noise of the LM399.  To suppress this low frequency noise one would ideally run through the sequence of test voltages several times and not just every voltage once.
For the start the interesting points would be a general overview (e.g. 1 V steps) and than maybe the readings around 0.6 V, where the DIY ADC is likely weakest.

For the start the Python program to read the data could get away with only the normal measurements. The small slope part is not needed very often and one of the more complicated parts.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on November 30, 2021, 12:16:19 pm
Are the measurements still with R10 = 6.8 K ? This would be with a relatively slow settling integrator. With the OPA145 a smaller value (like 3 K to 5 K) for R10 would be more appropriate. This would especially make a difference for the mode P with rather short time for settling. Overall the shape is similar what I have seen.

HW & FW is unchanged, first want to have a baseline for comparison incl. real INL measurements and then apply changes.

A real INL test to a 3458 would be interesting. With the relatively noisy LM399 ref. this may still take some time for averaging. So for the voltage source there is no need to have a much lower noise one, especially if the readings are at the same time. The tricky point are the jumps from popcorn noise of the LM399.  To suppress this low frequency noise one would ideally run through the sequence of test voltages several times and not just every voltage once.
For the start the interesting points would be a general overview (e.g. 1 V steps) and than maybe the readings around 0.6 V, where the DIY ADC is likely weakest.

Several challenges are expected: reading at the same time when sloping the input (jitter, interpolation), noise - especially popcorn - from LM399, temperature changes, ...
Simpler would be to check discrete input voltages, but sloping the input gives DNL (local wiggles) as a bonus.

For the start the Python program to read the data could get away with only the normal measurements. The small slope part is not needed very often and one of the more complicated parts.

Already ported the pascal program nearly 1:1 to python (attached), not cleaned up yet, but all functions should work. (https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1336202)
To get married with 3458A & SMU there is some work left.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on November 30, 2021, 10:13:40 pm
Discovered an unexpected effect regarding the 0V offset in 3 readings mode (AZ+AS).
If the input is set to the same 0V used for AZ (S8), expectation is to read ~0µV avg, but it is ~6µV avg (run-up W).
The input mux switching (In 0V 7V) occurs after the run-down is finished and before the µC ADC reads the residual charge.
Switching the input mux after reading residual charge the result is ~0.4µV avg.
With 7V (S7) it changes from ~-7µV to ~+7µV relative to expected value.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 01, 2021, 10:47:44 am
I have seen such an effect before. There is something near the start of this thread:
https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/msg2532315/#msg2532315 (https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/msg2532315/#msg2532315)

It looks like some delayed effect / spill over from one conversion to the next.  Some such effect is expected due to DA, but AFAIR it should be less.
Another possible path is some capacitive coupling, though this should normally also be less.

As much of the delayed effect seems linear I did not worry too much about this part. It is however a problem with the 3 step cycle if the extra 7 V reading is used to correct for the gain. In this case one would need to use a numerical correction.
Moving the switching of the MUX to a later time is a good idea, at least for the more slower conversions like 1 PLC and more and especially if there is a separate reading for the initial charge of the next conversion anyway, like in the current code.
Title: Re: DIY high resolution multi-slope converter
Post by: miro123 on December 01, 2021, 02:32:01 pm
Discovered an unexpected effect regarding the 0V offset in 3 readings mode (AZ+AS).
If the input is set to the same 0V used for AZ (S8), expectation is to read ~0µV avg, but it is ~6µV avg (run-up W).
The input mux switching (In 0V 7V) occurs after the run-down is finished and before the µC ADC reads the residual charge.
Switching the input mux after reading residual charge the result is ~0.4µV avg.
With 7V (S7) it changes from ~-7µV to ~+7µV relative to expected value.
Just looked at schematics for first time - signal 'Res_adc' must to be decoupled with at least 10nF as close as possible to uC pin. Please follow the STM AN.
https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwiwuuXW6ML0AhXS_7sIHYDtBc4QFnoECAQQAQ&url=https%3A%2F%2Fwww.st.com%2Fresource%2Fen%2Fapplication_note%2Fcd00211314-how-to-get-the-best-adc-accuracy-in-stm32-microcontrollers-stmicroelectronics.pdf&usg=AOvVaw2Xw7l_zV_8OzywL7FFVi2H (https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwiwuuXW6ML0AhXS_7sIHYDtBc4QFnoECAQQAQ&url=https%3A%2F%2Fwww.st.com%2Fresource%2Fen%2Fapplication_note%2Fcd00211314-how-to-get-the-best-adc-accuracy-in-stm32-microcontrollers-stmicroelectronics.pdf&usg=AOvVaw2Xw7l_zV_8OzywL7FFVi2H)
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 01, 2021, 04:15:30 pm
As far as I understand the µC internal ADC has 2 possible modes of operation: one with a relatively low source impedance and low capacitance (< 20 pF) at the input and the other is with a relatively large capacitance (10 nF may still be on the low side) and than possibly higher source resistance.
 
The ADC is use with a relatively long sampling time (7.5 cycles and AFAIR 8 MHz clock) and low capacitance at the input. Even with 2.2 K in series this should be still OK for the ADC to work without a capacitor directly at the ADC input. The data-sheet wants for the standard inputs < 3.2 K for 12,5 cycles and 16 MHz clock. So 2.2 K should be OK with 7.5 cycles at 8 MHz. If needed a smaller resistor (R51) would be no problem. So this is still the relatively low resistance source case with no extra capacitor.

Some 10 nF to ground would be an option too, as there is some waiting time before the ADC conversion starts. However I don't have a footprint for this on the PCB.  This would lower the BW for the residual charge, that is currently set by the relatively slow MCP6001/2 at a gain of 10 (or a bit higher).
It would need some 100 µs for settlling, so a bit on the slow side already. So one would use it would a smaller resistor to the OP.

For the AVR base version the ADC is sampling relatively slow and it can tolerate even more resistance than the STM32.
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on December 01, 2021, 04:24:36 pm
Even 1 nF can help to keep the ADC input pin quiet. It depends on where R51 is (trace length between R51 and ADC input pin).

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 01, 2021, 04:56:51 pm
In my case R51 is about 8 mm from the µC pin. So not very much extra capacitance. The µC internal ADC also does not really needs its full resolution / accuracy. There is usually (1 PLC conversion) some 10 LSB of noise on the signal anyway.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on December 06, 2021, 11:40:26 pm
Did some investigation on delayed (settling) effects with interesting results - still unchanged HW & FW (Rerouter PCB ATMega48).
For this first test only the internal awailable voltages were used (0V & 7V from LM399) - results with external -7V follow.
Mode B (INL-comparison) with run-up Q is used in unusual way (FW lacks non AZ mode): repeatedly take n readings @0V followed by m readings @7V to get each step response.
The offset & scale factor are obtained from median of 200 readings in mode B on 0V & 7V before each run.

Unexpected that 0V is little effected (~0.15ppm) - in contrast to 7V, which suffers ~9ppm until it settles after ~20 readings.
From that I would exclude integrator capacitor DA & self-heating of resistors as source, but have no idea what it could be.

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1342625)

The impact of switching the input mux before µC adc reading residual charge is clearly visible at the last readings (0V: ~0.5ppm, 7V: ~1.5ppm) .
Seems a good idea to change the input mux switching after adc reading as indicated already in former posts:

Discovered an unexpected effect regarding the 0V offset in 3 readings mode (AZ+AS).
If the input is set to the same 0V used for AZ (S8), expectation is to read ~0µV avg, but it is ~6µV avg (run-up W).
The input mux switching (In 0V 7V) occurs after the run-down is finished and before the µC ADC reads the residual charge.
Switching the input mux after reading residual charge the result is ~0.4µV avg.
With 7V (S7) it changes from ~-7µV to ~+7µV relative to expected value.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 07, 2021, 09:17:27 am
The observed rather slow settling is interesting.

The dielectric absorption is symmetric and would thus give a same size effect for the step up and down. In addition the DA usually does not follow a single time constant and thus a slower than exponential settling. So DA can not be the main effect for the settling. It may cause the small effect seen at 0 V.

For a thermal effect the change for the 7 V is quite large. At least with the 3 versions I have build and also with 2 more sets of resistors I have not seen that much change in the gain with temperature. With the resistor arrays the TC was not much above 1 ppm/K for the ADC gain in the AZ mode. The non AZ mode step is a little different though. One extra term is from a shift in offset from temperature, but this would also effect the 0 V measurement. So this part is small. It is relatively easy to mesure the gain TC with the program mode C and the temperature sensor as the input channel. This reads temperature, zero and the reference in a 3 step sequence. So one get the ADC gain and the temperature.

As a 3rd possible mechanism there is an effect on the reference. Switching to the 7 V ref. will cause a small current spike there, and this can effect the refrence voltage to the ADC. The low pass filter for the reference has a time constant of some 75 ms and would thus about match the observed settling.
However this can not explain the effect seen with the short 2 conversion 0 case: it seems to takes quite some time to reset the settling. A thermal effect on the reference is possible, though normally not expected to be that large and I would expect a slower reaction.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on December 07, 2021, 09:04:26 pm
Pending results on delayed (settling) effects with external -7V & 10V attached.
Looking at the results, the 3rd possible mechanism mentioned is likely (effect on the reference) - did not have that source on my screen  :-+
I guess the unbuffered 7V to the input mux effects the LM399, although it is filtered by 100nF - 100R -100nF - let's find out.
Kleinstein later added a buffered 7V, but rerouters version is based on older schematic w/o this buffer.

Comparison between different voltages (20 readings each - 10V with different scale):

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1342625)(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1343564)(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1343588)(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1343606)
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 07, 2021, 09:20:32 pm
I added the buffer for the 7 V reference only after the PCB was made. The OP was planed as a buffer for an input and only as a after-though was used as reference buffer. So the buffer was not in my initial circuit plan. I though I would need it mainly for a signal , zero and reference mode to measure the ADC gain in real time (like the Keithley 19x meters). I don't think I had actually see the effect on the reference, just the current spike to the input.

The effect of swtiching the input while the conversion is running looks a little larger than what I remember. This could be a slight difference in the parasitic capacitance.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on December 08, 2021, 10:57:37 pm
Pending results on delayed (settling) effects with external +/-7V with disconnected unbuffered 7V from input mux (100R removed) attached.

Comparing 7V vs 7Vext confirms that the input mux effects the unbuffered 7V:

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1342625)(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1344506)


Comparing the -7V gives no difference, small settling (~0.5ppm) & jump at last reading (~1ppm) remains same:

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1343564)(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1344518)
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on December 09, 2021, 10:51:40 pm
Changed the firmware so the input mux switching happens after the residual charge read by µC adc.

FW Diff:
Code: [Select]
@@ -873,7 +873,7 @@ rundown:
  out portSW,t2               ; start of Rundown: start with larger Ref.; Input off
    ; may need extra delay here  (min length for phase)
  ldi t2,control_neg       
- out portMUX, nextmux        ; change MUX for next conversion : DG408 is slower than 4053, so likely no extra delay needed
+ /*out portMUX, nextmux        ; change MUX for next conversion : DG408 is slower than 4053, so likely no extra delay needed */
 
  LDI temp,1                  ; timer1 start (already 0 and OC1A flag cleared in runup prepare)
  STS TCCR1B,temp
@@ -959,6 +959,8 @@ mslope2:                  ; call point for just data collection of rundown
  rcall readAD_wait     ; ADC right after rundown;
  ldi temp, ADMUXSlp    ; MUX to auxiliary (for next conversion)
  sts ADMUX,temp
+ ; Debug change input mux after ADC readout
+ out portMUX, nextmux        ; change MUX for next conversion : DG408 is slower than 4053, so likely no extra delay needed
 
     lds temp,par_syncdel  ; extra delay to check delayed effect  (some gets hidden by wait for ADC)
     rcall longdelay       ; schon viel delay ! (startwert ist 26 -> 1.6 ms)

The results for external +-7V in mode A (AZ), run-up Q, median(1000 rdgs.) are as expected, the readings are getting closer where they should be, but still some deviation left - see attachments.
Improvement for +-7V is ~1.5ppm of range, 0V is nearly down to noise floor (<<0.1ppm of range).
To get a ratio measurement, the scale factor is calculated from input value with median(200 rdgs.) in mode B run-up Q before each run.

Comparison table:
Input | dev to 0V in µV | -> in ppm (10V) | dev to +-7V in µV | -> in ppm (10V)
7V orig FW19.71.97-27.7-2.77
-7V orig FW-12.9-1.29-19.0-1.90
7V adc first0.60.06-9.4-0.94
-7V adc first0.30.03-5.5-0.55
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on December 10, 2021, 10:44:49 am
Part of the settling one still sees after the step in the input voltage can be from DA. In the non AZ mode this is stronger than in the more normal AZ mode, as effects from longer time scales are included. To a large part the effect from DA is linear and thus would in the AZ mode only lead to a slight (e.g. 0.5 ppm range) change in the gain.

The observed settling is a bit different for the +7 and -7 V case and thus nonlinear. For the small difference seen for the zero reading, there are a few poible nonlinear effects, like self heating in the resistor array at the integrator input. The heat can not only change the gain, but also cause an offset of the ratio of the 2 reference channels changes.  A similar effect would also effect the +-7 V test cases. The observed difference between the + and - sign case is still quite a bit larger than at zero. So there is still a bit unclear about the mechanism behind this. There is some possible asymmetry with thermal effects from the buffer amplifier, but this should be rather slow. Settling after the charge injection spike at the input of the MUX may a factor - though this shuold be quite fast. Hard to tell how much is still there for the 2nd sample after the jump.

Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on January 02, 2022, 11:05:31 pm
The project for the ATMEGA version is now on github: https://github.com/Multi-slope-ADC?tab=repositories
Separated into four parts:
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on January 07, 2022, 07:59:09 pm
Part of the settling one still sees after the step in the input voltage can be from DA.

Any ideas how to test if it is related to DA?
Still do not understand why DA could be asymetric between +-7V input and why wouldn't DA then show up in the zero reading more pronounced as well?
Maybe worth to test with other run-up versions to see if they behave the same as run-up Q.
Due to lack of non-AZ mode, it would need some FW mod - either change fixed run-up in mode B for every run-up to check or even better to implement non AZ mode @Kleinstein?  ;)

In the non AZ mode this is stronger than in the more normal AZ mode, as effects from longer time scales are included. To a large part the effect from DA is linear and thus would in the AZ mode only lead to a slight (e.g. 0.5 ppm range) change in the gain.

Both - AZ mode A and first reading of mode B - are very close together, not sure what you are referring to?
The delayed/settling at 1 PLC might not be an issue, but would show up in higher PLC settings as gain error - maybe not really relevant as higher PLCs are noisier then averaging n times 1 PLCs, but still not satisfactory.
To test if unbuffered Ref+/Ref- are still effected, R22 (Ref filter) was halved in value, see attached results.

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1373177)

There is a minor effect ~0.1ppmFS visible for +7V input, -7V essentially shows no change.
Might be the Ref+- buffers are effected, but the settling should be much faster then, so unlikely.
There is some gain error ~0.1ppmFS, therefore the trailing values were matched manually for better comparison and the results in the table should be handled with some grain of salt.

Comparison table mode A (AZ):
Input | dev to 0V in µV | -> in ppm (10V) | dev to +-7V in µV | -> in ppm (10V)
7V orig FW19.71.97-27.7-2.77
-7V orig FW-12.9-1.29-19.0-1.90
7V adc first0.60.06-9.4-0.94
-7V adc first0.30.03-5.5-0.55
7V adc first R/20.30.03-7.9-0.79
-7V adc first R/20.20.02-5.3-0.53

The observed settling is a bit different for the +7 and -7 V case and thus nonlinear. For the small difference seen for the zero reading, there are a few poible nonlinear effects, like self heating in the resistor array at the integrator input. The heat can not only change the gain, but also cause an offset of the ratio of the 2 reference channels changes.  A similar effect would also effect the +-7 V test cases. The observed difference between the + and - sign case is still quite a bit larger than at zero. So there is still a bit unclear about the mechanism behind this. There is some possible asymmetry with thermal effects from the buffer amplifier, but this should be rather slow. Settling after the charge injection spike at the input of the MUX may a factor - though this shuold be quite fast. Hard to tell how much is still there for the 2nd sample after the jump.

The differences in the zero readings between +-7V are << 0.1ppmFS, I would consider this good enough even for 8.5 digits.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 07, 2022, 09:24:10 pm
With the external +-7 V signal there is little reason to expect an effect of R22. R22 gives low pass filtering of the reference with a time constant of about 2.8*R22*C13  or some 62 ms for the initial setting. From the test with half R22 it looks like this time constant is not what we see.

I don't see much reason why the input signal should effect the reference. The refrence switching at the ADC is to keep the current essentially constant. There may still be some effect via the supply current and maybe ground current.

The more likely reason would be a thermal effect. The resistor array heating up and this changes the gain and effecting the offset. The offset part may be the larger effect and normally this part would be corrected from AZ mode. The thermal induced offset would effect the + 7V and - 7V different (same change in voltage is opposite effect on gain). So there are symmetric and anti-symmetric parts.
The thermal effect can also be temperature dependent: the TC matching of the resistor arrays may have a square part. In my 2nd AVR version the gain has a significant 2nd order TC and a zero in the TC at around 10 C. This can vary between units and with the other resistor arrays. I don't remember a measurement of the ADC gain of the temperature. This relatively simple in mode C, reading 0, the reference and the temp sensor while the whole ADC circuit slowly warms up or cools down. This would give a curde idea on how much thermal effect to expect.

Another possible test for the thermal effect at the resistor array is heating the resistor array locally and then record the cool down to get the time constant.  This can be a bit tricky, as there is a general temperature and a local temperature gradient that can have an effect. The temperature gradient can relax a bit faster than the mean temperature.

The effect of the slow part of the DA should be largely linear. This would be linear in the average integrator voltage and the relation to the input voltage is approximately linear, but not perfect. So it should be largely symmetric between the +-7 V tests. The asymmetric part could still be from a thermal effect or maybe something else.
 
A way to check for DA effects would be with a different runup mode. Slower modulation would give a larger integrator voltage and thus more effect of DA (about proportional to modulation period, and thus 2 x more for the slow mode).

An extra non AZ mode may be a good idea, as the mode B is limited to only one run-up case. I am currently finishing the amps+ohms PCB for the ARM version and will soon have some time to look at the AVR version again, maybe add the DG419 part to reduce the DA effect.


Title: Re: DIY high resolution multi-slope converter
Post by: ogden on January 07, 2022, 09:56:39 pm
Hello @Kleinstein,
I am long follower of your work, appreciate your dedication and hard work. Thank you for sharing your wizdom, if I can say so. Suggestion for n00bs - listen & learn carefully what he tells you :)
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on January 08, 2022, 04:42:29 pm
To test for DA on the delayed/settling effect, the FW & control software was modified to run mode B in selected run-up version (formerly one of the two readings was done everytime in run-up Q):

FW hack diff:
Code: [Select]
@@ -1053,10 +1053,11 @@ mslopeB:                   ; run multi-slope, 2 Runup versions for tests
  ldi temp,255
     st  x+,temp            ; Data are send during next runup, one ADC is ready
 
+    rcall mslope1          ; 2 nd conversion
 
-    rcall runup_P3nF        ; nromal mode
+/*    rcall runup_P3nF       ; nromal mode
  rcall rundown
- rcall mslope2          ; data collecton 2nd conversion
+ rcall mslope2          ; data collecton 2nd conversion*/
     rcall control          ; Check UART
    rjmp mslopeB

Control software hack diff:
Code: [Select]
@@ -283,11 +283,11 @@ def read2 (n):              # 254, 251: 2 readings (modes A, B, E)
 
     if n == 254:
         u2 = readADC(k0[ruv])   # result of 2. conversion
         du = u1 - u2
     else:
-        u2 = readADC(k0[1])     # result of 2. conversion, mode B for INL test
+        u2 = readADC(k0[ruv])     # result of 2. conversion, mode B for INL test
         #du = u1-0.5*(u2+u2old)      # TODO should be only for mode B? Or better avg 0V reading even for mode A/E?
         du = (3*(u2old-u1)-u1old+u2)/4   # interpolate both values
 
     #f.write('{:11.3f}\t{:11.3f}\t{:13.4f}\t{:6.0f}'.format(u1, u2, du*sf, adcdiff))
     writeraw()

Comparison of 3 run-up modes were done for P: fast, Q: normal, W: slow (P shows higher noise then Q, W lower)
Edit: Results not compareable due to screwed up FW
Mode A for run-up W&P show some improvement ~0.3ppmFS vs. run-up Q - on 7V run-up P a little better ~0.4ppmFS (compared against +-7V adc first with regular R22).
W&P differ not that much, see attached four comparison for mode B for run-up Q vs. W and P vs. W (20 readings +-7V input).
In mode B the tendence is much better visualized then from the comparison table.
There is some gain error ~0.1ppmFS, therefore the trailing values were matched manually for better comparison and the results in the table should be handled with some grain of salt.


Comparison table mode A (AZ):
Input | dev to 0V in µV | -> in ppm (10V) | dev to +-7V in µV | -> in ppm (10V)
7V orig FW19.71.97-27.7-2.77
-7V orig FW-12.9-1.29-19.0-1.90
7V adc first0.60.06-9.4-0.94
-7V adc first0.30.03-5.5-0.55
7V adc first R/20.30.03-7.9-0.79
-7V adc first R/20.20.02-5.3-0.53
7V adc first RU W0.00.00-6.6-0.66
-7V adc first RU W-0.4-0.04-3.2-0.32
7V adc first RU P0.10.01-5.1-0.51
-7V adc first RU P-0.7-0.07-3.1-0.31

I had to repeat the measurements a couple of times as there was a pronounced popcorn or 1/f noise ~1ppmFS, that did not show up in former measurements.
If it is from internal LM399 reference, it will spoil INL measurements against 3458A significantly :scared:
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on January 08, 2022, 05:17:07 pm
Apropos popcorn noise: In the above schematic C210 = 100 nF isn't ideal, as the LM399 zener pin is in fact an operational amplifier input and output at the same time. Better use a 50 Ohm resistor in series with the capacitor. Otherwise the circuit may exhibit RF instability, that may appear as popcorn noise.

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 08, 2022, 06:12:50 pm
As the settling effect does not get much larger in mode W, it looks like the DA is not an important part there.
The expected direction from an DA effect is more settling with mode W (slower modulation), but the observed difference is the other way around.
The thermal effects should be unaffected from the modulation.
So it looks a bit like there is some settling effect on the switching part, maybe the supply of the 4053. I don't expect the 4053 to heat up very much, as there is not much change in the power.

The interpolation for AZ mode for case B is not so much for lower noise (as a kind of digital filtering, but mainly for the difference test, so that both versions get the value for the same time. So with 3 conversions V1,V2,V3 the first and last (using the same input / conversion mode) are averaged to get a values for the same time. This is needed for the linearity test to avoid an effect of the rate of change.  For a normal reading in AZ mode, it would be possible to average 2 zero readings without an extended step response. So though actually using 2 PLC for the zero the response would be the same as 1 PLC, just with slightly lower noise and little extra latency compared to the zero and signal case.
The effect gets smaller, when more readings are averaged.
In my ARM version I have those 2 versions of the AZ mode to choose as an extra parameter. The interpolation makes sense for a classic AZ mode and is needed for the linearity test, but it makes less sense in the +- mode I use with my DVM. For the AVR version averaging is a point for the PC side only.

A series resistor for a capacitor in parallel to the ref is definitely a good idea. Not sure if 50 Ohms is best - from the impedance curve with some 30 ohms at 100 kHZ my guess would be a little lower (e.g. 22 ohms), though not much.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on January 09, 2022, 11:22:24 am
The interpolation for AZ mode for case B is not so much for lower noise (as a kind of digital filtering, but mainly for the difference test, so that both versions get the value for the same time. So with 3 conversions V1,V2,V3 the first and last (using the same input / conversion mode) are averaged to get a values for the same time. This is needed for the linearity test to avoid an effect of the rate of change.  For a normal reading in AZ mode, it would be possible to average 2 zero readings without an extended step response. So though actually using 2 PLC for the zero the response would be the same as 1 PLC, just with slightly lower noise and little extra latency compared to the zero and signal case.

The remark
Quote
# TODO should be only for mode B?
was due to the fact that the pascal program interpolates in all modes A, B, E (see last line).
This means all measurements in Mode A/E have lower noise for value of du (values u1, u2 are uneffected).
It was fixed in the python port (interpolation only in Mode B) and improved for sligtly lower noise:

Python control progam:
Code: [Select]
     if n == 254:
         u2 = readADC(k0[ruv])   # result of 2. conversion
         du = u1 - u2
     else:
         u2 = readADC(k0[1])     # result of 2. conversion, mode B for INL test
         #du = u1-0.5*(u2+u2old)      # TODO should be only for mode B? Or better avg 0V reading even for mode A/E?
         du = (3*(u2old-u1)-u1old+u2)/4   # interpolate both values
 
     #f.write('{:11.3f}\t{:11.3f}\t{:13.4f}\t{:6.0f}'.format(u1, u2, du*sf, adcdiff))
     writeraw()

Pascal control program
Code: [Select]
       254, 251 :                  // 2 readings (modes A, B, E)
         begin
          u1 := readADC(k0[ruv]);    { result of 1 st conversion }
          if n=254 then
            u2 := readADC(k0[ruv])    { result of 2. conversion }
           else
            u2 := readADC(k0[1]);     { result of 2. conversion, mode B for INL test }
          du:=u1-0.5*(u2+u2old);



Considering the remark
Quote
Or better avg 0V reading even for mode A/E?
It is not implemented and just an idea.
It would come only at cost of one additional zero reading for first cycle, for following cycles you get that for free.
Not sure if it helps or hurts, it would shift noise from lower to higher frequency for value du.
Edit: This would be applicable even to mode C -> 3 readings - S 0 7 and a bit different to mode E -> 2 readings (S S2 (channel 2) - difference to channel 2
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on January 09, 2022, 12:12:47 pm
Apropos popcorn noise: In the above schematic C210 = 100 nF isn't ideal, as the LM399 zener pin is in fact an operational amplifier input and output at the same time. Better use a 50 Ohm resistor in series with the capacitor. Otherwise the circuit may exhibit RF instability, that may appear as popcorn noise.

A series resistor for a capacitor in parallel to the ref is definitely a good idea. Not sure if 50 Ohms is best - from the impedance curve with some 30 ohms at 100 kHZ my guess would be a little lower (e.g. 22 ohms), though not much.

Thought about replacement of reference RC filter with something like R22=22Ω, C13=1mF (electrolytic, low leakage), then C210=100nF could be paralled to C13.
Idea is to mitigate influence of input current noise/changes from U9 OP07 (and +15V psu noise), size should be likely the same, cost a bit lower.
The unbuffered 7V to the input should be buffered, as there is quite some influence of input mux charge injection, but with the mod this should improve even w/o a buffer.

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1373177)
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 09, 2022, 12:36:30 pm
When doing auto zero with a true zero it makes sense to use the interpolation. Averaging the zero before and after does not effect the result except for the slightly (by a factor sqrt(0.75) ) resuced noise. For things like the difference reading the interpolation may be good (e.g. if the common mode part drifts), but it can also be confusing. So it depends if the interpolation is wanted. For the noise measurements it is better to use it without, especially for the scattering calculated in real time, as the readings are no longer fully indetendent. Most of the time I use some averaging over mutliple 1 PLC conversions anyway and than the interpolation makes less of a difference in the noise.

Using an electrolytic cap and smaller resistor for the filter may be an option. It may still need a little longer for the filter to settle, as the electrolytic caps need quite some time for settling of DA (can be in the 10-20% range). R22 could still be larger than 22 ohms. The large cap may cause some problems if the supply is turned off very fast (e.g. with a short) from the charge searching it's way out.

For dampening possible RF, the 100 Ohms and 100 nF aready there already help, so C210 is not really needed. It is not so rare to have a cap directly parallel to the LM399, so it should not do much harm.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on January 10, 2022, 09:46:24 pm
Recognized today that I screwed up and patched the wrong branch of the FW, which had long delay between readings :palm:
The results for different run-up versions W&P are not compareable to former results, have to repeat the measurements:

To test for DA on the delayed/settling effect, the FW & control software was modified to run mode B in selected run-up version (formerly one of the two readings was done everytime in run-up Q):
Comparison of 3 run-up modes were done for P: fast, Q: normal, W: slow (P shows higher noise then Q, W lower)
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on January 11, 2022, 11:35:51 pm
Next try to test for DA on the delayed/settling effect, the FW & control software was modified to run mode B in selected run-up version (formerly one of the two readings was done everytime in run-up Q):

Diffs for completeness, they did not change since last time.

FW hack diff:
Code: [Select]
@@ -1053,10 +1053,11 @@ mslopeB:                   ; run multi-slope, 2 Runup versions for tests
  ldi temp,255
     st  x+,temp            ; Data are send during next runup, one ADC is ready
 
+    rcall mslope1          ; 2 nd conversion
 
-    rcall runup_P3nF        ; nromal mode
+/*    rcall runup_P3nF       ; nromal mode
  rcall rundown
- rcall mslope2          ; data collecton 2nd conversion
+ rcall mslope2          ; data collecton 2nd conversion*/
     rcall control          ; Check UART
    rjmp mslopeB

Control software hack diff:
Code: [Select]
@@ -283,11 +283,11 @@ def read2 (n):              # 254, 251: 2 readings (modes A, B, E)
 
     if n == 254:
         u2 = readADC(k0[ruv])   # result of 2. conversion
         du = u1 - u2
     else:
-        u2 = readADC(k0[1])     # result of 2. conversion, mode B for INL test
+        u2 = readADC(k0[ruv])     # result of 2. conversion, mode B for INL test
         #du = u1-0.5*(u2+u2old)      # TODO should be only for mode B? Or better avg 0V reading even for mode A/E?
         du = (3*(u2old-u1)-u1old+u2)/4   # interpolate both values
 
     #f.write('{:11.3f}\t{:11.3f}\t{:13.4f}\t{:6.0f}'.format(u1, u2, du*sf, adcdiff))
     writeraw()

New comparison of 3 run-up modes P: fast, Q: normal, W: slow (P shows higher noise, W lower than Q) were made.
Each measurement was repeated 3 times and best with lowest noise was chosen for comparison (only values with original FW were kept in table for reference).
This time only one out of 18 showed pronounced 1/f noise, no popcorn noise was spotted.

Both modes (A/B) do not show significant differences, in mode B there is a marginal difference between run-up versions (see attachments), this means no relevant effect from DA.
There is some gain error ~0.1ppmFS, therefore the trailing values were matched manually for better comparison and the results in the table should be handled with some grain of salt.


Comparison table mode A (AZ):
Input | dev to 0V in µV | -> in ppm (10V) | dev to +-7V in µV | -> in ppm (10V)
7V orig FW19.71.97-27.7-2.77
-7V orig FW-12.9-1.29-19.0-1.90
7V adc first RU Q0.40.04-7.4-0.74
-7V adc first RU Q-0.5-0.05-3.6-0.36
7V adc first RU W0.40.04-7.1-0.71
-7V adc first RU W-0.6-0.06-4.9-0.49
7V adc first RU P0.70.07-7.1-0.71
-7V adc first RU P-0.6-0.06-3.6-0.36
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on January 12, 2022, 08:16:37 am
Part of the slightly different gain for the 2 run-up modes is from settling (µs time scale) of the integrator.  A faster setting of the integrator can improve on this. The gain difference corresponds to the slope seen in mode B comparing 2 versions.

It is a bit strange to see that the settling / delayed effect is similar for cases P (fast) and W (slow), but a bit different from the intermediate case.
For a DA caused effect one would expect more delayed effect for the slow mode.
Anyway the effect is small (settling to 0.2 ppm within some 80 ms is quite good).
So much of the delayed effect that I also saw with the original FW is fixed with switching the input signal only after reading the µC internal ADC.
Title: Re: DIY high resolution multi-slope converter
Post by: RikV on February 24, 2022, 11:53:31 pm
Is there a Github repostory linked to this thread?
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on February 25, 2022, 01:11:49 am
Is there a Github repostory linked to this thread?

The project for the ATMEGA version is now on github: https://github.com/Multi-slope-ADC?tab=repositories
Separated into four parts:
  • PCB from Rerouter - BOM & additional information under Releases (https://github.com/Multi-slope-ADC/PCB/releases)
  • Firmware
  • ADC control program (Free pascal)
  • ADC control program (Python)
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on March 14, 2022, 12:44:04 am
Took a while but now there are the promised INL measurements.
FW is same as prior - late input MUX switching (and mode B with same run-ups - not relevant for INL).
K238 was used as the voltage source with 4th order LPF and 3458A as reference.
K238 was stepped through the ranges in both directions, the ADC was set to mode A (AZ) with run-up W.
ADC & 3458A are set to 1 PLC and capture isochronous (correlated).

Fullscale -11 .. 11V:

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1438837)

Let's just call it good enough for 8.5 digits - limited by LM399 LF noise, 3458A and test-setup  :popcorn:


Problematic range around -300mV (K238 & 3458A in 1V range):

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1438843)

Not to bad, but spoiling the INL quite a bit - could be corrected in software
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 14, 2022, 09:14:08 am
The INL result looks really good. The 20 mV periodicity should be the run-up steps and chances are the DA could be a large part of the residual INL error. So it may be interesting to also test the range around 300 mV with a slightly faster run-up mode (e.g. version V).
For the problematic region it already helps to know where it is - the range around -300 mV is not used that much, especially not as much as readings close to 0.

Is the first, full range curve really done without auto zero mode ? In this case the noise is surprisingly small and little drift effect. This could explain why the reference noise (going up with larger voltage) is not so pronounced.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on March 14, 2022, 05:49:24 pm
Run-up Q and V will follow...

Yes, full-range is evaluated w/o zero reading and problematic region with zero reading.
Strange thing is that the noise of the readings is higher when evaluated with zero reading  :-//.

Difference between non AZ and AZ is negligible for full-range (6 runs combined - same data as last post):

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1439149)

But not for the problematic region, where the curve is less noisy and better shaped with AZ :wtf: (2 runs combined - same data as last post):

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1439155)

Direct comparison of the two runs with AZ shows very good matching, the non AZ show more deviation:

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1439161)

1st run (descending):

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1439167)

2nd run (ascending):

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1439173)

The lesser overall noise for the problematic region is mainly due to 3458A set to 1V range (same with K238, but should not contribute that much)
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 14, 2022, 07:47:14 pm
The non AZ mode adds extra low frequency noise, but it also samples the input all the time and this redues the noise bandwidth. Longer sampling also helps with noise from 236 signal source and getting better correlation with the 3458 DMM.  The noise of the DIY ADC is only one part of the total noise and the extra 1/f noise seems to quite low.  With the 236 in the 1.1 V range the noise is already quite a bit lower and there the extra 1/f noise from the non Az mode than gets important.

The RMS noise calculated from the mutiple reading to average is more of the higher frequency noise and does not include the extra 1/f noise that effects the non AZ readings. So for the +-1 V range the non AZ mode reading get a lower RMS noise, but still shows the more jagged (noisy) INL curve. For the full range the difference may not be so relevant as there is more noise from the 3458 and the K236 source.
The 1/f noise would be visible in the difference between runs.


The choice of AZ and non AZ mode should also effect the INL error due to the slow part of the DA in the integration capacitor: In the Az mode there is a charge carry over between the signal and zero reading and thus from positive to a negative effect. This increases the INL effect for the intermediate time scales (e.g. around 20 ms). With the non AZ mode the carry over is between one conversion and the next, nearly negating the effect of slow DA, especially the intermediate time scales.
The very similar INL error for the AZ and non AZ mode thus suggests that the slow DA is not the dominant contribution to the INL.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on March 14, 2022, 10:53:55 pm
The non AZ mode adds extra low frequency noise, but it also samples the input all the time and this redues the noise bandwidth. Longer sampling also helps with noise from 236 signal source and getting better correlation with the 3458 DMM.  The noise of the DIY ADC is only one part of the total noise and the extra 1/f noise seems to quite low.  With the 236 in the 1.1 V range the noise is already quite a bit lower and there the extra 1/f noise from the non Az mode than gets important.

The RMS noise calculated from the mutiple reading to average is more of the higher frequency noise and does not include the extra 1/f noise that effects the non AZ readings. So for the +-1 V range the non AZ mode reading get a lower RMS noise, but still shows the more jagged (noisy) INL curve. For the full range the difference may not be so relevant as there is more noise from the 3458 and the K236 source.
The 1/f noise would be visible in the difference between runs.


The choice of AZ and non AZ mode should also effect the INL error due to the slow part of the DA in the integration capacitor: In the Az mode there is a charge carry over between the signal and zero reading and thus from positive to a negative effect. This increases the INL effect for the intermediate time scales (e.g. around 20 ms). With the non AZ mode the carry over is between one conversion and the next, nearly negating the effect of slow DA, especially the intermediate time scales.
The very similar INL error for the AZ and non AZ mode thus suggests that the slow DA is not the dominant contribution to the INL.

To be clear: The dataset is the same for AZ and non AZ evaluation, the raw values from adc are recorded (input & zero reading) and all processing is made offline.

The K238 (incl. 4th order LPF -3db@0.04Hz) does only contribute little noise, because the readings of ADC and DMM are correlated (isochronous equivalent acquisition) and the data processing works on those value pairs (triples with AZ).
There is no time interpolation done as usually, the differences between ADC and DMM are calculated on a per sample basis and aggregated into one datapoint for INL afterwards.
This was neccessary for the ability to ramp the input voltage continous to capture more voltage levels in one go and get the wiggly parts (bit like in the INL test between different run-ups).
This worked out somehow, but not good enough at that level were the INL is (noise from jitter exceeds 0.1ppm with 1000 rolling mean over input).

One of the best ramp INL-tests I got:
(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1439389)

Processsing for one staircase is as follows (excerpt):
- Linear regression for dmm & adc
- Scaling adc from slope ratio of both regressions (gain normalization)
- Offset correction for adc
- Diffs between adc & dmm on a per sample basis gives INL (correlated)
- Aggregation to one point for INL
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on March 15, 2022, 09:48:23 am
Short follow-up for INL range -1 .. 1V (2 runs), no surprises:

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1439707)

Separated runs are attached.
Title: Re: DIY high resolution multi-slope converter
Post by: miro123 on March 16, 2022, 07:30:29 am
Hello,
I have one question. What causes the consistent jump around -320mV?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 16, 2022, 08:02:56 am
The -320 mV point is the center of the range and thus the point with a 1:1 positive / negative ratio for the feedback steps. This results in quite some change in the average intergrator voltage and the variations in the integrator voltage are large in this range. There is also the transitons from the cases with 2 postive phase in a row to 2 negative phases in a row. This effects how switching transitions can interact.

It is not totally clear what is than causing the INL error. The prime candidate is the DA in the integration capacitor, so the capacitor giving back some of it's charge only with a delay.
There are also a few other possible contributions. In my early versions I had some interaction with the clock frequency and improving the decoupling there and the extra FF for synchronization had quite some effect.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on March 16, 2022, 08:56:04 am
Results for run-up V (faster than W, same as Q) with same setup as prior tests with run-up W.

No surprises, the noise is higher and the INL shape is slightly curved downwards to both FS sides (5 runs):

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1440361)

-1 .. 1V, showing the problematic region (2 runs):

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1440367)

problematic region in detail (2 runs):

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1442473)


Comparing to prior INL differences between run-up versions (https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/msg3844052/#msg3844052):

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1335545)

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1335551)
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 16, 2022, 09:27:34 am
The smaller error around -320 mV points towards DA as the reason behind that error. The effect from DA is expected to get smaller with faster modulation, while most other canditates for INL are either not effected (e.g. thermal effects at the resistors, nonlinear fet resistance, buffer amplifier) or would get stronger with faster modulation (e.g. settling effects, inductive coupling, charge injection effects).

It is a bit surprising to see quite some (still not so bad, but visible) bending / quadratic contribution to the INL with the faster (twice the frequency) modulation. The main mechanism I suspected for a quadratic term was the switch resistance and this should not be effected by the modulation frequency.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on March 17, 2022, 07:57:43 am
Results for run-up Q (faster than W, same as V) with same setup as prior tests with run-up W & V.

-10 .. 10V (4 runs):

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1441279)

-1 .. 1V, showing the problematic region (2 runs):

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1441285)

problematic region in detail (1 run):

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1442464)
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 17, 2022, 08:27:21 am
At least in my SW version the modes V and Q use the same modulation frequency for the feedback, and the difference is only in the length of the shortest pulses. Here the mode V has longer min pulses (comes with the downside of a slightly reduced full scale range) and is less sensitive to integrator settling.

Even for the test in the +-1 V range some of the fine structure around -300 mV may be missed.  With faster modulation the excursions in the INL are expected to also get more local ( e.g. half the horizontal scale for modes P and V compared to W). So it may be interesting to also have a more detailed curve (e.g. -360 to -260 mV) for the faster modulation to do the comparisons to the mode W (there is already a detail curve).

In principle one could add some dithering to the ADC, at least for the slower results (more than 1 PLC). For the initial phase one could add some offset (e.g. half a run-up step), like shifting the curve some 5 or 10 mV horizontally and than average. This could smoothen the INL curve and reduce the error from local effects quite a bit.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on March 17, 2022, 09:07:40 am
At least in my SW version the modes V and Q use the same modulation frequency for the feedback, and the difference is only in the length of the shortest pulses. Here the mode V has longer min pulses (comes with the downside of a slightly reduced full scale range) and is less sensitive to integrator settling.

Even for the test in the +-1 V range some of the fine structure around -300 mV may be missed.  With faster modulation the excursions in the INL are expected to also get more local ( e.g. half the horizontal scale for modes P and V compared to W). So it may be interesting to also have a more detailed curve (e.g. -360 to -260 mV) for the faster modulation to do the comparisons to the mode W (there is already a detail curve).

In principle one could add some dithering to the ADC, at least for the slower results (more than 1 PLC). For the initial phase one could add some offset (e.g. half a run-up step), like shifting the curve some 5 or 10 mV horizontally and than average. This could smoothen the INL curve and reduce the error from local effects quite a bit.

Corrected run-up V to have same modulation frequency as run-up Q in former post.
Is there an overview of the modulation frequencies and details for all the run-up versions?

Detailed curves around -300mV are already running, results tomorrow.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 17, 2022, 09:29:46 am
I had an overview in an earlier desciption.
X is the parameter xdel in the program to extend the length (could be something around 10)
The length of the active phases and the fixed phases (min pulse lenght) in clock cycles are:

 P =  fast             35+3*x  , 8   , 8         
 Q =  normal        78+6*x  ,12  , 12       2nd version for mode B
 R =  short pulse   86+6*x  ,8    , 8
 V =  long pulse    66+6*x  ,18   ,18
 S,T   4 step mode             - causes extra INL error from settling
 T = dummy 4 step mode with no input signal
 U =  4 step with 0 phase
 W = slow           168+12*x ,18 , 18

So the periode lengths are in a 1:2:4 ratio
Title: Re: DIY high resolution multi-slope converter
Post by: Chen Li on March 19, 2022, 12:48:42 am
Sir, may I ask you compared with off shell commercial adc, why would us diy adc like hp do in 3458a? And have a conclusion of your project, compared with adc in 3458a, how this diy adc perform? I want to diy and share an open source dmm, and if I implement your adc design, how far it will go, 6.5 digit? Thank you very much sir.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on March 19, 2022, 08:08:56 am
Detailed curves around -300mV for run-up Q & V are added to the corresponding former posts, R & P follow.

Sir, may I ask you compared with off shell commercial adc, why would us diy adc like hp do in 3458a? And have a conclusion of your project, compared with adc in 3458a, how this diy adc perform? I want to diy and share an open source dmm, and if I implement your adc design, how far it will go, 6.5 digit? Thank you very much sir.

3458A ADC has INL <0.1ppm (HP Journal p. 14 (http://www.hpl.hp.com/hpjournal/pdfs/IssuePDFs/1989-04.pdf#page=14)), TC ~0.4ppm/K (HP Journal p. 13 (http://www.hpl.hp.com/hpjournal/pdfs/IssuePDFs/1989-04.pdf#page=13)), noise input short ? (~0.1µV AC RMS @100PLC incl. frontend), long term drift ? (Keysight allows up to 0.43ppm/day according to SN18A (https://xdevs.com/doc/HP_Agilent_Keysight/3458A/service/3458A-18A.pdf))
DIY MS ADC has INL ~0.1ppm (excl. around -300mV), TC tbd, noise input short ~0.06µV AC RMS @100PLC (w/o frontend - 3 reads ru W (https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/msg3725002/#msg3725002)), long term drift tbd

Performance of a DMM with this ADC will be limited mainly by references and frontend.
E.g. LM399 is good up to 6.5 digits, selected up to 7.5 digits.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 19, 2022, 09:53:19 am
Some modern ready made ADC chips ( AD7177,  AD4630, LTC2500-32) got impressive performance, both from the noise and also the INL. These chips are still expensive and need special drivers and a 2.5-5 V reference (the usualy high end references are 6.6-7 V). So even a ready made ADC chip would need some critical circuit around it (ref. divider and buffer, maybe input divider, input driver).
The more common SD ADCs are cheap and relatively easy to use, but they are also more noisy and higher INL (e.g. 1-5 ppm range).
The SD chips are low power and small - so at the lower end range with 5.5 and 6.5 digits they are a very viable way.
SD ADC usually also offer different choices of frequency response / digital filtering (e.g. sinc³ filter). This can help, but also make a comparison difficult.

A seprate build MS-ADC has the advantage of getting a native range of some +-10 or similar, so that one can directly measure a 10 V or 7 refrence. They can use a 7 V reference (LM399, LTZ1000,...) without an extra divider. The INL is often better than most (if not all) of the SD chips.

The DIY ADC so far is noise wise at the level of the 8.5 digit DMMs, that is comparable to the 3458 or Fluke8858 or the AD7177 ADC chip.
Speed wise the software is mainly made for the 1 PLC case, slower is included but of limited interest. Faster is possibly but not tested very much. I had initiall tests working with 100 µs integration time as well - here the data transfer is the more limiting factor. As the rundown takes some 100-150 µs the current version is never as fast as 3458 in it's fastest modes, but still OK for a normal DMM.

The last linearity measurements from MIDI are very promissing, putting it in the 8.5 digit range. My test had a little more INL (and more uncertainty in the tests), but still better than most ready made ADC chips.

For me the important point is getting the INL good enough to allow using an ACAL procedure similar to the 3458, at least for the 6 digit range. This helps expecially for a DIY project with little means to adjust the other ranges. It also helps to get long term stability, which is otherwise difficult without long experience on aging of the parts.  In this sense it is OK to combine a rather high performance ADC with "only" a LM399 reference that limits the performance to the 6-7 digit range. After all the ADC circuit is still relative simple / low cost, more comparable to the ADC in the 34401 or Keithley 2000.
Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on March 20, 2022, 06:28:56 pm
Comparison of different run-up versions:

Full-range:

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1444363)

Run-up V, P, R showing curves bent downwards, while Q & W seem to be quite linear.


Problematic region V vs. W (same fixed time 18/18, W has half the modulation frequency of V):

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1444369)

Problematic region P vs. R (same fixed time 8/8, R has half the modulation frequency of P):

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1444375)

Problematic region R vs. Q vs. V (same modulation frequency, but different fixed times R: 8/8, Q: 12/12, V: 18/18):

(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1444381)
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on March 20, 2022, 07:34:37 pm
The run-up versions R, Q and V are with the same frequency (and thus similar DA effect expected), but different (increasing) minimum time for the short phase. This makes the settling of the integrator more important for case R and less important (more time for settling) for case V.
AFAIR the mode V already has a slightly limited full scale range and there is no real need to use the very short pulses like in case R.

Comparing the critcal range for V and W, there is some imporvement, but not directly a factor of 2. So the INL errors more looks like a mix of several effects ( DA and some settling/ switching related part).

One more parameter to change may be the integration time at a piece. At least 2 and maybe 4 PLC at a piece should work with only little more noise and may lead to slightly better INL.
Title: Re: DIY high resolution multi-slope converter
Post by: miro123 on March 25, 2022, 10:57:42 am
I have an question
How the INL test performed?
 - startup time / stabilization etc.
 - steps sequence
 - measurement equipment settings
 - PC post processing.
 - timing
 - logging information - temperature , at which point to sense temeprature, humidity, atmospheric pressure
To many questions. Isn't it? :-) :)





Title: Re: DIY high resolution multi-slope converter
Post by: MiDi on March 25, 2022, 03:44:48 pm
I have an question
How the INL test performed?
 - startup time / stabilization etc.
 - steps sequence
 - measurement equipment settings
 - PC post processing.
 - timing
 - logging information - temperature , at which point to sense temeprature, humidity, atmospheric pressure
To many questions. Isn't it? :-) :)

To answer the last question first: no  :box:

startup time: ~220s
stabilization: 45s settling of 4th order LPF (postprocessed), ~400s measurement / ~4500 values for each step (as 3458A is slower than ADC, only every 2nd ADC cycle is captured quasi isochronously)
steps sequence for +-11V (see attached charts): 500mV steps (~440mV @ input), 4x ramp down & ramp up (8 ramps), +-1.1V/-300mV: 10mV/1mV steps 1x ramp down & ramp up (2 ramps)

Settings 3458A (connected to the input of ADC):
Code: [Select]
PRESET FAST
DCV {int(range)} #10V or 1V, depending on range of source (constant over one run)
AZERO ON
TARM HOLD
TRIG SYN # only capture data on read
NPLC {int(nplc)}
FIXEDZ OFF
ARANGE OFF
NRDGS 1,SYN
MEM OFF
END ALWAYS
DELAY 0
TARM SYN # only capture data on read

Settings K236/7/8:
Code: [Select]
F0,0XB{float(Source.start_value)/1000:7f},{Source.range_set},0X # Function: F0,0 = source V, B: Range setting 0 = Auto, 1 = 1V/nA, 2 = 10V/nA, 3 = 100V/nA, delay = 0 in ms
H0X # only with immediate trigger it sets the output
N1X # N1 = operate
O0P0Z0S3W0L10E-3,8X # other settings O0 = local, O1= remote sense, P5 = Filter 5 = 32 readings, Z0 = suppression disabled, S3 = 50Hz 20ms integration time, W0 = disable default delay, L compliance 0=auto range

Settings ADC:
Code: [Select]
[init()] #reset, initialise & gain corrections (k factors)
A # mode: A=AZ
[run-up] # run-up version W, Q, ...
[input_ch] # input channel of mux (0..7)

Post-processsing for one staircase is as follows (excerpt):
- Linear regression for dmm & adc
- Scaling adc from slope ratio of both regressions (gain normalization)
- Offset correction for adc
- Diffs between adc & dmm on a per sample basis gives INL (correlated)
- Aggregation of n Diffs to one point for INL

From the results of the single staircases (e.g. 8 ), the outliers are sorted out and the remaining good staircases are aggregated for final chart

Timing between 3458A and ADC is quasi isochronously, so we get correlated value pairs (triples for ADC AZ), see details in former post (https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/msg4062025/#msg4062025).
Side-note: this was a major development  task, with all the oddities of UART-to-USB-adapters, incorporating a PLL and much more little things you never dreamed of and gets you nightmares...

Temperature (humidity, atmospheric pressure) is usually stable enough for one staircase (usually <0.1°C - lab is in basement), limiting is probably most the drift/LF noise of the LM399.

excerpt of the python code to generate staircase e.g. +-11V:
Code: [Select]
src_set_values = collections.deque() # list of values for voltage source (K236/7/8), each value for one ADC cycle

# +-11V
range_set = int(2) # range of K236/7/8 - 1: 1V, 2: 10V, 3: 100V, 4: 1000V
factor = int(10**(int(2-range_set))) # multiply start/stop value for stepping in range: 1: *10, 2: *1, 3: *0.1 = *10^(2-[range])
stop_value = int(12500) # gives ~11V on ADC input due to 4th order LPF (4x2x1kΩ, 4x220µF)
stop_value_range = int(stop_value*factor) # max value in range-steps of K236/7/8, for 10V range: factor = 1 (see factor)

#Staircase +-11V
for _ in range(5000): # 5000 * ADC cycletime initial value (~220s +11V)
src_set_values.append(stop_value_range/(1000*factor))

step = int(500)
repeats = 2
for _ in range(4): # generate staircase with steps of 500mV with 2x500 values for each step (440s) going from +11V .. -11V .. +11V repeated 4 times
for i in range(stop_value_range - step, - (stop_value_range + 1), -step):
for _ in range(repeats*step): src_set_values.append(i/(1000*factor))
for i in range(-(stop_value_range - step), stop_value_range + 1, step):
for _ in range(repeats*step): src_set_values.append(i/(1000*factor))

src_set_values.append(0) # set source to 0V

Test-Setup (old picture, cable to 3458A not installed):
(https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/?action=dlattach;attach=1335539)
Title: Re: DIY high resolution multi-slope converter
Post by: branadic on May 27, 2022, 12:26:58 pm
Any updates?

-branadic-
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on May 27, 2022, 03:28:44 pm
Any updates?
-branadic-
Currently no real news:

The software (for the ARM based version) needs a rewrite to include full control for the amps an ohms part. The current version lacks some of the relay control. My first try on a rewirte failed half way through.
For the 2nd try I have the ideas, but no code yet. It's not about the ADC part itself, but the tricky part is having things like a dual measurement and the ACAL procedure without getting too much code.

The ADC part seems to work fine: low noise (about on par with the 3458 at 1 PLC) and from MIDIs measurements the INL also looks good already at 1 PLC and a little hope that it could even get a little better with 4 or 8 PLC integration at a time (not yet tested).
The ACAL procedure still has a little more than hoped for difference between the positive and negative side, though still not too bad. It could well be the amplifier part that has problems.

The DMM frontend for the main part works but still has 3 issues:
First is with leakage at one of the reed relays. I get very slow oscillations when measureing the voltage at a high impedance source (e.g. > 5 M) at the ohms source terminal. Without the relay the lowest current range (some 2 µA FS) is missing. The problem looks fixable with an additonal CMOS switch and maybe a different relay.

A second issue is a little unexpected extra noise at the front end, like some hum or effect of supply ripple adding some 30 nV of low frequency noise to the input. So while the higher frequency noise looks good, over longer time the noise does not average out well. I suspect the DCDC converter with it's spread spectrum part that does a modulation at some 50 Hz and may thus give me a low beat frequency. The DCDC converter (SN6505) part is definitely a part to change - it is currently out of stock anyway.

The more serious weakness is with the 200 mV range of the voltmeter front-end: it too does not like a high impedance source. With more than some 100 K it tends to oscillate. I can shift the limit a little with more capacitance at the input, but no easy fix so far.
I got an idea (actually 2 versions) to modify the input section so this problem should no longer happen. It somewhat interferes with ohms readings (the ranges are cut in half and the high ohms may have a little more drift), but otherwise should work, with only slightly more noise in the 200 mV range. The change for 1 version is small enough to try as a bodge to the existing PCB. The other, more clean version would likely need a new PCB.
Title: Re: DIY high resolution multi-slope converter
Post by: Anders Petersson on May 27, 2022, 06:24:52 pm
Happy three year thread anniversary!
Do you have a target specification to bring us newcomers up to speed on the project scope?
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on May 27, 2022, 08:06:02 pm
There is no real target specs. There was a rather modest one at the start of the project, looking for something like 5 µV noise and 1 ppm of INL to make it a usable 6 digit meter while keeping the circuit simple. It by now well exceeded that.

By now with small refinements (manily better resistors, layout improvements, reference filtering,  74AC74 for synchornization and the LV4053 instead of HC4053) the noise is down to about 500 nV (for 1 PLC AZ mode in the 10 or 20 V range) and thus 7 digits and more with averaging.  From the calculations the noise is not expected to go below some 430 nV with this circuit. So there is still a little noise not accounted for (e.g. supply ripple, mains hum, additional jitter), but not that much anymore.
The INL looks good enough (likely better than 0.2 ppm of FS), but the measurements at that level are hard. A minimum target for the INL is to have it good enough to use the ADC to link the DMM ranges to each other with good accuracy.

I consider the actual ADC part finished - maybe a few more INL tests and maybe SW for faster than 1 PLC conversions, but not sure if this would happen.

For me the main point now is more the DMM front end part, that is DC only. The front end so far is for ranges of 400 V(~ 300 V because of relay rating), 20 V, 3 V (using an on hand resistor, should be 2 V), 200 mV, some 1 A, 100 mA, 10 mA , 1 mA, 300 µA, 30 µA, 3 µA with limitations, optional 2 µA and lots of ohms ranges from some 20 Ohms (10 mA test current) to some 2 Gohms (8 nA test current - but limited stability, may change to 1 Gohms). In principle the calibration should be to 1 voltage and 1 resistor. The amps and Ohms part is not yet tested in this respect. The SW still needs quite some work.

The main limitations are missing AC functions, limited maximum voltage and somewhat limited protection and so far no display, but data send to the PC only, some even in a raw format. E.g. the ACAL part needs support on the PC side.
The voltage ranges are still limited by the LM399 reference. Similar the resistance reference is a plastic case foil resistor only - so not very stable either, but Ok for a proof of concept.
Title: Re: DIY high resolution multi-slope converter
Post by: Echo88 on April 21, 2023, 10:34:37 pm
Came across this and assumed this is the most relevant thread for it...
https://hackaday.io/project/190528-multislope-adc

Edit: As hes apparently also on this forum and showed his design, this link is unnecessary. Doh.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on April 22, 2023, 07:20:34 am
A pity the hacker "NNNI" is not discussing his design here (even he mentions the eevblog directly and indirectly there), perhaps the experts here could help him with the noise and none-linearity of his multislope design..
Title: Re: DIY high resolution multi-slope converter
Post by: branadic on April 22, 2023, 07:58:25 am
He discussed his multislope design here (https://www.eevblog.com/forum/projects/(yet-another)-diy-multislope-adc/) and was also looking for help/support at MM2022. There are even some videos on youtube by him about his design.

-branadic-
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on April 22, 2023, 08:20:46 am
That design on Hackaday still has a linearity problem from too small resistors at the interator input: The on resistance of FETs and CMOS switches is somewhat nonlinear and this is the main cause of the square law INL. For the SN74LV4053 switches with 3.3 V supply appropriate resistors are more like 50-100 K, not 10 K.

The ADC seems to be working a bit like the MS-3 ADC of the 34401. So no extra rundown and just reading the residual charge. This means the resolution is likely somewhat limited, even though the µC internal ADC can be a little better than that of the 80196 in the 34401.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on April 22, 2023, 09:44:26 am
He discussed his multislope design here (https://www.eevblog.com/forum/projects/(yet-another)-diy-multislope-adc/) and was also looking for help/support at MM2022. There are even some videos on youtube by him about his design.

-branadic-
Ok, my bad.. I even made a post there..  :palm:
Title: Re: DIY high resolution multi-slope converter
Post by: r6502 on May 05, 2023, 11:44:15 am
Hello all,

interesting discussion here. I have rough looked from the start to the end.

Q:
Is there somewhere a simplified scheme with a description of the of the individual sections and the timings - would be very helpfully to understand what's going on.

May be I've missed it?

Guido
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on May 05, 2023, 01:11:07 pm
I don't remember showing a really simplified version of the schematics. 

There are more of less complete versions: for the AVR version the very first post has a schematics that is still largely up to date for the ADC. The µC should however get an external clock oscillator and not use just a  crystal. The input buffer as shown has also problems.  There is some description of the parts and on the timing in the first few posts too (my 3rd / 4th post in the thread).
A part to change from the old sequence / timing is to change the input only after the µC internal ADC is read and do a 2nd conversion of the µC internal ADC for the starting value of the new conversion. So the run-down part takes a little longer.

Later on there is a plan for the STM32 based version ( https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/msg3827432/#msg3827432 (https://www.eevblog.com/forum/metrology/diy-high-resolution-multi-slope-converter/msg3827432/#msg3827432)) including the DVM front end.
The analog part of the ADCs is still essentially the same with only minor differences.
The main part added is synchonization of the control signals with extra flip-flops (needed with the ARM to also do level shifting).
The DVM front end part is a bit unconventional and not necessary a part to copy, though with the tweaks is works OK.
Title: Re: DIY high resolution multi-slope converter
Post by: 3roomlab on May 06, 2023, 10:49:05 pm
Hello all,

interesting discussion here. I have rough looked from the start to the end.

Q:
Is there somewhere a simplified scheme with a description of the of the individual sections and the timings - would be very helpfully to understand what's going on.

May be I've missed it?

Guido

maybe this?
https://www.eevblog.com/forum/projects/multislope-design/?all (https://www.eevblog.com/forum/projects/multislope-design/?all)
Title: Re: DIY high resolution multi-slope converter
Post by: NNNI on June 10, 2023, 08:40:44 pm
A pity the hacker "NNNI" is not discussing his design here (even he mentions the eevblog directly and indirectly there), perhaps the experts here could help him with the noise and none-linearity of his multislope design..
Hello! Apologies for not being very active here, somehow I find myself more active on Discord and just got around to reading some of the threads here and randomly found a mention ;D
As for updates regarding the project, I've been writing a lot of logs under the Hackaday project documenting some of the problem fixes.
First off, regarding residue ADC noise - that turned out to be improper decoupling and layout, I investigated that here: https://hackaday.io/project/190528-multislope-adc/log/218489-a-path-forward
Second, regarding the non-linearity: I was just recently advised that the 10K input resistor's PCR was causing that since the INL curve was clearly parabolic. I don't remember exactly who it was, but they recommended using a 10K input resistor for increased resolution and better TC tracking with the reference resistances. There is one resistor in the network that's not being used for anything useful, so I'll probably reconfigure the input resistor to 2 10K in series and see if that changes the INL in some way. I also came up with a fully analog PCR compensation circuit, but that might be somewhat overkill. https://tinyurl.com/2osjob8x
I'm slowly working on fixing the ADC's problems (with every day that passes, I realize how badly I half-assed it last time  |O ) and I hope to have some good results to show in the near future. I also got hold of some TMUX1134 which I might use in a future revision.
MM2022 was quite enjoyable but a little overwhelming since I'd been in Germany for less than two weeks and being among such amazing people left me in a daze. I've spent the last nine months settling down here so not much time to work on projects.
For now, I think I'll do most of the documentation on Hackaday and update the thread I started once I get better results.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on June 10, 2023, 09:06:16 pm
With respect to INL the 10 K resistors for the input and reference are quite a bit on the low side for 2 reasons. The relatively high current makes 2 INL contributions larger:
1) the self heating of the 10 K resistor at the input in combination of the TCR of the resistor (or the relative TCR if in an array with the reference resistors. This part leads to mainly a thrid power contribution.
2) the CMOS switches are slightly nonlinear. As a crude first approximation about half of the voltage drop on the on resistance adds to the effective gat votlage and this changes the on resistance. As a first part this gives a square part in the INL. How important that part is depends on the R_on of the switches.

The reason why one would want a not too large resistors is because the resistors can add quite a bit to the noise. In my design (and also for the HP3458) the resistors contribut about half of the total ADC noise with resistors of 50 K for the input. So the resistor value is a kind of compromise between noise and INL contributions. The of the shelf arrays somewhat limit the available choices.
Title: Re: DIY high resolution multi-slope converter
Post by: NNNI on June 10, 2023, 09:43:50 pm
This is my first time hearing about the non-linear on resistance of analog switches, I suspected that PCR was the primary contributor to the parabolic non-linearity. Thanks for that tip, I'll keep it in mind. The SN74LV4053 has a worst case on resistance of 190 ohms at 3V, but the TMUX1134 at around the same supply voltage has 8.8 Ohms worst case.
As for the resistor values, NOMCT comes in 20K, 25K, 50K and 100K. I'll see if I can get hold of some of the higher resistance ones. 
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on June 10, 2023, 09:57:20 pm
In my ADC I use the LV4053 with 5 V supply and a measured on resistance of some 20 Ohm. With 10 K resistors (and 10 V at the input) the INL contribution is quite significant already. So even the TMUX1134 may want a little more than 10 K - maybe 20 K as a resonable lower limit. Besides the R_on a higher supply voltage also help in reducing the voltage dependence.
The 50 K resistors already allow quite low a noise and noise wise there is little need to go much lower with a 10 V or similar input range.
Title: Re: DIY high resolution multi-slope converter
Post by: iMo on June 11, 2023, 06:37:57 am
Nice to see this thread (as well as the other related) has not bitten the dust!
Hopefully, after the years of elaborating the Multislope here, we would soon see an easy to build design with 7.5+digits resolution here :D
Title: Re: DIY high resolution multi-slope converter
Post by: NNNI on June 11, 2023, 10:26:07 am
Has anyone already taken a look at Agilent's Multislope-IV implementation that's used in the 34410A already? I just managed to find someone who let me borrow their L4411A (which basically has the same insides as a 34411A) for further investigation. There was a small description of MS-IV in The Art of Electronics 3rd Edition pg. 921 footnote 61, but that was not very clear to me.
I will definitely be posting the results of my investigation here.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on June 11, 2023, 11:49:04 am
The multi-slope 4 ADC is a bit strange with quite some effort. It is good for high speed (e.g. some 600kSPS for the AC mode), but not great for linearity or overall noise at low speed (e.g. 1 PLC). There is a patent that describes the basics, but leaves out a lot of the details.  I see it more like a variant of a contineous time sigma delta ADC and not so much a multi-slope ADC. Already the multi-slope 3 lacks the multiple rundown slopes of the more classical MS ADC (e.g. HP3458, 3456, Keithley2000). The main point of the MS-3 is low cost, not better performance than the older MS-2 (e.g. 3456, 3457).

The ADC type shown here in the thread is still more like a classic multi-slope ADC with a rundown, but the auxiliary ADC instead of the integrator reset. One could also see it as an improvement on the MS-3, by just adding the run-down part of the classic MS-ADC. Also the hardware side is still quite similar.
The MS-4 is a more radical change and in a different direction: even higher modulation frequency (kind of in a brute force way), switching on the voltage side and quite some effort. This is more like a step up in performance, at least with noise and speed.
A point that does not make it attractive for a DIY build is that it needs quite a lot of parts, including fast ADCs and the control part kind of needs a FPGA for the high speed. It is impressive speed, but awfully complicated.
Title: Re: DIY high resolution multi-slope converter
Post by: NNNI on June 11, 2023, 12:34:05 pm
The thing that leaves me most confused about MS-IV is its apparent complexity, but at the same time upon analyzing the schematics it looks like a regular multislope with a couple of extras. The first one is the DAM switch, described in detail in US Patent 6876241. From what I can see at least, it's basically just a level shifter and a CMOS output stage, somewhat like a logic inverter. I assume they had to come up with this because analog switches were not fast enough for what they were planning. The second thing is that they read the integrator waveforms using a coarse ADC, and according to AoE 3 this is so they can keep the integrator bounded. A window comparator would have worked for that as well, but there must have been a good reason to do it using an ADC. I hope to figure most of this stuff out once I get a closer look at the ADC waveforms. I did some calculations about reading speed in this log: https://hackaday.io/project/190528-multislope-adc/log/219031-integrators-dam-switches-and-speed

Regarding multiple rundown slopes - do you think that might be one of the main reasons for low INL and noise? I assume that the ultimate limiting factor in a 34401A-style multislope is the residue ADC itself.

Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on June 11, 2023, 01:53:38 pm
The rundown part does not give good linearity. It is more like a way to get high resolution / low noise.
The MS3 ADC has one major weak point to start with: the limited resolution of the residual charge ADC. The resolution in (counts) is given by the auxiliary ADC resolution times the modulation frequency minus a little overhead.  Be sides the nominal resolution the ADC in the µC also has quite some noise (a few LSB). To get at least a little more resolution the modulation is chosen rather fast. By itself a good choice but it comes with compromises.

A second weak point comes from the relatively slow settling integrator, that needs quite some minimum length of the pulses and with the fast modulation this looses quite a bit of the input range. So quite a bit of the time is lost to the fixed ref. setting part. To still get a 12 V input full scale range this needed the effective divider with 100 K and 42 K to ground in the input path. The ADC would actually work better if the input would use 30 K and a 3 V input range instead - possibly an earlier design stage left over from the 3457. The divider at the input / only part of the range actually used amplifies quite a lot of the other noise sources in the ADC.
Title: Re: DIY high resolution multi-slope converter
Post by: NNNI on June 12, 2023, 10:27:59 am
Could you elaborate a little more about integrator settling time? I assume this would matter more during rundown or residue reading than during runup.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on June 12, 2023, 10:42:11 am
After switching the reference there is a small voltage pulse on the integrator input and it takes some time for settling after that. For the simple 1 OP-amp integrator this is a step in the voltage so a more permanent voltage. With the 2 OP-amp integrator one has a pulse only. The settling time depends on the speed of the amplifiers and other circuit details (e.g. RC at the input, divider between the stages).
The rundown part has only a limited number of switching events, so the settling part can cause some error, but only a rather small one. Especially for the initial part one can make sure the pulses are not too short. The run-up part may be more relevant because of many switching events (e.g. some 1000), but the timing could be more predictable so that some constant effect can be seen as part of the offset

For the residual charge reading it helps to have a fixed time from the last switching event (for the measurement on the fly) or enough waiting time (for the residual charge after rundown).
Title: Re: DIY high resolution multi-slope converter
Post by: NNNI on June 12, 2023, 11:25:31 am
I see, and would adding a small value (100s of pF) capacitor to the summing junction help mitigate these effects? almost all multislope implementations I've seen have such a capacitor.
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on June 12, 2023, 11:32:56 am
Capacitance from the summing junction to ground may help with the very fast part, but in most cases for the main visible settling it does not help or even makes things ring more.
To effect the settling it is more an RC series element that can make a difference in dampening ringing.
Title: Re: DIY high resolution multi-slope converter
Post by: Alex Nikitin on June 13, 2023, 02:39:48 pm
In my ADC I use the LV4053 with 5 V supply and a measured on resistance of some 20 Ohm. With 10 K resistors (and 10 V at the input) the INL contribution is quite significant already. So even the TMUX1134 may want a little more than 10 K - maybe 20 K as a resonable lower limit. Besides the R_on a higher supply voltage also help in reducing the voltage dependence.
The 50 K resistors already allow quite low a noise and noise wise there is little need to go much lower with a 10 V or similar input range.

Perhaps ADG6412 (https://www.analog.com/en/products/adg6412.html) worth a try? 0.5 Ohm and exceptionally linear across the voltage range.

Cheers

Alex
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on June 13, 2023, 03:20:56 pm
For my ADC configuration with switching at the integrator input there is no need for a 20 V switch. It is more about a good balance of on resistance, capacitance and charge injection.
Possible alternatives would be more other low voltage switches like max4619 or the aready mentioned TMUX1133.

The LV4053 with some 20 Ohm (5 V) is not such a bad choice and OK with 50 K input resistors. The nonlinear contribution is small (e.g. 0.1 ppm range) and if needed one could numerical correct for some of this or as in my current front end do an internal averaging over positive and negative reading, so that the U² part does not matter that much.
Even just 2 x LV4053 in parallel may work if less than 50 K for the input are wanted.

With smaller resistors also the self heating part gets more tricky and this part can be temperature dependent  and thus more difficult to compensate for. 
Title: Re: DIY high resolution multi-slope converter
Post by: dietert1 on June 13, 2023, 04:11:25 pm
Others use active current sources. The Advantest R6581T schematic shows active current sources for the unknown and for the principal rundown current. In the Prema 6048 the unknown is a current source, too. In some sense the rundown current source is active, too, as it includes a sense line to correct for the switch behaviour. Looks like active current sources are appropriate for a 8.5 meter.
To convert the run-down current source of a Prema 6048 into an active one for near ground current routing, one can use a dual opamp, a small mosfet and 2x 1K and 1x 10K resistors of an LT5400. The divider raises the reference from 7 to 7.64 V and then senses the current at 0.64 V. That is the headroom for the mosfet, the switch and maybe some kind of filter. One might use something similar for the unknown. A little more complicated if it needs to be bipolar.

Regards, Dieter
Title: Re: DIY high resolution multi-slope converter
Post by: Kleinstein on June 13, 2023, 05:04:12 pm
Active current sources offer some advantage, but also make the circuit more complicated.
As a downside one needs more complicated reference voltage levels and tends to loose a bit headroom. On the upside the switches can be low capacitance as the resistance does not matter that much. In the 6581 circuit one sees quite some effort (JFET+2 OP-amps) needed to make the current sources fast settling.
For the input part a current source is tricky - the prema solution with the extra supply is nice, but prone to pic up hum from the supply. This may need the PLL that is otherwise not that attractive.
A bipolar active current source for the input is more than just a little more tricky. Limiting the input to 1 polarity is a bit limiting.

One could combine current sources for the reference with a very low resistance (e.g. 1 Ohm range) for the signal input. Matching in the resistance / switches is to get TC compensation for the combined switch + resistor combinations. With a very kow on resistance the compensation is no longer needed. The input switch is only switched on/off once per conversion and capacitance thus less relevant.

For higher input and reference curent (to get even lower noise) active current source are definitely an option.
My ADC circuit was initial designed to get a rather simple multi-slope ADC. The higher performance target was later with a few minor changes (change HC4053 to LV4053, added sync flip-flops and adding filtering for the reference).
Title: Re: DIY high resolution multi-slope converter
Post by: NNNI on June 17, 2023, 12:09:37 pm
I was doing some LTSpice simulations of a composite integrator, and out of curiosity I tried different dividers on the output of the "slow" input stage op-amp. Looks like the divider ratio does determine how fast the integrator settles after the input current changes, just like Kleinstein said.