DAC controlled VCA, linear in dB (LM13700 OTA and an Exp converter) - Page 1
Forum section: electronics / projects

author: Yansi
author_rank: Super Contributor
timestamp: November 16, 2022, 12:09:20 am
content: Hello,I would like to discuss my idea, that I could control a VCA (built from a LM13700 OTA) from a DAC, linear in dB (for example 1V per 20dB attenuation).To explain in more detail: The signal chain is supposed to be DAC -> Exponential converter with current output -> OTA bias current IABC. The goal is simply to be able to control a signal gain, on a logarithmic scale (dB).I am now puzzled, if this is even possible, at any sensible dB ranges (at least 60dB, better 80dB range).In theory, this should work, but in practice, I see issues:First the OTA LM13700 is specified for absolute maximum of 2mA IABCcurrent. Okay, so lets have it at 1.5mA at maximum gain setting. Then, if I need to go 60dB down with gain, the bias current needs to be 1000x lower, 1.5uA. Okay, does not sound terrible. At 80dB attenuation, I'd need 150nA. Starting to enter a danger zone. In the datasheet of LM13700, they claim gmadjustable over 6 decades. Like 120dB, really? That would mean I would be chasing picoamps on the bias inputOr do I miss something? Do they mean 6 decades with both OTA in series (3 decades / 60dB each)? That sounds much more doable. In my case of 80dB range, that would mean just 40dB variation per single OTA, which sounds about fine. Is this the right approach?Second the exponential converter. I mean the classical circuit with an opamp and a differential pair. Very good sources of explanation and practical tricks can be found at the links below, however: Will this be precise enough and stable enough (temperature-wise) for the job? What precision do I need you ask? Good question, very good. I need multiple channels of this to be able to track like say within a 1dB? The more precise the better. I do not have a strict requirement for an absolute precision, but the channels must track each other well, if set to the same level of attenuation from the DAC.This is supposed to be a cheap solution, so no specialty unobtanium ICs allowed, all must be cheap and simple. LM13700 and a simple pair of NPN/PNP in a single package like BC847BS is the best I would allow for.Actually, now that I am thinking about using two OTAs in series per channel, all makes much more sense. Even at the 80dB range, that gets me to just 100:1 current variation, which should be a piece of cake, right? Heck I could likely even do without the Exp converter, as even the cheap 10bit DAC could fit a 100:1 range of current programming, but would not provide enough resolution at the bottom end to make a fine tweak of attenuation. So better to keep the Exp converter then?Pls note also that using two OTAs in series seems not to require two current sources, the IABCbias input pins 1 and 16 seems to track each other very well and can be tied together making a control of the pair very easy.What do you think about this design idea? Does it make sense? Is 40dB (two decade) range achievable with the simple Exp converter? Or even 50dB (316:1) for a 100dB overall attenuation range? Or am I trying to design a nonsense? Please let me know. Any hints appreciated.https://www.xonik.no/theory/vco/expo_converter_1.htmlhttps://www.xonik.no/theory/vco/expo_converter_2.htmlhttps://www.schmitzbits.de/expo_tutorial/

author: moffy
author_rank: Super Contributor
timestamp: November 16, 2022, 12:31:06 am
content: You might want to consider the LM1972:"The LM1972 is a digitally controlled 2-channel 78dB audio attenuator fabricated on a CMOS process.• Daisy-Chain Capability Each channel has attenuation steps of 0.5dB from 0dB–47.5dB, 1.0dB steps from 48dB–78dB • 104dB Mute Attenuation"https://www.ti.com/lit/ds/symlink/lm1972.pdf?HQS=dis-mous-null-mousermode-dsf-pf-null-wwe&ts=1668558222085&ref_url=https%253A%252F%252Fau.mouser.com%252Falso 0.003% THD and Noise much better than you would get from a LM13700. Used them a number of years back for a MIDI controlled digital mixer and they were excellent. No discernible switching noise which is a problem with non audio DACs. They also appear to be available at Mouser.

