Prema BK7 derived meter - Page 1
Forum section: electronics / general

author: dietert1
author_rank: Super Contributor
timestamp: July 16, 2023, 07:48:59 pm
content: While studying the Prema 6048 and its BK7 microcircuit, we discovered some shortcomings and i want to study a little how one can improve. One of the weaker points was the timebase of the time division ADC implemented in the BK7 microcircuit. The Prema meters use a HC4046 VCO (RC relaxation oscillator) with a PLL. So there will be some phase noise and variable frequency. How to use a crystal oscillator instead? First i made a log of our 50 Hz mains frequency using a HP5335 meter. Gate aperture of the HP5335 is 0.5 sec. A crystal cannot be tuned enough in order to make the PLL. Maybe one should better use the crystal without tuning and realize a virtual digital PLL.So i made a test board with a Nucleo-STM32L432KC module. I replaced its built in clock by a canned 8 MHz oscillator to drive the MCU clock PLL and the timer 1 clock input directly. That means in order to realize 50 Hz one needs a 160 000 long counter. This is possible by extending the 16 bit timer 1 by its update interrupt handler. One could use three times 53 333 yet in order to get a 10 msec ADC cycle as in the Prema 6048 i implemented four phases: 60 000, 20 000, 60 000 and 20 000. Phase adjustment is by cycle count of the last phaseTimer channel 1 is used to capture the reference phase derived from a 15 Vac transformer with a passive clipping/filter circuit. This drives comparator 1 that is internally wired to the channel 1 capture. The capture interrupt routine has the virtual PLL.In order to check the lock i used timer channel 2 as a 10 000 count PWM output. The scope dump shows a stiff lock at 70 000 counts. Blue trace is mains reference signal. Phase detector noise is about 10 cycles or 1.25 usec. In order to check whether i got the cycle counting right, i made it measure the mains frequency in one second intervals and logged that together with the HP 5335 measurement. There is a nice agreement with standard deviation of 0.0015 Hz = 30 ppm.Regards, Dieter

author: dietert1
author_rank: Super Contributor
timestamp: July 17, 2023, 11:19:32 am
content: The crystal clock together with the agile time division scheme allows the integrator to cycle in sync with mains. In this scheme the total integration time will be slightly variable as in the original Prema PLL scheme and a multiple of actual mains cycles. In the original PLL scheme the meter only counts/sums up run-down ticks in order to digitize the input. In this alternative scheme there will be a division of the total run-down time measured by the total integration time measured. The FPU of the MCU will do the work of the PLL. This way the circuit has less parts and less jitter.By todays standards the Prema 6048 is a very simple device. Let's study a little what can be done with a modern MCU. The MCUs built in ADC should serve to determine the integrator zero timing with sub-cycle resolution in order to get 8 decimal digits within one second. The STM32L432 ADC does 12 bit at 5 Msps. STM32H7 MCUs come with 16-bit ADCs, so that may be an alternative using similar firmware. I also ordered LT2386 18-bit 10 Msps ADCs, in order to try the same methods with an FPGA - in case an MCU isn't good enough.Regards, Dieter

author: dietert1
author_rank: Super Contributor
timestamp: September 14, 2023, 07:06:49 am
content: Meanwhile i found that the STM32 timers don't support timer capture with output of the synchronized PWM signal. One could use an interrupt handler for this. Instead i started to use a XC6SLX9 FPGA module and implemented the DDR interface for the LTC2386 18 bit 10 Msps ADC. With the MCU one can use the built in ADC, up to 16 bit and 5 Msps.It seems that a Prema 6048 derived meter fits onto a 90x160 mm board to run inside the same IP66 enclosure as the ADR1399 reference i showed herehttps://www.eevblog.com/forum/metrology/adr1399-reference/msg4559587/#msg4559587. Except the meter will use a TEC oven as it generates 2 W of heat instead of the 700 mV or so from the ADR1399 circuit. Running a meter inside a temperature and humidity controlled enclosure will certainly improve it's accuracy.Here i have a log of a SHT35 sensor inside the ADR1399 enclosure. The log was started after the last modification inside the oven. Due to the size of the enclosure there are temperature variations of +/- 0.02 °C. The step on 15.8. happened after the unit went to another setup in another room. Humidity log showed exponential decay (action of used desiccant bag inside oven). Then there was a rainy period and recently we had dry weather again. Variation about 1 %RH. The ADR1399 enclosure isn't as hermetic as it could be - with its DSUB-9 connector and three binding posts. The sensor isn't calibrated to this level, but for observing changes it is pretty reliable.Regards, Dieter

author: dietert1
author_rank: Super Contributor
timestamp: September 27, 2023, 09:40:32 am
content: Meanwhile the meter board is partially populated and i made a power supply with a shielded mains transformer: -33 V, -12 V, -5 V, +3,3 V, +5 V, +12 V, +18 V). The design is such as to run everything with minimum heat. 3.3 V is for the FPGA module that includes switchers for 1.2 V and the 2.5 V needed for the LTC2386 digital section. We'll see whether the switchers are a problem.The dual LTZ1000 reference works as intended with VRef = 14.1876 V and about 5V heater voltage at ambient temperature. The negative reference (same as Prema 6048) is -1.75 V. The PI temperature controller got configured for 28 °C. The front end with the BS supply works, too. It went stable after adding the 470R + 1nF filter shown in imos recent simulations. When feeding the meter input with low impedance, output rise/fall times are about 50 nsec with little overshoot. With the standard input protection and filter this increases to about 1.2 usec.Regards, Dieter

author: Kleinstein
author_rank: Super Contributor
timestamp: September 28, 2023, 03:56:18 pm
content: I like the idea with measuring the mains frequency and adjusting the ADC period as needed. A little more math for the result should no longer be an issue.In the prema 6048 the input amplifier is working with essentialyl zero at the input. So no need for classic bootstrapping. The circuit needs the separate floating supply and good isolation there however.A LTC2386 auxiliary ADC may well be overkill. With oversampling this ADC alone may give good enough performance. There should be no need to go super fast if the ADC runs with the rather slow 100 Hz cycle. So there is usually plenty of time for getting the slope(s). The actual feedback part may still use a simple comparator. A high timing resolution for the "zero" (or slightly different ref. level) is only needed for the start / stop part. This part can also get away with some latency e.g. to read the ADC and process the data. Chances are one could set the start stop level to before the feedback switching and this way get 2 readings, one just before and a second after the ref. switching.

author: dietert1
author_rank: Super Contributor
timestamp: September 28, 2023, 06:16:46 pm
content: First change from the Prema 6048: I moved polarity switches to the input.Second change: Bootstrapping the input stage avoids the two separate isolated supplies of the Prema frontend. Like the Prema the ranges are by switching the resistor that converts input voltage to integrator current.Except for the lowest range there i added a NOMC 10:1 divider to get 10x gain - as proposed by ECHO88. There is a dual mosfet relay AQW210 to turn bootstrapping on/off.As the reference is positive, the input section works between -33 V and +12 V supplies. Probably the circuit can be made with -50 V as well. imos recent simulations resemble the circuit, except i put some zeners to absorb excessive input. Though i forgot an overvoltage sensor to disconnect the input relay in case of overvoltage.The board also has the filter and a comparator for synchronizing ADC operations with mains. That part of the FPGA is ready.At full range input the integrator sweeps between 0 V an 12 V. There is a comparator in addition to the fast ADC. The board also has a 10x slope amplifier that may be completely unnecessary considering the resolution of the ADC. With that gain the ADC common mode voltage of 2 V becomes 0.2 V. The comparator also switches at 0.2 V, so there should be good ADC data near the zero. One can study that in the digital domain, maybe using some denoising filter. There are provisions for a UART interface with isolation.Yesterday i started to build the hermetic TEC oven. The cabling is pretty wide as it includes the FPGA JTAG, many test signals and some spare wires. Threefold overhead.Regards, Dieter

author: dietert1
author_rank: Super Contributor
timestamp: September 30, 2023, 06:10:48 am
content: After wiring a lab power supply to the frontend and a 3478A meter to measure the deviation of the OPA189 buffer output from input i got the appended diagram. During the test the 10 KOhm resistor for the integrator current was selected as a load of the OPA189 output (12 V range).The -0,105 uV/V slope of the line fit gives a 141 +/- 4 dB gain estimate while the open loop gain spec of the OPA189 is 170 dB (for +/- 18 V operation). The test has about 30x gain missing. The diagram should become near flat (constant offset).Offset voltage is 2.9 uV, with a +/- 0.8 uV typical datasheet spec. My test setup isn't all low thermal EMF.At -12 V to -24 V input voltage up to 10 uV additional deviation appears delayed as if something needs time to heat and then the heat causes that deviation. Need to work on that, like heat testing each component. Another thing i want to try is using 2x TL431 instead of zeners to make low TC bootstrap supplies. Another one is adding a pnp emitter follower to reduce the OPA189 output load. The Prema 6048 had a second opamp in its frontend.Regards, Dieter

author: iMo
author_rank: Super Contributor
timestamp: September 30, 2023, 07:04:16 am
content: Quote from: dietert1 on September 30, 2023, 06:10:48 amPerhaps an 1N4148 is series with each zener would help..PS: also not sure how the 431 will behave there (stability).

author: Kleinstein
author_rank: Super Contributor
timestamp: September 30, 2023, 07:32:21 am
content: A thermal effect on the OPA189 due to loading could be an issue. A 10 K load with a 12 V output range is quite some load, even with an only moderate supply voltage.Loacal heat on chip can be different than just a global temperature change.When using a bootstrapped supply I am not even sure that just the regular DC gain applies. The BS part may add to the gain. With a RR output stage it may be anyway a kind of transconductance that is limiting more than voltage gain.An extra current buffer is definitely a good idea, as a BS supply often does not work that well with a strong load anyway. Depending on how the BS supply a made this part can be additional load (at least in the simple form the iMo showed).I am not so sure the OPA189 is such a good choice for the input. It is low noise, but also relatively high bias current. I would conder the OPA387 with still low noise, but less bias and current noise and also lower supply current.

author: dietert1
author_rank: Super Contributor
timestamp: September 30, 2023, 08:41:35 am
content: After replacing the zener by TL431 the frontend BS schematic will look like shown. Different from imos drafts my design had constant current sources. As +Vcc is 12 V in my case, the LED gets about 1 mA with Uf = 1.9 V. The difference zener current between positive and negative BS was measured to be 26 uA. That would be the DC load of the OPA189.Regards, DieterEdit: Probably C38 needs to move somewhere else to guarantee phase margin for the regulator.

author: dietert1
author_rank: Super Contributor
timestamp: October 01, 2023, 07:14:20 am
content: After adding a pnp emitter follower with a 10 KOhm pullup to the positive bootstrap supply the OPA189 works as expected. There are no more signs of residual slope. With the current setup the detection limit is about 0.3 uV in 24 V (10E-8).Offset and delayed deviation vanished after i changed the probing location 1 cm away from the 10 KOhm integrator resistor that heats most. Seems like its self heating generated thermal EMF. It remains for later to see at which level this affects the voltmeter. The integrator resistors might need heatsinks.Regards, Dieter

author: Kleinstein
author_rank: Super Contributor
timestamp: October 01, 2023, 08:14:03 am
content: Thermal effects at the resistors can be an issue, especially with a relatively high current (e.g. up to 2 mA with 20 V and 10 K). A heat sink and even temperature regulation alone may not be enough to counter power coefficients. Heat compensation may work with some resistors (e.g. a thin film array like TDP) but may fail with others, especially BMF types with more thermal resistance between layers.Thermal EMF at resistors can be an issue - it depends on the resistor types. Symmetry in the thermal layout can help, but may not allways be practical.

author: dietert1
author_rank: Super Contributor
timestamp: October 01, 2023, 09:43:50 am
content: Currently the precision resistors are Vishay S102K (2 ppm/K). The four blue 68K1 resistors in the reference are SFERNICE RCK02 (5 ppm/K) and the big 750K for the negative reference is labeled S105D. For most resistors there is enough space to replace them by better hermetic foil resistors or to apply some heatsink if necessary.Regards, Dieter

author: miro123
author_rank: Frequent Contributor
timestamp: October 01, 2023, 11:13:41 am
content: Quote from: dietert1 on July 16, 2023, 07:48:59 pmSorry for my late reaction. I've saw this thread.You cannot assume that1. Grid frequency is slow moving variable2. Grid phase is continues variableMost country standards for grid connected devices cover it - German VDE is good starting point.- why phase is not continues variable? - What happen If you switch on big load - E.g huge electric motor? UK grid code G59 requires handling of +-60deg phase jump- The grid frequency is heavily modulated nowadays - Partly doe to renewable energy sources. They implement active active /LOM-lost of mains/ Anti Icelanding. The core is inducing reactive power with certain pattern - shake the grid left or right - in case of LOM frequency goes much higher that grid-tied.- Even in old days the grid frequency was not constant it relies on averaging the speed of many mechanical turbines. I'm not mentioning the non linear behavoiour of electric machines used on power plants.PS: Many STM32 devices offer HR timer e.g. stm32 G4,H7 or F3

author: dietert1
author_rank: Super Contributor
timestamp: October 01, 2023, 03:03:17 pm
content: For a high resolution meter one wants to run the conversion process in sync with mains in order to suppress hum as far as possible. Nothing new. The Prema 6048 does it with an analog PLL, using a RC VCO with its extra phase noise. In order to use a fixed frequency crystal oscillator one can use a digital scheme that measures PWM on and off times both in units of crystal periods and determines the ADC result by floating point division. At the time they avoided that in the Prema with its 8 bit MCU.I cannot confirm claims of mains phase jumps of 60°. Instead i observed phase noise in the 10 or 20 usec (fractions of a degree). My frequency log above measures the frequency variations to be small, though one can see the 15 minutes pattern that results from electrical power trade.Hum suppression suffers from another problem: Often hum is phase shifted as it is from capacitive or inductive pickup. A good meter should have some kind of hum evaluation and an adjustable phase offset for the mains PLL.How to output the synchronized timing of a STM32 timer capture? I mean for an ADC one needs a PWM determined by the timer capture of some comparator. I could supplement the MCU with a sync circuit (flip-flop and some gates, maybe CPLD) to make things work. Instead the MCU went for a FPGA - in order to implement the LTC2386 DDR interface.Regards, Dieter

author: Kleinstein
author_rank: Super Contributor
timestamp: October 01, 2023, 03:32:30 pm
content: To control the PWM signal via the extra comparator one can use the timer triggerfunction, though this adds a little (on the order of 10 cycles) delay. I use this is my ADC implementation. The comparator is used to trigger and reset the timer that than generates the PWM signal. Another channel of that some timer can generate a trigger signal to be measured by the capture fuction of another timer. So the sequence is more comparator -> capture -> PWM , but as comparator -> restart timer -> PWM -> capture.It can depend on the µC type, AFIAK not all support using the comparator as a trigger source. So with some models one may need an external comparator or route the comparator signal externally back to a trigger input pin.With a µC and maybe also for the FPGA one may want an external flip flop for synchornization. There can be clock delays internal to the µC that depend on the internal state or IO pins. This can add jitter and also nonlinear effect. With the rather slow (e.g. 100 Hz) PWM as used in the prema meter this may not be as bad - with the much faster (e.g. 100 kHz range) PWM with the simple 2 case modulation this was noticable.For the mains hum suppression there is no real need to have a specific phase for the start / stop. Having a difficult spot near mains synchonous interference (e.g. a SCR triggering in a near by circuit) may add noise though, but it is hard to predict where those difficult spots are. With the digital phase sync mode one has the freedom to add phase shift. With the 100 Hz PWM clock as in the 6048 one would anyway have 2 phase values to use and may compare the noise for both. With rather long integration (a few seconds) hum suppression should be quite good anyway, especially if the period is adjusted. So I would not worry that much about mains hum - really critical measurements tend to be shielded. The BS supply for the input amplifier would eliminate the isolated transformer winding as a source of hum.

author: dietert1
author_rank: Super Contributor
timestamp: October 03, 2023, 04:23:13 pm
content: Yes, accepting latency one can use some tricks with the STM32. One could also use a comparator interrupt to terminate the run-down via the PWM register. For the time being it's the FPGA module with the LTC2386 ADC. No need to optimize now.Today i mounted a TEC2-19006 to the bottom of the aluminum enclosure. It got 1 A of reverse current at about 5.6 W to heat the glue and get it liquid and thin. The FLIR image showed a temperature difference of 24.5 K. Without thermal insulation and at about 22 °C ambient temperature the open aluminum enclosure exhibits about 3 K temperature difference between its hot and cold spot.The heat output of the meter board is 2 W max and i assume the TEC will eventually run at about 6 W of electrical input, except then the cold side will be at the enclosure. The shielded mains transformer is good for 12 VA. Hope it will work.Regards, Dieter

author: Kleinstein
author_rank: Super Contributor
timestamp: October 03, 2023, 04:51:06 pm
content: 2 W is not a lot of power, especially not with 2 x LTZ1000 reference and a possibly somewhat power hungy FPGA - maybe the FPGA is outside the regulated area.A lower temperature helps with semiconductor leakage currents at the front end. A temperature a little high then the environment would on the other side help with humidity as the RH goes down. High humidty can increase the surface leakage on plastics. It may be a good idea to aim for less than 50-60% RH, which is easy with a temperature of some 10 K above ambient.24 K temperature difference across the TEC looks like rather large - maybe go for a larger heat sink / fan on the ambient side.

author: dietert1
author_rank: Super Contributor
timestamp: October 03, 2023, 05:23:51 pm
content: TEC2-19006 is a 40x40 mm double TEC with more temperature difference.The FPGA is a Spartan6 we had and it needs to be inside the oven in order to read the high speed ADC via a 100 MHz DDR interface with two lanes. Until now the FPGA consumes about 700 mW. This may still increase a little. Don't know yet whether its JTAG will work from the outside as the cable length will be like 30 or 40 cm.The double reference runs from a supply of 18 V with half of that available for each of the two heaters. The negative heater terminal of the upper LTZ is at 9 V - about 1.9 V above its substrate. Last time the heater voltages were 5 V and 5.6 V. At 250 Ohm heater resistance that gives a total of 225 mW. Later the LTZ1000 references can be configured to run like 10 °C above oven temperature.The ADC consumes about 110 mW. So the 2 W max should be safe.Regards, Dieter

author: dietert1
author_rank: Super Contributor
timestamp: October 14, 2023, 09:47:27 am
content: Meanwhile i made a TEC output stage for the oven controller, see schematic. For efficiency the circuit uses a Polulu SIC473 switcher. Its voltage control by (around Q5) maintains a headroom of about 1 V above the required TEC output voltage.The circuit has the usual mosfet bridge for the two TEC polarities, so it will heat and cool. There are two opamps as current regulators. D1 and R11 let IC1B decide the polarity. Due to the delay of the opamps when coming out of negative output saturation the circuit handles polarity change without bridge shoot-thru. The screen dumps show the two opamp outputs with a +/- 12 V sweep as input. The dead time is about 1 msec.With additional cooling the ciruit can be used for higher currents. The switcher spec is 5 A.Regards, Dieter

author: dietert1
author_rank: Super Contributor
timestamp: October 25, 2023, 09:32:54 am
content: The oven and its thermal housing are ready. I used a 40 x 10 mm copper bar for heat transfer from the bottom of the TEC to the heatsink. The power supply and the TEC driver were assembled into a separate unit. There is enough space for a little MCU board and the isolated RS-232.Yesterday i wired a first oven test with a dummy load (330R resistor with heatsink) inside the oven. After tuning temperature controller dynamics i saw that for 28 °C nominal oven temperature and 22.5 V => 1.53 W dummy power the TEC finally ended up heating with 0.55 V or about 0.12 W electric input. All this at about 17.5 °C ambient air temperature. Due to the low thermal resistance of the TEC and its heatsink the oven doesn't even reach 28 °C with the dummy power and needs additional heating by the TEC! When i turned off the dummy power, the TEC voltage went up to 1.27 V or about 0.62 W input. The TEC controller with its current configuration can deliver 3.6 W for heating and for cooling, so the oven seems to work better than expected.Regards, Dieter

author: iMo
author_rank: Super Contributor
timestamp: October 25, 2023, 10:30:10 am
content: What is the tuning capacitor near the transformer good for?

author: dietert1
author_rank: Super Contributor
timestamp: October 25, 2023, 10:54:07 am
content: The transformer has a shield between primary and secondaries. If we connect the shield to guard, then the secondary will inject hum current between the DC supplies and guard. The trim cap supports compensation down to levels of about 20 nA. It works for a certain orientation of the mains plug.This is with 220 V 50 Hz L and N mains. I tried to find a scheme that allows reversal of the mains plug without readjustment but gave up on that.Regards, Dieter

author: dietert1
author_rank: Super Contributor
timestamp: October 26, 2023, 09:03:07 pm
content: To study the oven behaviour i noted down some measurements at different ambient temperatures and at different power levels of the dummy heat source inside the oven. Then i fitted a model that has a linear term for the TEC (Peltier effect), a quadratic term (TEC self heating) and the dummy power. The model has three parameters and the fit determines them minimizing the standard deviation of the oven temperature.Oven temperature estimated by the fit is 28.4 °C where 28 °C was the configured value. The model allows an estimate of the ovens operational limits. Within 0.5 to 2 W power consumption of the meter board the allowed ambient temperature range should be about 0 to 40 °C.This is a "quick and dirty" method and easy to improve, e.g. by measuring the TEC current instead of voltage and by observing the heatsink temperature as well. Or one could test the setup inside a chamber that directly sweeps the 0 .. 40 °C ambient temperature range.Regards, Dieter

author: dietert1
author_rank: Super Contributor
timestamp: November 04, 2023, 05:43:32 pm
content: Meanwhile the second board is partially working and today i started looking at the integrator. As a test i wired the -1.76 V of the negative reference to the 2 KOhm integrator resistor of the 2.4 V input range.The scope dump shows the 50 Hz mains comparator in C4. C2 is the integrator output and C3 the comparator that stops rundown when going low. One can see a pretty chaotic behaviour caused by the simple PWM control method: Start rundown at middle of 10 msec interval + 1 msec, stop on comparator low or 1 msec before middle of next 10 msec interval. The maximum rundown duration is 8 msec. The integrator exhibits a nice sweep up to about 17 V.The Prema 6048 uses this simple minded PWM method and it's the reason why there is only 20 V of its native 70 V ADC range available. Hope to improve that for my design.Regards, Dieter

author: Kleinstein
author_rank: Super Contributor
timestamp: November 04, 2023, 08:01:07 pm
content: The control for going from a negative ref (integrator output goingup) to a positive ref. is still a bit chaotic. For a good result an low noise one would want a rather stable waveform, as the integration time and all possible raw data points used fron inbetween are effected by the scattering.Using only a limited part of the range (like 20 V of a theroretical 70 V) can help with stability of the feedback. How the the upper switching triggered ?

author: dietert1
author_rank: Super Contributor
timestamp: November 04, 2023, 09:07:19 pm
content: Yes, it can't stay like that. When the integrator runs into the upper limit or only into the nonlinearity the measurement will be lost. For this test the rundown starts at a fixed time in the 10 msec cycle (middle + 1msec). Input integration is continuous like in the Prema. During rundown it integrates the difference between input and reference current.Maybe i should add an upper comparator, something simple just to keep the integration cycle in order.Regards, Dieter

author: dietert1
author_rank: Super Contributor
timestamp: November 07, 2023, 12:53:41 pm
content: Meanwhile i wrote a simulator for the Prema integrator, assuming the simple control mentioned above and an upper integrator saturation voltage of 17 V. In my build the integration cap is 220 nF, so it reaches higher voltages. The diagram shows the simulator plot in a run of 0.5 seconds. The run starts with Integrator = 0 and with I unknown / I ref = 0.3. At 0.1 0.2 and 0.3 seconds into the run the input current gets raised to 0.4, 0.5 and 0.75. While at low input current the integrator is well behaved and settles for a regular cycle, the first integrator saturation happens at 0.4. At 0.5 and above it gets wild, with the last setting similar to the scope dump i posted above.The PREMA 6048 runs below 0.3 (21 V / 70 V).Regards, Dieter

author: Kleinstein
author_rank: Super Contributor
timestamp: November 07, 2023, 01:59:22 pm
content: It is some time since I looked at the feedback and I faitly remember that there is kind of too much FB gain to make it stable. The solatron meters use the extra forcing signal added to the integrator. This is equivalent to having time dependent switching points, e.g. adding the negative of the forcing signal to an integrator for the other side of the comparator. With enough slope in the time dependent limit one should get a reduced gain and a stable feedback loop. The positive thing of applying the forcing signal to a separate part (e.g. some integrator or maybe a passive low pass) is that any error would not add to the integrator and the swing of the integrator is not reduced. One may also have more freedom (e.g. maybe use more than a simple square wave to start with, a 2nd capacitor for more rounding) approximating the ideal limit curve. It does not have to be perfect, just close enough to keeping the loop stable / well dampened.Another possiblity would be to add some delay to the feedback: so switch the reference at least at one end with a delay after a level is reached. With the rather slow modulation there should be time to do the math to get a stable waveform.

author: dietert1
author_rank: Super Contributor
timestamp: November 07, 2023, 07:07:43 pm
content: Yes, the force method appears to be a trick. Using only 0.3 of the available input range isn't that convincing either.Rather i will try a more PWM like compensation method where one looks at more than one cycle before changing the PWM ratio. Maybe it is enough to make the PWM pulses symmetric within the time frame.Certainly one needs a simple upper comparator to protect the integrator from saturating. Input voltage change or AC will then disturb the timing but valid measurements are guaranteed.Anyway with continuous integration the integrator zero events won't exactly match the requested integration time. So the final result calculation needs interpolation at the start and at the end of each requested integration period.Regards, Dieter

author: iMo
author_rank: Super Contributor
timestamp: November 07, 2023, 08:24:15 pm
content: Could you point me to a schematics of that ADC? I'll try to sim it in LTspice (as I did years back with the Multislope)..

author: dietert1
author_rank: Super Contributor
timestamp: November 08, 2023, 08:44:48 am
content: Schematics of the Prema 6048 can be found inside the PDF user manual that is online, Fig. 11.8. They are using a proprietary control chip "BK7". It implements a mains PLL and a pretty simple integrator control method described in the user manual, paragraph 1.2. The P6048 front-end converts input voltage to input current using a buffer and a set of range resistors. Then the idea is continuous integration of input current compensated by a switched reference current source of opposite polarity (a PWM DAC). They implement a 10 msec cycle derived from the mains PLL. At a certain time in the cycle they turn on the reference current (begin of run-down) and count the time until a comparator signals integrator = 0 V (end of run-down). Summing up those time measurements they arrive at a high resolution measurement of input current.My circuit is similar, though it uses a 14.2 V reference with two LTZ1000 and the reference current source is implemented following the Advantest R6581 design. Also i added some mods from a nonlinearity study in the Prema 6048 teardown thread. In my case integrator control is implemented in a Spartan 6 FPGA, with flexibility to change/improve the rules and calculations.After that integrator saturation/instability problem i wrote a little simulator to understand what is going on and to test different control methods meant to solve that.Regards, Dieter

author: dietert1
author_rank: Super Contributor
timestamp: November 13, 2023, 09:26:59 am
content: Meanwhile i found a better solution for continuous integration, using an upper comparator to avoid integrator overflow/nonlinearity. The integrator cycles independent of the rigid timing scheme the Prema 6048 uses. But timing can still be locked to mains in the sense of a PLL. This happens by the adjustment of the PWM ratio as seen in the simulation. x-axis of diagram is time in seconds. The 15 V upper comparator triggers twice during simulation. The maximum integrator voltage reached at I input/I reference = 0.5 is 14.67 V.Next step is to implement this in the FPGA using fixed-point arithmetics.Regards, Dieter

author: Kleinstein
author_rank: Super Contributor
timestamp: November 13, 2023, 09:49:22 am
content: I don't see how a comparator at 15 V would help if the level is essentially never reached. A comparator at a low level, like 30-50% could help, by using the timing as additional information to get a first estimate and from that calculate the time when to best switch from sising to falling. To simplify the math and make it less sensitive to noise, 2 comparator levels (e.g. 50% and 10%) for different ranges could be an option. The cost for an extra comparator is relative moderate.

author: dietert1
author_rank: Super Contributor
timestamp: November 13, 2023, 10:50:12 am
content: The upper comparator avoids invalid measurements when allowing I input/I reference > 0.5. The solution i am showing is almost as simple as the Prema 6048 yet makes better use of the hardware. At full range input the boards i made will run at a PWM ratio of 0.93.The exceptionally long integration after stepping to 0.95 yields a valid measurement equivalent to several "normal" cycles.Of course one can always dream up something more and you are invited to present your ideas in a more formal way. Maybe i will later look at it - once the DSP got implemented inside the FPGA and i can see how everything works out. The PWM calculation needs to complete during run-up, that is within 500 usec at a PWM ratio of 0.95.Regards, Dieter

