Author Topic: Digitally variable current source  (Read 519 times)

0 Members and 3 Guests are viewing this topic.

Offline BirbTopic starter

  • Contributor
  • Posts: 22
  • Country: aq
Digitally variable current source
« on: Yesterday at 03:55:36 pm »
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 signal
The 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!
« Last Edit: Yesterday at 04:19:53 pm by Birb »
yay
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16895
  • Country: us
  • DavidH
Re: Digitally variable current source
« Reply #1 on: Yesterday at 04:31:39 pm »
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.
 
The following users thanked this post: Birb

Offline MasterT

  • Frequent Contributor
  • **
  • Posts: 797
  • Country: ca
Re: Digitally variable current source
« Reply #2 on: Yesterday at 04:39:27 pm »
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
 
The following users thanked this post: Birb

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3109
  • Country: us
Re: Digitally variable current source
« Reply #3 on: Yesterday at 04:41:24 pm »
Quote
Firstly, I intend to use a crystal oscillator at 50MHz + a 16 bit counter + a 16 bit magnitude comparator to generate the PWM signal
The issue with this is that the frequency of the PWM is something like 763Hz, which is quite low, and requires some filtering.

Seems like combining the output of two lower resolution PWM DACs together is a thing, e.g.:

Designing high-performance PWM DACs for field transmitters
https://www.ti.com/lit/an/slyt795/slyt795.pdf

High-Performance 16-bit PWM to 4- to 20-mA DAC for Field Transmitters
https://www.ti.com/lit/ab/sboa379/sboa379.pdf
 
The following users thanked this post: Birb

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 2340
  • Country: gb
Re: Digitally variable current source
« Reply #4 on: Yesterday at 04:55:07 pm »
Seems like combining the output of two lower resolution PWM DACs together is a thing, e.g.:

Yup, more options:
https://www.eevblog.com/forum/projects/dac-like-mcp4276-but-with-more-bits-of-resolution/msg4988320/#msg4988320
 
The following users thanked this post: Birb

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 14467
  • Country: de
Re: Digitally variable current source
« Reply #5 on: Yesterday at 07:12:37 pm »
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.
 

Online PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1666
  • Country: au
Re: Digitally variable current source
« Reply #6 on: Yesterday at 10:00:54 pm »
Firstly, I intend to use a crystal oscillator at 50MHz + a 16 bit counter + a 16 bit magnitude comparator to generate the PWM signal
The issue with this is that the frequency of the PWM is something like 763Hz, which is quite low, and requires some filtering.
How do intend to load this value?
a 16 bit counter + a 16 bit magnitude comparator is 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 DAC


As 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.

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.

If 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. 


 
The following users thanked this post: Birb

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 7575
  • Country: nl
  • Current job: ATEX product design
Re: Digitally variable current source
« Reply #7 on: Yesterday at 10:09:43 pm »
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.
 

Offline BirbTopic starter

  • Contributor
  • Posts: 22
  • Country: aq
Re: Digitally variable current source
« Reply #8 on: Today at 02:05:22 am »
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)
yay
 

Offline MasterT

  • Frequent Contributor
  • **
  • Posts: 797
  • Country: ca
Re: Digitally variable current source
« Reply #9 on: Today at 02:20:51 am »
"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.
 

Online Andreas

  • Super Contributor
  • ***
  • Posts: 3279
  • Country: de
Re: Digitally variable current source
« Reply #10 on: Today at 04:38:20 am »
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)
Hello,

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/#msg2200098

with best regards

Andreas
 
The following users thanked this post: PCB.Wiz

Online Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3552
  • Country: nl
Re: Digitally variable current source
« Reply #11 on: Today at 07:48:11 am »
First, I had a short look at the LM329az. Over EUR10 at TME.eu, and obsolete according to digikey ???

I 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.
2313047-0

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)
« Last Edit: Today at 07:52:04 am by Doctorandus_P »
 

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 14467
  • Country: de
Re: Digitally variable current source
« Reply #12 on: Today at 09:57:45 am »
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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf