How to control the output of a Current pump with the help of an audio DAC - Page 1
Forum section: electronics / projects

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: July 15, 2023, 08:11:33 am
content: Hi,In this Threadhttps://www.eevblog.com/forum/projects/why-the-output-of-this-op-amp-amplifier-has-distortion/I proposed a circuit to design an AC current pump(Sink or source) for 50Hz ~2KHz, it seems the simulation file is working, and Now I want to control over the output Current, I want to control the output amplitude from 1mA to 30A, I will be using an audio DAC codec such as PT8211 (16bit stereo) or CS4344(24Bit stereo), the first channel would be used for generating the sin wave and possible harmonics, (50Hz or 60Hz main frequency),Also I want to use the second channel as the control voltage to control the output amplitude, since I want to maintain the full 16 or 24 bit resolution for the main wave form generation, so the first channel would be used instead of VG1 in this circuit.But I'm out of Ideas how to cleverly control the output amplitude, So I need your help, feedback and suggestions.The updated circuit

author: Zero999
author_rank: Super Contributor
timestamp: July 15, 2023, 09:48:01 am
content: Why use MOSFETs? BJTs are easier to bias.What compliance voltage is required?30A will result in massive power dissipation. It would be easier and more efficient to use a current transformer and design for 3A out.Consider a class D amplifier.

author: Vovk_Z
author_rank: Super Contributor
timestamp: July 15, 2023, 01:40:57 pm
content: BJTs are easier to bias but much hardr to drive when output current is 30 A RMS.t's much more easier to drive MOSFETS with a single opamp. It's impossible to do with BJT taking into consideration output current 30 A (without a BJT-driver).

author: Vovk_Z
author_rank: Super Contributor
timestamp: July 15, 2023, 01:56:03 pm
content: Quote from: Zero999 on July 15, 2023, 09:48:01 amI have a current source with transformer output too and having done it - I don't consider it easier. Because goid current transformers (CT) are large so take a lot of space and costly now and they have to be ordered somewhere.Nowadays we have powerful and quite cheap and ready to order 3-5 VDC SMPS with a rated current 30-50-60 Amperes (or more). Having done my own transformer output design and transformerless experience - I chose transformerless.With fast enough opamps (OPA189) you'll have quite low MOSFETs bias current and quite good efficiency too (of cause, with SMPS power supply).

author: Zero999
author_rank: Super Contributor
timestamp: July 15, 2023, 02:28:31 pm
content: Quote from: Vovk_Z on July 15, 2023, 01:56:03 pmInteresting. 5V at 30A is still 150W of power dissipation. Did you use a class AB or D output?

author: macboy
author_rank: Super Contributor
timestamp: July 15, 2023, 02:49:39 pm
content: You can't provide a range or gain control signal from that DAC because it can't output DC. You are not the first person to look at a 24bit audio DAC and think, hey that's way more bits at lower cost, let's use that. The first problem is that those bits don't equate to accuracy. They are sold as e.g. 24 bit because they accept a 24 bit input word length, not because they resolve 24 bits. You need to look at the audio specifications to get closer to the truth. Math says 24 bits is 144.5 dB of dynamic range. The CS4344 has 105 dB dynamic range, which math says is effectively about 17.5 bits. Not only that but the THD+N is given as 90 dB. This is analogous to INL inherent non-linearity of a precision DAC. This further reduces the ultimate accuracy to ~ 15 bits. But those specs are from 10 Hz to 20 kHz. Not DC.You must also realise that audio DACs like these require a minimum sample rate. This is because they are Delta Sigma converters. They are actually a very low resolution DAC (often 5 bits or so) combined with a digital filter which oversamples the input data to a much higher frequency at that lower bit depth (that's the one sentence explanation; there's much more to it). After the internal manipulation plus the mandatory analog filtering at the output, the high-rate low-resolution signal is effectively averaged out to a higher resolution signal which meets the dynamic range, distortion, and noise specs on the datasheet, over the frequency range specified. The converter itself is not 24 bits, and it can't output DC.Nothing is for free, so cheap, high bit depth audio DACs are not the answer to output accurate DC voltages.Instead of asking, how do I use the output of this DAC to control the gain or range of the other signal, you should ask, how can I provide multiple ranges to cover my requirement of 30000:1 ratio of lowest to highest full scale output.

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: July 15, 2023, 03:58:11 pm
content: QuoteThanks for the feedback, PT8211 is a Resistor DAC, and I have successfully used it in another Project to generate DC, so it certainly can make DC voltages.QuoteYour Idea is interesting, Please share some circuits or info?

author: dietert1
author_rank: Super Contributor
timestamp: July 15, 2023, 04:05:44 pm
content: You still didn't solve the biasing. It's no longer visible in your graph, but you will see it when looking at THD. Why don't you read once more Marcos comments in the other thread.Regards, Dieter

author: PCB.Wiz
author_rank: Super Contributor
timestamp: July 16, 2023, 08:17:58 am
content: Quote from: ali_asadzadeh on July 15, 2023, 08:11:33 amI think you mean use the second channel as a system gain control / range selector ?You need to decide first how many ranges you need, and what precision you need on those ranges.You can get digital pots, but the cheapest ones are 5V models, tho +/-12V do exist, but at higher price.The resistor tolerance on digital pots is also poor, compared to fixed resistors. Mostly, they are used in ratio mode.Addit: I see AD have PGA range resistor blocks with good precision, but they are fixed as 4 x 1:2:4:8 choices, which may not be enough for you ?So you may be better with a simple 74HC4351 (latched 4051) and up to 8 fixed resistors for 8 ranges.A small MCU or some logic can run a frequency counter to do kHz-to-3-bits for the range selection, with the kHz info easily provided by your second DAC.

author: David Hess
author_rank: Super Contributor
timestamp: July 16, 2023, 12:49:06 pm
content: Quote from: ali_asadzadeh on July 15, 2023, 08:11:33 amThere are a couple of ways.The most straightforward is to use an operational transconductance amplifier, which inherently has a current output and an input which controls transconductance and therefore gain. This will certainly work, and has been in audio applications, however distortion levels are much higher than 24 bits although this is acceptable for most audio applications.A multiplier controlled by the level DAC could be used between the signal DAC and the drive circuit.The level DAC could be used to control the reference voltage applied to the signal DAC. This is the easiest way and likely provides the best performance over a moderate range of output amplitudes.

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: July 16, 2023, 02:09:52 pm
content: QuoteBut in simulation the results looks good, How can I check THD in simulation?QuoteYes.QuoteSounds interesting, do you Suggest any IC, or Schematics?Quotethese Audio DACs do not support Ref voltage, so You mean I can use a DAC to power another DAC?

author: Zero999
author_rank: Super Contributor
timestamp: July 16, 2023, 06:09:38 pm
content: Simulators are quite poor at predicting amplifier biasing because the real life components vary significantly and are temperature sensitive, so there's a feedback loop, as it warms up, which it'll miss.Have you actually built anything? It's not worth going any further until you managed to get it to work in real life.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: July 16, 2023, 09:03:36 pm
content: Quote from: ali_asadzadeh on July 16, 2023, 02:09:52 pmWhat clock frequency do you already use here, to drive the DACs ?

author: SiliconWizard
author_rank: Super Contributor
timestamp: July 17, 2023, 12:29:31 am
content: Quote from: ali_asadzadeh on July 16, 2023, 02:09:52 pmAs some have said, simulation has limits.But to answer this question: just issue a transient analysis, then a fourier analysis of the output signal (.four spice directive)Available both in ngspice and LTSpice.

author: David Hess
author_rank: Super Contributor
timestamp: July 17, 2023, 12:48:13 am
content: Quote from: ali_asadzadeh on July 16, 2023, 02:09:52 pmhttps://www.analog.com/en/parametricsearch/11106#/sort=s3,ascQuoteThen a DAC with an external reference in, or a multiplying DAC, would have to be used for the second DAC.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: July 17, 2023, 12:51:48 am
content: Quote from: ali_asadzadeh on July 15, 2023, 08:11:33 amYou should also check the currentthroughyour MOSFETS, in any simulation.With such a simplistic bias design you will have a very high quiescent current.Power may matter more than distortion fraction %.

author: ArdWar
author_rank: Frequent Contributor
timestamp: July 17, 2023, 01:36:32 am
content: I still not convinced these MOSFET won't simply shoot through with that kind of biasing.Depends on which exact IRF540 you're using, I'm pretty sure it's way past FBSOA at 5V/30A anyway