author: Kleinstein
author_rank: Super Contributor
timestamp: November 13, 2023, 11:43:07 am
content: The C code indeed looks relatively simple and may be FPGA compatible. So the 15 V comparator is only there to avoid the overflow with large steps. Chances are the system may have problems with higher levels of hum. This may already be an issue with the old prema system.

author: dietert1
author_rank: Super Contributor
timestamp: March 28, 2024, 10:30:20 pm
content: Currently i am making the TEC oven for the second prototype. Image roughly shows thermal scheme. The copper heat conductor gets glued to the TEC and screwed to the heatsink. PU foam isolation near the flat cables is in two 2 cm layers.Regards, Dieter

author: Kleinstein
author_rank: Super Contributor
timestamp: March 29, 2024, 08:07:41 am
content: The copper part may add some thermal resistance that could be relevant in comparison to the size of the heat sink.It may still be OK as the peltier element is likely used with relatively low power, well below it't nominal rated current / power.One may want a temperature sensor also on the outer side of the peltier element to make sure not to run into a thermal runaway when the heat sink a blocked. In this case the regulation could run away to a state with high current, trying too cool and overheat the heatsink. The outside sensor would also improve the regulation speed, as variations in the hot side temperature are likely the main path to get thermal coupling from the outside. In minimal solution would be to limit the peltier current to a safe limit, that could be something like half the nominal current.

author: branadic
author_rank: Super Contributor
timestamp: March 29, 2024, 08:55:45 am
content: Maybe I've overlooked it, but why did you choose temperature stabilization of the circuit with a TEG instead of temperature compensation in software?-branadic-

author: dietert1
author_rank: Super Contributor
timestamp: March 29, 2024, 10:00:46 am
content: One disadvantage of a TEC oven is the thermal link to the outside, while a resistive heater oven can be made with much better thermal isolation, limited only by power consumption inside the oven.The double TEC element was selected as it has less cooling power and higher heat resistance. So it can reach the same temperature difference with less electrical input. The copper bar also adds some heat resistance. It is made from ETP copper with about 400 W/(m K) heat conductivity, has a cross section of 4 cm² and an effective length of about 8 cm. That gives a heat resistance of 0.5 K/W. The Fischer SK 42/100 SA heatsink is specified at 1.65 K/W. Maximum electrical power into the TEC is about 5 W, so the device is safe.Yes, a second NTC sensor on the heatsink can help yet requires digital control. I have a working implementation of that for our 19" temperature chamber. For the time being i implemented the meter oven with analog control, and it is good for about +/- 0.1 K. That already helps in comparison with the usual ambient temperature variations other meters are exposed to. The thermal mass of copper bar and aluminum enclosure slows down ambient temperature changes.This is a study. There is a good chance it performs better than a meter with temperature compensation. A meter is made of many parts and there will be different delays for temperature changes. Calculating the correction requires the determination of the kernel of a convolution. And then there are nonlinear temperature drifts. In the end it may be cheaper to put the meter into an oven than to install a professional air conditioning system for the lab.Regards, Dieter

author: branadic
author_rank: Super Contributor
timestamp: March 31, 2024, 07:27:24 am
content: Next question, did you copy the functionallity of the BK7 chip completely? Does that mean you have the very same slow integration cycles as in Prema 6048? I'd like to learn more about your work.-branadic-