author: Yansi
author_rank: Super Contributor
timestamp: November 16, 2022, 05:00:51 pm
content: Hello,yes, the LM1972 is an interesting device I did not know about, might even be a solution for what I need it for. Mouser has stock and it is not as expensive as something like this could be. So this time for simplicity, I will probably use this IC, but still I'd like to at least investigate the LM13700 solution. I will try building some prototype of the above mentioned topology to see where I will end up with it.The only disadvantage of the LM1972 is the fixed step, that is probably good enough for most applications, but my original requirement (or wish so to speak) was 0.1 dB resolution, at least in the "near and below 0dB" region.But the much lower THD of the LM1972 is also a strong argument. Will probably have to look for some ways to measure THD+N at home, to get at least some estimate of the resulting distortion of the 13700 VCA.Y.

author: dmills
author_rank: Super Contributor
timestamp: November 16, 2022, 05:56:21 pm
content: You want a Blackmer VCA, the common ones these days being made by THAT Corp.Control input is 6mV/dB, so while you need to buffer and scale, you don't need an external log converter which is nice as building one that tracks well with temperature is a bit of a pig.

author: Yansi
author_rank: Super Contributor
timestamp: November 16, 2022, 07:57:55 pm
content: Very interesting. Never heard of a Blackmer gain cell. Surprised some ICs from THAT are also stocked at Mouser. And not as evil priced, as I would expect them.But I think to solve my current problem I will stick with the LM1972, that is best bang for buck and still less THD than those THAT VCAs.Maybe I will buy a few pcs of that Blackmer VCA to toy around with. But first the LM13700 OTA experiment. I have some days off at work now, so likely enough time to cobble something together and measure its performance.

author: moffy
author_rank: Super Contributor
timestamp: November 16, 2022, 11:39:02 pm
content: A good article to read is by Bob Pease:http://www.introni.it/pdf/Bob%20Pease%20Lab%20Notes%20Part%205.pdfin the section, "What's All this Multiplication Stuff: (Part IV)" on page 72. He designs and tests a VCA using the LM13700, but only manages about 0.5% THD and 70db SNR, but it is a fun read as are most of his articles.

author: Yansi
author_rank: Super Contributor
timestamp: November 18, 2022, 08:55:09 am
content: I will give it a read. But 0.5% and especially just 70dB SNR sounds pretty terrible.//EDIT: Note for other readers, the PDF is not searchable and the page is not 72, but rather 16.Took me a while to find the article.

author: moffy
author_rank: Super Contributor
timestamp: November 18, 2022, 09:19:32 am
content: Quote from: Yansi on November 18, 2022, 08:55:09 amSorry, my bad, I went by the page number at the bottom of the article not its number in the document.

author: Yansi
author_rank: Super Contributor
timestamp: November 18, 2022, 09:30:57 am
content: Okay, the article was rather short, easy to read. Have expected some heavier and thicker porridgeJust wondering how much influence on THD the output I to V converter stage has. It is expected to use the darlington pair, loading the OTA with a resistor, so the output voltage varies with current. I have seen some more "precision solutions" with the 13700 OTA to use an opamp as an active I to V converter, making the OTA work into a virtual ground node, so having a constant output voltage at 0V. That inherently must get rid of both the distortion coming from the Early effect in the output stage of the OTA and the distortion coming out of the rather crude NPN darlington buffer.Although not sure about how much % of THD one could shave off with the active I to V converter, I would still need to use an opamp as an output buffer for various reasons, so why not have it work as an I to V converter at the same time.

author: jwet
author_rank: Frequent Contributor
timestamp: November 18, 2022, 04:52:33 pm
content: Attached is a circuit using the 13700 as a sort of AGC/Limiter in a fairly high quality piece of audio gear (Definitive BP7000). It doesn't run the signal through the VCA directly but just use it as a log attenutator followed by a buffer/low pass (LM-324). This amp uses LM-324's in the signal path all over, they are much better than I expected especially on large dual supplies with small signal ranges. I assume they do this to avoid the .5% kind of distortion they would get in the 13700 path. Took my a bit to wrap my head around this circuit when I ran across it.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 18, 2022, 07:56:41 pm
content: You already have an exp converter:Run the DAC ref from a couple diodes stacked in series. Run DAC output into Iabc directly. Still put in some current limiting, sure -- say, drive it from an op-amp with a series resistor from OUT to Iabc, but take feedback voltage from V(Iabc) so it regulates pin voltage while it can, but saturates when the resistor hits ~2mA.It would be nice to subtract some range off the bottom, though I suppose that's really only saving one or two bits, and wide dynamic range will indeed require a wide spread in V(Iabc).I think this still misses some ratio or tempco business, but I think corrects for the worst of it, and perhaps a PTAT compensation is needed which would be pretty simple to do in the MCU controlling it.Tim