author: Vovk_Z
author_rank: Super Contributor
timestamp: July 17, 2023, 07:22:02 am
content: Quote from: ArdWar on July 17, 2023, 01:36:32 amYes, it's hard to control MOSFETs current so it's hardly dependent on good heathinking. But I have working prototype of this type and it works ok. (I"m sure that's not the best way but the simplest).

author: dietert1
author_rank: Super Contributor
timestamp: July 17, 2023, 07:52:19 am
content: What's wrong with the gate voltage multiplier that Marco recommended? If the temperature sense mosfet and the output mosfets are mounted on the same heatsink and you adjust the multiplier for a decent bias current, that should work very well. It's a good idea to generate the gate bias from another mosfet subject to similar temperature variations. And probably there will be multiple output mosfets with current balancing source resistors.Also i don't see how in a simulation one successfully drives a 200 mOhm load to 30 A from 5 V. It should be more like 6 or 7 V. For 30 Aac one needs like +/- 10 V.Regards, Dieter

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: July 17, 2023, 12:15:29 pm
content: QuoteI'm starting to breadboarding the design, for lower amps, maybe 3A, then If it's Ok, I will go for designing a New PCB.QuoteI will just use a simple STM32G030K6T6, And it's I2S peripheral, I would go for 192Khz Audio frequency, so the Bit clock would be like 6.144Mhz, Do you have some Ideas?QuoteI have checked it in simulation, and it's in mA range.QuoteIt has lots of components!QuoteI have changed the Sense Resistor to 10m, so now it can,

author: Barry Hardhouse
author_rank: Contributor
timestamp: July 17, 2023, 12:58:45 pm
content: Just for the record, I've successfully generated DC with 24-bit sigma-delta audio DACs (BB/AD parts... forget which exactly). But yes - the earlier warnings about not expecting 24 its of accuracy do apply. You can (I believe) count on sigma-delta DACs to be monotonic, which is often a desirable feature. Also, the lower you place your lowpass reconstruction filter corner frequency, the better your accuracy will be.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: July 17, 2023, 07:59:09 pm
content: Quote from: ali_asadzadeh on July 17, 2023, 12:15:29 pm?!If you have a host MCU driving this, why are you trying to extract GAIN set info, from an I2S stream via DAC ?Just run a few wires from the MCU ports to an analog switch that selects predictable and defined gains values.This is only a bench test set, KISS applies.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: July 17, 2023, 08:05:47 pm
content: Quote from: Barry Hardhouse on July 17, 2023, 12:58:45 pmYes, a low cost TI DAC part I looked at, specifies like thisDC ACCURACY% of Gain error ±1 ±6 FSR% of Gain mismatch, channel-to-channel ±1 ±3 FSRBipolar zero error VOUT = 0.5 VCC at BPZ ±30 ±60 mVThey do not bother to specify DC temperature drift.Those map to a lot less than 24bits, but it is a simple and low cost DAC, and often those can be calibrated out on each unit.

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: July 18, 2023, 09:50:23 am
content: I have made a breadboard prototype, the output has good shape when there is no current drown,But When I add some resistors to sink some current, the output would have a lot of noise, I have used 4.7ohm resistor as the output load, also I did not used the current feedback for simplicity now.why I get these noises?

author: dietert1
author_rank: Super Contributor
timestamp: July 18, 2023, 11:33:28 am
content: Probably it isn't noise but high frequency oscillation. You can try to insert a 10 Ohm resistor in series with each mosfet gate. And make the other wires shorter.Regards, Dieter

author: Vovk_Z
author_rank: Super Contributor
timestamp: July 18, 2023, 06:39:18 pm
content: And I don't see any capacitors in power lines.

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: July 20, 2023, 07:56:41 am
content: Quoteeagle eyes, the problem solved! thanksHow much Cap do you recommend for 30A?

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: July 20, 2023, 01:21:25 pm
content: Guys do you have any idea about AM modulation, is there a clever way to implement it in this design? so I can get ride of range resistors or digital POT IC's.

author: Vovk_Z
author_rank: Super Contributor
timestamp: July 20, 2023, 05:16:45 pm
content: Quote from: ali_asadzadeh on July 20, 2023, 07:56:41 am>= 47 uF. That's not a strict science, I guess you may try anything like 0.1 uF and larger to get rid of power wires inductance.

author: David Hess
author_rank: Super Contributor
timestamp: July 20, 2023, 11:23:49 pm
content: Quote from: ali_asadzadeh on July 20, 2023, 07:56:41 amIt depends on the required ESR. 22 to 100 microfarads per amp for aluminum electrolytic capacitors is a common starting point.