Digitally variable current source - Page 1
Forum section: electronics / projects

author: Birb
author_rank: Contributor
timestamp: July 15, 2024, 03:55:36 pm
content: In order to test some zener diodes and other stuff, I want to attempt to build a current source with multiple ranges, capable of maximum 1A current output.The device is based on a PWM DAC and a voltage to current converter.I only require decent performance, so the voltage reference chosen is an LM329AZ epoxy variant. (Ignore the forward biased diode)However, there are a few flaws with the design that I do not know how to solve yet.Firstly, I intend to use a crystal oscillator at 50MHz + a 16 bit counter + a 16 bit magnitude comparator to generate the PWM signalThe issue with this is that the frequency of the PWM is something like 763Hz, which is quite low, and requires some filtering.Secondly, the output stage for the voltage to current converter needs to support up to 1A, but on the other hand behave well at very low currents of a few uA.In the current design the output stage is buffered before entering the rest of the transistors.The transistors I intend to use are TIP41C which I have several lying around. (I do also have several Mje13007)Are these still ok for lower currents? Or should I use different transistors?Would using two current to voltage converters, one for low currents and one for high currents be better?The image attached shows 5 ranges, but that seems infeasible, so perhaps it will be limited to 4 ranges instead.Any advice would be appreciated, thanks a lot!

author: David Hess
author_rank: Super Contributor
timestamp: July 15, 2024, 04:31:39 pm
content: The TIP41C is not going to work so well at low output currents. I would replace the drive transistor with a MOSFET to remove the error at low currents from the base current.

author: MasterT
author_rank: Frequent Contributor
timestamp: July 15, 2024, 04:39:27 pm
content: Here is an idea of fast settling pwm dac:https://www.edn.com/dc-accurate-32-bit-dac-achieves-32-bit-resolution/I personally tested and confirmed that settling in one cycle works, but linearity is suffering.Adjusting circuits to slightly relaxed settling time in 3-5 clk restore linearity to 17-bits (I breadboarded only 16 MSB part).Using uCPU to dynamically track S/H along with primary PWM phase brings linearity above 24-bits - can't measure more precise by mcp3561

author: ledtester
author_rank: Super Contributor
timestamp: July 15, 2024, 04:41:24 pm
content: QuoteSeems like combining the output of two lower resolution PWM DACs together is a thing, e.g.:Designing high-performance PWM DACs for field transmittershttps://www.ti.com/lit/an/slyt795/slyt795.pdfHigh-Performance 16-bit PWM to 4- to 20-mA DAC for Field Transmittershttps://www.ti.com/lit/ab/sboa379/sboa379.pdf

author: voltsandjolts
author_rank: Unknown
timestamp: July 15, 2024, 04:55:07 pm
content: Quote from: ledtester on July 15, 2024, 04:41:24 pmYup, more options:https://www.eevblog.com/forum/projects/dac-like-mcp4276-but-with-more-bits-of-resolution/msg4988320/#msg4988320

author: Kleinstein
author_rank: Super Contributor
timestamp: July 15, 2024, 07:12:37 pm
content: I somewhat doubt that one would need more than 16 bit resolution. I know that combining 2 PWM parts is done, but it can be tricky with interaction between the coarse and fine part. So if really needed I would prefer 16 bit PWM corse and then maybe 8-10 bit from a ready made DAC chip for a fine part.The PWM frequency of 760 Hz is not that low - the Fluke calibrators tend to use an even lower frequency. A low frequency has advantages for accuracy.If needed one can do some sigma delta like dithering and this way get a most of the ripple at a higher frequency and only a tiny rest at the low frequency. With a µC to generate the PWM signal the effort is not that large. The filter is not ideal with 2 DC critical OP-amps. There is a different topology found in the precision instruments (calibrators, some DMMs) with only 1 DC relevenat OP-amp.For the power stage a FET stage would be preferred to avoid an issue with the base current. It is possible to combine a FET (MOSFET or JFET with a BJT), to get the FET input and most of the power in the BJT.A power MOSFET could work for the higher currents, but the gate leakage (more the protection zener than the actual gate) could be an issue for small currents (e.g. < 1 mA).For a high current the heat at the shunt resistor can well be the limiting factor - this may want a relatively low voltage (e.g. 0.2-1 V range) and low dirft / low noise OP-amps, like an AZ type.For a large range I would consider a separate source part for the small and large currents, as ideally different amplifiers and voltages would be used.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: July 15, 2024, 10:00:54 pm
content: Quote from: Birb on July 15, 2024, 03:55:36 pmHow do intend to load this value?a 16 bit counter + a 16 bit magnitude comparatoris a shedload of wiring and tough to get to 50MHz - it will also need a post compare FF to deglitch.You can get 8 bit MCUs with 50MHz / 64MHz / 144MHz PWM clocks these days, they may be simpler. You would use buffers/analog SW to remove the MCU Vcc noise effects.You can also get MCUs with 10b and 12b DACAs already mentioned, you can split a 16 bit PWM into 2 x 8 bit ones with a couple of precision resistors, for much higher filter cutoffs.Quote from: Birb on July 15, 2024, 03:55:36 pmIf you already have manual ranging, and want to test/compare zeners, you are probably fine with lower bits PWM.eg even 8b PWM will have very precise and repeatable steps of a fraction of 1 LSB, down to your analog noise floor.

author: tszaboo
author_rank: Super Contributor
timestamp: July 15, 2024, 10:09:43 pm
content: Or, you know, buy a 16 bit DAC, and concentrate on the functionality of the device, not the gimmicks on how to save 1.92 USD on the BOM.