author: Yansi
author_rank: Super Contributor
timestamp: November 19, 2022, 12:13:14 am
content: jwet: That is an pretty interesting solution. However, you still will get distortion, as the "virtual resistance" produced by the OTA will not be ideally linear. Hard to guess what led them to this solution; LM324 is no HiFi opamp either. Somebody wanted to save every penny there.Tims idea seems interesting, however still not that easy to make 6 or 8 channels track each other well I would guess. Not to mention one would need to reference the logic to the V- rail, which is doable, but annoying.Doing PTAT in the MCU directly? Heck that sounds like an interesting solution worth thinking for a bitWanted to apply some evil NTC hackery, but the MCU could utilize even some higher order corrections.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 19, 2022, 12:57:43 am
content: Quote from: Yansi on November 19, 2022, 12:13:14 amIndeed, simple in concept, what can I say, I'm an ideas man.A bit of level shifting, other support amps... par for the course. If it were easy, it would be digital.Speaking of digital, I take it digipots are out for some reason? Not sure offhand how thelinearitylogarithmity of the log types is, or dynamic range. Also frequency response (flatness) is a problem, for all of these actually, and not really brought up yet.Though on that note, the log shunt attenuator idea a couple posts ago is probably pretty good; dynamic range not so much, I mean, gm can only go so high, but maybe with a few stages that would be suitable. The fact that the divider node has a fixed (maximum) impedance means it should be relatively independent of frequency. Much better dynamic range and distortion than the discrete (JFET) equivalent!QuoteMost(?) MCUs have PTAT integrated to the ADC already; though not very good (clearly it's just a biased diode junction, with poor calibration and all that -- usually the cal settings are stored onboard at least). An NTC divider and 3rd or 5th order polynomial correction is pretty easy and more accurate than anything you'll ever need.Assuming an MCU at all of course.Tim

author: jwet
author_rank: Frequent Contributor
timestamp: November 21, 2022, 10:44:46 am
content: This is a subwoofer amp path- << 1000 Hz. The low frequency distortion of the LM324 is excellent believe it or not. Agreed, funny choice, more used to 5534 or TL074...

author: Yansi
author_rank: Super Contributor
timestamp: November 22, 2022, 02:07:20 pm
content: Unfortunately, I did not have the time yet to toy around with the 13700, meanwhile I have accepted the LM1972 as a solution fitter for the job. Already drawn a PCB for 8 channels, hopefully without mistakes. It is not the best of layouts I could be proud of, so hopefully I will get no digital noise in the audio, when changing the LM1972 taps.Well... what will you do.... just 2 layers and "pack it smallest possible". Ended up in just about 150x60mm area, including the 8 double stacked in/out 1/4" TRS jacks.Today I will start working on the front panel. Hopefully, that will be easy.Quote from: jwet on November 21, 2022, 10:44:46 amWell, Behringer for examples uses 324s in their equipment also in the LF signal paths. But let me tell ya, even if the distortion is good enuf (which I do not believe it is), you can always tell by the increased noise. (my own experience with a 31 band GEQ of theirs)

author: jwet
author_rank: Frequent Contributor
timestamp: November 22, 2022, 05:10:58 pm
content: I agree, I'm skeptical. The data sheet says .001% but in the typ op graphs, it rises pretty sharply. I don't have really good way to measure low distortion levels, maybe a lash-up with an PC audio card...Good luck on your project. The trick in mixed signal layout is usually to be very careful about keeping analog and digital grounds separated until you get back to one final low Z point that ties together. Tiny area can be a benefit as if forces loops to be small.