author: dietert1
author_rank: Super Contributor
timestamp: March 31, 2024, 09:37:41 am
content: A voltnut easter egg:The BK7 contains certain elements i did not replicate for my meter study. E.g. it has a built in switched voltage reference to implement the integrating meter with just one additional opamp. The temperature measurement on the Prema 6048 processor board demonstrates this.I kept the idea of polarity switching at the meter input, so the ADC handles one polarity only - with some overlap at zero. I added a third relay for rapid nulling of the meter. The Prema 6048 requires manual insertion of a low thermal EMF short. That procedure takes several minutes.I also kept the idea that the front-end should be as simple as possible, essentially just a buffer amplifier with a resistor for voltage to integrator current conversion. As in the Prema 6048 this is implemented in a four wire scheme to eliminate influence of the range switches.For my study i implemented the switched current source of the Advantest 6581 with SD215 switches, except i used a double LTZ1000 reference to have 14.2 V (+17 V in the 6581, U209). This change was motivated by the reference switching problems of the Prema 6048 which affect its LTZ1000 reference (linearity issue at low input).I kept the idea of uninterrupted integration with a 10 msec cycle time. As we know the Prema 6048 ADC could measure about 70 V in its 20 V range, except above 25 or 30 V the integrator cycle becomes unstable and overflows can occur. I found an improved integrator scheme with a second comparator that avoids a 3.5x headroom (see above).Another improvement over the BK7 is supplementing the precision comparator by a high resolution fast SAR ADC in order to perform noise filtering in the digital domain. This method can produce similar results as a multi-slope scheme. Multi-slope is incompatible with continuous integration.With nowadays parts it's easy to count at 50 or 100 MHz instead of 3.8 MHz, so the meter has better resolution - roughly 1 ppm per cycle or 10 ** -8 in one second. Locking the measurement cycle to mains frequency can be all digital now, so the RC-oscillator time base of the Prema 6048 got replaced by a crystal oscillator (lower phase noise).I want a voltmeter that runs at about 1 or 2 W of power, more than those integrated delta-sigma converters have available. So one can work at higher analog signal levels. 1 or 2 W is little enough to run the board inside a TEC oven. Hope one can get sub ppm precision without custom made resistor arrays, nor the hermetic precision resistors of the Prema 6048, nor a sophisticated temperature drift compensation scheme.What i don't like about the Prema 6048: Nobody knows what is their temperature compensation scheme and we cannot check their method nor recalibrate that. Whatever hardware mod you apply can destroy the temperature compensation. Therefore i pulled the temperature measurement BK7 from our Prema 6048 and instead inserted a SHT35 sensor into the meter. I calculate the compensation offline.Regards, Dieter

author: branadic
author_rank: Super Contributor
timestamp: September 02, 2024, 07:04:19 pm
content: I wonder if you made any progress. So far I've read the progress with huge interest.-branadic-

author: dietert1
author_rank: Super Contributor
timestamp: September 03, 2024, 05:57:38 am
content: Yes, there is progress yet slow. Currently i am protoyping controller hardware and firmware. I took my time to study two ethernet solutions: A STM32H743 with fiber and a W5500 alternative (copper). Both are working well, and i am implementing javascript/AJAX based dynamic web pages for setup and monitoring of the device, along the lines given in W5500 ioLibrary_Driver. Recently i implemented an interrupt based driver for the W5500 with http and telnet servers on top. It requires arbitrary amounts of time to tidy up open source software.Also more oven setups are running, trying to demonstrate a constant humidity oven. The screen dump shows the monitoring page of the K41 oven i made recently. Logs are recorded over a telnet connection.It runs at 37.4 °C with a bag of desiccant and the sensors inside. Its cover is still loose so it can breath with ambient pressure changes and the desiccant will adapt to average ambient humidity level, but already at working temperature. After a month or two the cover can be tightened to make it hermetic.The other image shows the STM32H743 fiber ethernet prototype. It got a GPIB interface, sensor I2C, power supply and realtime clock. The ADS1256 module can provide low noise temperature measurement, similar to the relay scanner with K2182A controller i showed elsewhere.Regards, Dieter

author: EC8010
author_rank: Frequent Contributor
timestamp: September 03, 2024, 07:22:36 am
content: Quote from: dietert1 on October 25, 2023, 10:54:07 amAs you say, connecting the shield to guard causes injection. But I'm not at all sure it should connect to guard. Without a shield, a mains transformer has capacitance between primary and seondary (Cps). Adding the shield breaks that single capacitance in two. Earthing the shield makes a potential divider out of the capacitance from primary to shield and the shield's impedance to earth. The effect is to greatly reduce the apparent Cps. You can go further and wrap the primary in earthed copper foil (avoiding a shorted turn) and do the same for the secondary. That gives you two potential dividers and allows you to bring the apparent Cps down to single digit fF. To be effective, those shields need a low impedance path to earth, and that usually means directly to chassis.Now to my point. I don't believe the shield should connect to guard. By and large, guards are for preventing surface currents on PCBs etc and guard drivers are low bandwidth - not suitable for cancelling RF. I think you'll be better off using the shield connected to chassis. If you really want to attenuate common-mode interference from the mains, 10n from each end of the transformer secondary directly to chassis will help. The other thing you could consider is that it's amazing how much coupling you get from unshielded mains wiring. I never thought mains filters did much until I started fitting a shield with no apertures whatsoever between their input and output. That usually means folded tin plate screens with self-adhesive copper tape over all gaps. Even a 0.1mm gap will let RF crawl through.

author: dietert1
author_rank: Super Contributor
timestamp: September 03, 2024, 05:32:19 pm
content: Yes, that mains input section looks a bit unusual. To start with the mains cable is one without protective earth and i tried to avoid the usual prefabricated mains input filter with switch and fuse, as it is for 3-prong cables and will connect chassis to PE. The transformer shield is connected to chassis. It's a low voltage device, all inside one common shield, at least for the time being.Certainly i can try a separate, shielded compartment for the mains input wiring.The meter board inside the oven has some guard traces, most of them connected to ADC Gnd, and some driven by the input buffer. The biggest meter input voltage range is +/- 24 V.Regards, Dieter