author: Birb
author_rank: Contributor
timestamp: July 16, 2024, 02:05:22 am
content: Thanks for the advice!Ok then, considering ranging and things it should be fine to reduce the bitcount to 8.In which case the crystal oscillator can be reduced to a few MHz.(5MHz gives ~10KHz PWM frequency, it can be reduced even further to 1MHz and it would still be better)

author: MasterT
author_rank: Frequent Contributor
timestamp: July 16, 2024, 02:20:51 am
content: "Secondly, the output stage for the voltage to current converter needs to support up to 1A, but on the other hand behave well at very low currents of a few uA."means ~20-bits.Having 8-bit PWM dynamic range about 1:256, or 1A <-> 4 mA.

author: Andreas
author_rank: Super Contributor
timestamp: July 16, 2024, 04:38:20 am
content: Quote from: Birb on July 16, 2024, 02:05:22 amHello,consider that the rise and fall switching times of a analog switch are temperature dependant. (and of course also supply voltage dependant).So using PWM instead of a DAC translates the problems only to another playground (e.g. switching times, nonlinearities at low and high duty cycles etc)Perhaps you might want to optimize the PWM frequency for best T.C.?https://www.eevblog.com/forum/metrology/lm399-based-10-v-reference/msg2200098/#msg2200098with best regardsAndreas

author: Doctorandus_P
author_rank: Super Contributor
timestamp: July 16, 2024, 07:48:11 am
content: First, I had a short look at the LM329az. Over EUR10 at TME.eu, and obsolete according to digikeyI have done some simulations of a cost effective PWM and it works as intended.1. Multiple phase shifted PWM outputs of a micrcocontroller (3V3)2. 74HC541 which is powered by a voltage reference.3. Summing / averaging resistors. (A few k Ohm, exact resistance not important).4. Analog filter (Fet opamp, no DC leakage).This setup has huge advantages.1. When combining 3 outputs (for example from a motor timer in a uC) then the effective output frequency is tripled because of the phase shifting.2. Either resolution or output frequency can be increased because (Pulse width of each timer does not have to be the same)3. The summing / averaging resistors already generate a much smoother output, even before the filter.These three factors combine into an improvement of more then quadratic. You can choose whether to put this improvement in higher pwm frequency or more resolution. Same tradeoffs as always.In the picture blow I also added a bigger resistor (R13, 22Meg) The Idea is that you can tweak the output with yet another PWM channel. It's tweaking range should be a few lsb of the other outputs combined, but it needs calibration in software.And the zipped KiCad for the simulation. Simulation looks very promising. With 4 outputs I had a settling time of around 15ms (100MHz pwm) to ppm dc level. I ran out of resolution of the simulator. Resistor values have for the filter have not been optimized yet and need further tweaking. It has become quite clear that the dominating inaccuracies will be because of the switching times, imbalance of High / low of the TTL driver, voltage reference etc.(Edit: Attachments and images are a real mess on this forum)

author: Kleinstein
author_rank: Super Contributor
timestamp: July 16, 2024, 09:57:45 am
content: The LM329 is an odd choice now - mainly a thing if you still have some in stock. Otherwise it good too expensive to be useful and 7 V is not that convenient in many cases. I think I have still a few in stock from time when they were some 50 cents or so.With that grade of reference I would consider a ready made DAC - even 16 bit ones are not that expensive, though not perfect.The PWM DAC may get better accuracy, but is still not easy and has quite some pit-falls so it may fail to deliver.For a large range one would have to change the resistor. As the higher current want a smaller voltage at the ref. resistor one would need even more range for the resistors. The useful range with a single resistor is limited, especially at high current.Switching the resistors also needs some care - likely at least 2 seprate poles for the current and voltage sense.The universal current source part has it's own pitfalls to get it stable even with an inductive DUT. I would start with the lower current (e.g. up to 1 mA) version and learn from there. Not sure if one wants an extra protection against applying external power - that part can be somewhat challanging too.

author: David Hess
author_rank: Super Contributor
timestamp: July 16, 2024, 11:04:51 pm
content: Quote from: Kleinstein on July 16, 2024, 09:57:45 amI still have a few also. I used them when low flicker noise was required.What is the modern inexpensive zener reference that replaces the LM329? The cheapest I see is the LM329 from Analog Devices for $43/10, at which point you might as well buy the LT1021DC.723s are less $1 each, but I never tested their zener references for low noise.

author: Kleinstein
author_rank: Super Contributor
timestamp: July 17, 2024, 05:42:57 am
content: There seem to be no more market for low cost 7 V references. Much is going for 2.5 V bandgap references (e.g. ref40, TL431 variants,...).Modern ADCs / DACs are often made for this lower voltage.As replacement one may go back to an old style temperature compensated zeners like 1N825 or 1N823, though they need more power. Different from normal cheap zeners they are actually low noise, at least most of them. So there is more to those than just the temperature compensation.

author: Terry Bites
author_rank: Super Contributor
timestamp: July 17, 2024, 01:08:16 pm
content: Yes, but will it deal with idss?

author: David Hess
author_rank: Super Contributor
timestamp: July 17, 2024, 04:09:39 pm
content: Quote from: Kleinstein on July 17, 2024, 05:42:57 amCompensated diodes start at about $3, and of course you would likely buffer it with an operational amplifier circuit, so a 723 would be less expensive if it performed about as well, although some 723s use bandgap references.https://www.mouser.com/c/semiconductors/discrete-semiconductors/diodes-rectifiers/zener-diodes/?q=compensated&instock=y&sort=pricingCost is about the same as the best references for equal ppm/C; A 1N829 and LT1021 are about the same cost for 5 ppm/C. But of course the 1N829 will require some support circuits.