author: Yansi
author_rank: Super Contributor
timestamp: November 24, 2022, 08:36:01 am
content: Quote from: jwet on November 22, 2022, 05:10:58 pmNot sure about this. It is a long told misconception. In almost any modern mixed signal appnote, they tell you exactly not to split grounds. It is bad for noise, it is bad for EMC (both radiation an susceptibility). Just keep solid ground plane and think about where the return current is flowing. Same with all the modern audio ADCs and DACs: All of them on solid ground planes.But as usual with any engineering: Applying brain instead of universal "rules of thumb" helps a lot.Luckily, the noisy digital part is on a well separated PCB, so the only digital is the serial line to those LM1972. So worst case, the digital noise will mask at the time of attenuation changes, no data flows there in a steady state. Also have tried to apply slew rate limiting on all digital lines to not radiate excessively.The audio PCB is finished, now need to work on the front panel of the device, maybe at the weekend. I'll keep you posted, once I will test it.

author: jwet
author_rank: Frequent Contributor
timestamp: November 25, 2022, 09:19:10 pm
content: I was an FAE for Maxim for several years and helped a lot of customers with mixed signal layout messes. A 4 layer board with a solid ground plane is a nice luxury and works in a lot of cases, but solid engineering works best as I'm sure you know. You really have to keep your downstream path to ground free of crud in mixed signal, precision stuff. The best way I've found to handle this is to segregate grounds carefully and tie them together at a golden spike. There is a lot of "it depends" stuff here. I'll have to look at some modern layout tips for precision ADC's and the like, its been a while.

author: dmills
author_rank: Super Contributor
timestamp: November 25, 2022, 10:17:40 pm
content: Bruno Putzeys has an excellent paper on avoiding the whole 'ground' mess entirely.https://www.diyaudio.com/archive/blogs/alexcp/attachments/1926d1460406090-bruno-putzeys-micropre-g-word.pdfWell worth the time.Regards, Dan.

author: jwet
author_rank: Frequent Contributor
timestamp: November 26, 2022, 12:29:35 am
content: Good read- especially for audio. There are a lot of cases where this won't apply. Many/most sensor circuits are single ended by nature. One end is ground and the other is "active". You can apply them to a diff amp , create a differential signal and process them differentially but you "still" have to watch where your return currents are going. One of the big hammers in audio is isolation transformers- nothing busts a ground loop like a non-galvanic connection though a magnetic isolator, ie a transformer but other than audio, these techniques don't apply. I respectfully standby my position- watch ground returns carefully. Diff drive is another big hammer but it really isn't universally applicable.

author: dmills
author_rank: Super Contributor
timestamp: November 26, 2022, 04:29:53 pm
content: Transformers, while excellent from a CM perspective are actually very much NOT a common choice for audio today because getting something reasonably flat in frequency and phase, and capable of handling reasonable level at low frequency without core saturation adding distortion is tricky and horribly expensive.You do see them, but it tends to be either 'copying some old 'classic' kit, or a 'we are expecting extreme ground shenanigans' sort of situation, for more mundane things a conventional balanced line RX is cheaper and usually better behaved.Single ended sources (like sensors) absolutely can benefit from differential input stages, you just make the difference amp measure the voltage between the ends of the sensor AT the sensor, yea, not perfect for various reasons, but by defining which points you are measuring between you get to mostly ignore voltage drops due to circulating currents.

author: Yansi
author_rank: Super Contributor
timestamp: December 17, 2022, 12:43:52 am
content: Hello guys!Sorry for the delay, but I have been working a lot of stuff recently. Today I have finished assembling the first prototype of my digitally controlled hex-VCA device. So far everything has worked flawlessly - although not much thorough testing was done yet. Was bit afraid of the power supply noise from the multiplexed LED stuff, as it is heavily switching higher tens of milliamps. Fortunately, no noise in the audio path is observed, so I am pretty happy.As also obvious, I made provision for 2 extra channels, so the device may be used for 8 channels too. Attached is the photo of the current prototype.

author: moffy
author_rank: Super Contributor
timestamp: December 17, 2022, 04:06:39 am
content: Very nice, when I used the LM1972's I had no problems with digital feed through, they were very easy to use.