Building a sound mixer within my guitar amp with line IN & mic input - Page 1
Forum section: electronics / beginners

author: dazz
author_rank: Frequent Contributor
timestamp: June 01, 2019, 08:51:47 pm
content: I'm building a sound mixer in my DIY guitar amp, so that I can play the guitar and sing over a backing track. So far I have successfully implemented the mix of the guitar preamp output and the line in, which I use to play backing tracks from my phone. I went with a simple summing amplifier using an opamp as shown in the first pic.So now I want to add a balanced microphone input, and I'm simulating a couple of designs in LTSpice to get an idea of what might work and how.Initially I thought I would implement the circuit shown in attachment #2. As you can see I have an inverting opamp to shift the phase of one of the balanced mic inputs, then I sum that to the other mic input. I believe that's how balanced signals are supposed to be handled to cancel out common mode noise, right?So here's my first question. If you noticed, I used a non inverting opamp configuration to add both mic inputs, by mistake, because according to the articles I googled, it should be an inverting one (like the one I used for guitar + line in). The simulation seems to work fine, and seems to me I would also get the added bonus of high input impedance / low output impedance out of this non-inverting opamp config. Is there a reason to pick one over the other?Then I thought this design doesn't make too much sense. Instead of adding the guitar with the two line in channels, and then that to the mic, it would be more sensible to add both line in channels separately, both mic inputs separately, and finally sum the resulting line in, mic & guitar signals in a final summing stage. Problem with that is that the simulation doesn't work properly. I think I have issues with impedance because increasing the guitar level doesn't result in an increase in total opuput level. But I think I'd better leave that for later for now, to keep things simple and one question at a time.

author: Audioguru
author_rank: Super Contributor
timestamp: June 01, 2019, 09:48:35 pm
content: 1) A lousy old LM358 (and its sister the LM324) are never used for audio because they produce crossover distortion because they are low power. But for a guitar maybe you want the awful buzzing.2) Your mic balancing circuit cancels the mic signal. Look in Google for Balanced Microphone Preamp Circuit to see how a single audio opamp (not LM358) is used.I recommend an OPA134 single, OPA2134 dual or OPA4134 quad audio opamps.

author: dazz
author_rank: Frequent Contributor
timestamp: June 01, 2019, 10:08:41 pm
content: Quote from: Audioguru on June 01, 2019, 09:48:35 pm1) Thanks for that. Honestly, I haven't noticed any distortion from the LM358 I'm using now, but I admit I don't have a very good ear. I'll definitely get a bunch those other opamp you recommend.2) I found one using a differential opamp. I was using an inverter for one input and then a summing opamp, which seems really stupid when I could do it in a single stage with that differential configuration. Doh! That should work since the balanced inputs are out of phase, if I got right

author: Zero999
author_rank: Super Contributor
timestamp: June 01, 2019, 10:21:29 pm
content: Here's a video demonstrating the LM358's crossover distortion. It can be fixed with a pull-up/down resistor.

author: Audioguru
author_rank: Super Contributor
timestamp: June 01, 2019, 10:32:16 pm
content: The crossover distortion of an LM324 and LM358 is reduced when its gain is low because then it has a high amount of negative feedback that cancels distortion. Your line level inputs have a gain of 1.But your mic preamp has a gain of about 200 so its crossover distortion will be bad. Audio opamps do not need to be "fixed" with an added resistor.Since the LM324 and LM358 are not designed for audio then they produce a lot of hissss noise all the time.

author: dazz
author_rank: Frequent Contributor
timestamp: June 01, 2019, 10:35:32 pm
content: I have some TL082's lying around. Are those OK?At any rate, that thing about the pull down resistor is very informative. It's all about learning for me anyway, even if I don't end up using it

author: Zero999
author_rank: Super Contributor
timestamp: June 01, 2019, 10:40:54 pm
content: Quote from: Audioguru on June 01, 2019, 10:32:16 pmYes, the LM358 is noisy at 40nV/√Hz but it's a non-issue for a unity gain, although it's bad with a gain of 200.Quote from: dazz on June 01, 2019, 10:35:32 pmThat's better, but 9V is a little on the low side for the TL082. It will work, but don't expect great battery life, assuming it's run off a small battery.

author: Yansi
author_rank: Super Contributor
timestamp: June 01, 2019, 11:19:43 pm
content: TL082 will actually be better for battery life, than a NE553x or similar audio opamp.I think that a lot of older DI-boxes used 062 opamp also fed from a 9V battery.Also I do recommend you to get a book and read more on this topic: Douglas Self, Small signal audio design.

author: dazz
author_rank: Frequent Contributor
timestamp: June 01, 2019, 11:20:44 pm
content: No worries, the amp is powered through a laptop brick. It works with anything from 9V to 24V

author: Audioguru
author_rank: Super Contributor
timestamp: June 01, 2019, 11:30:31 pm
content: Years ago I was told that a TL081 is "general purpose" and that a TL071 is a TL081 selected for "audio" low noise and low distortion.But todays datasheets have identical spec's.

author: dazz
author_rank: Frequent Contributor
timestamp: June 01, 2019, 11:31:50 pm
content: And the simulation works great with the differential amplifier! Looks like I might have a winner here.I can use the other half of the dual opamp to buffer the non inverting input of the mic preamp, but if I pick large resistors for the differential opamp, the input impedance will be large, right?

author: Yansi
author_rank: Super Contributor
timestamp: June 01, 2019, 11:35:03 pm
content: Quote from: Audioguru on June 01, 2019, 11:30:31 pmThanks for mentioning that, I always wondered what the difference between 07x and 08x series was. I have also used always the 07x series for audio - or so was I thought these could be used with decent result.

author: magic
author_rank: Super Contributor
timestamp: June 02, 2019, 08:42:57 am
content: I think OPA1642 is a good replacement for OPA2134 these days, with less noise, lower power and otherwise similar specs.Sadly no DIP8.

author: Zero999
author_rank: Super Contributor
timestamp: June 02, 2019, 08:57:48 am
content: Quote from: Yansi on June 01, 2019, 11:19:43 pmThe TL062 has a lower operating current. The problem is the NE5532, TL072 and TL082 aren't properly specified at 9V, so there are no guarantees they'll work well off a 9V battery, especially as it discharges. Anyway, the original poster is using a mains powered supply, so this is a non-issue.Quote from: dazz on June 01, 2019, 11:31:50 pmA high input impedance is good. The only downside to using high resistor values is increased noise, but with a J-FET op-amp, such as the TL082, it's less of an issue, as the input noise current density is a fraction of a bipolar op-amp, such as the NE5532 or LM358. With the TL082 thermal noise will dominate, with input impedances above around 40k.

author: dazz
author_rank: Frequent Contributor
timestamp: June 02, 2019, 01:09:15 pm
content: Thanks guys. I'm buffering the non inverting input, just because I can. If that allows me to use smaller resistors that's probably good (I'm googling that stuff about input noise/thermal noise)I'm also looking up that book Yansi recommendedWhat I have simulated right now is attached bellow. But I probably rely too much on simulations and need to learn a lot more about real life issues like noise rejection and stuff.I found thismic preampdesign and the author aimed for a low CMR, which I believe is not simulated in LTSpice (not sure though). Actually I thought CMRR was just a function of the noise frequency while the actual configuration of the opamp circuit didn't matter. Off to google again I guess

author: Yansi
author_rank: Super Contributor
timestamp: June 02, 2019, 05:38:16 pm
content: Is it an input for guitar or microphone? This circuit will do anything but suck at being microphone amplifier. For standard microphone inputs, you need low impedance (~2kohm) and low noise amplifier. Neither TL0xx nor NE553x will cut the mustard here, with the buffer in front of it not by any chance. And going balanced inputs helps also by a lot. The easiest way to design a balanced MIC input is to just extend the differential opamp amplifier with a differential pair of suitable PNP transistors. Gain is then regulated by emitter degeneration in that differential pair.If you are designing inputs specifically for guitar (instrument input), then for a good sound higher the impedance the better. 1M or more is good enough. Then a FET opamp with large input impedance is the way to go.Do not forget good EMI and ESD protection on all inputs!

author: dazz
author_rank: Frequent Contributor
timestamp: June 02, 2019, 07:20:00 pm
content: Quote from: Yansi on June 02, 2019, 05:38:16 pmIt's a balanced mic preamp, the preamp for the guitar is already in there. I had no idea that low input impedance was required for this application.

author: Zero999
author_rank: Super Contributor
timestamp: June 02, 2019, 08:01:03 pm
content: Quote from: dazz on June 02, 2019, 07:20:00 pmWhat's your budget?How about an instrumentation amplifier? The INA163 and AD8429 look good but are pricey.http://www.ti.com/lit/ds/symlink/ina163.pdfhttps://docs-emea.rs-online.com/webdocs/10fa/0900766b810fa3b4.pdfAs far as low noise op-amps are concerned, the best one I could find in terms of price vs low noise is the NJM2122, but I've not actually used it before.https://www.njr.com/semicon/PDF/NJM2122_E.pdf

author: dazz
author_rank: Frequent Contributor
timestamp: June 02, 2019, 08:56:24 pm
content: Quote from: Zero999 on June 02, 2019, 08:01:03 pmThose INA163 go for 12€ on ebay, for a one-off like this that's perfectly fine, thanks for the suggestion, I'll check it out to see what it does. I was planning on doing this on vero board though, but I can do a pcb too if needed be.Meanwhile I removed the buffer from the simulation and reduced the resistor values to 6k8 to lower the input impedance to some 6K

author: Yansi
author_rank: Super Contributor
timestamp: June 02, 2019, 09:21:59 pm
content: Jeez. Why 12GBP part for something that can be solved with a couple of discretes?Your differential mic amp is useless. Instead of simulating stuff, where it tells you nothing more that the simulation is worth, try breadboard it.First, the amplifier has different input impedances in each input. Quite a fail, regarding CMRR. There is no easy fix for this, unless using a proper instrumentation amplifier configuration (three opamps).Second, whats up with R9? Wtf is there doing?And lastly, you're missing input protection (EMI) completely. Without it, microphone amplifier can't stand much chance.Instead of trying to reinvent the weel, why not lookin for the easily available literature I have suggested? Or to also find some schematic service packs for good old analog mixing consoles? (Allen&heath, Behringer, ... a lot of schematics available). Most of them used off-the-shelf parts costing peanuts, yet delivering performance.But, to be honest, even I have tried to reinvent mic preamps in the past, but I have done it with a soldering iron, so have hands-on experience with what works and how good. Just sayin, trying to save yerr some timeHere you go. Open the damn book I have suggested and read!Ya'll be surprised how well this works. THis circuit still needs some tweaking (at least adding 470p-1000p caps from inputs to ground and to add small resistors in series with input pins, about 5ohms for damping. C3 should be increased to 470-1000uF, 6.3V rating sufficient.).

author: dazz
author_rank: Frequent Contributor
timestamp: June 02, 2019, 09:45:30 pm
content: Quote from: Yansi on June 02, 2019, 09:21:59 pmYou're right, Yansi. OK... let's see... where's the Spice model for the breadboard?Just kidding, I know you're right.I noticed the difference in input impedance and was trying to fix it changing resistor values. But again, I was relying on the god damn simulation and something told me that wasn't the proper way to go about it.Oh, I see what you mean by EMI protection now. It's those 1nF cap & R10 between the inputs, a lot like what X caps do at the input of a power supply, right?As for R9, I put it there after reading this:https://www.eeweb.com/extreme-circuits/balanced-microphone-preamplifierIt's supposed to prevent oscillations with no input loadThanks for the schematic and everything else!

author: Zero999
author_rank: Super Contributor
timestamp: June 02, 2019, 10:11:36 pm
content: Quote from: Yansi on June 02, 2019, 09:21:59 pmFair point, the INA163 and AD8429 are a bit overkill, but it depends on what the goal is. If it's speed, i.e. just getting it done as quickly, as possible, with predictable results, it's the best way. If you want low cost, then discrete devices are cheaper and are more educational, so I agree, is probably best for the original poster.Anyway what do you think of the NJM2122? I was thinking it would work well in a three op-amp instrumentation amplifier configuration, with it providing most of the gain and the third op-amp, a cheaper one.QuoteLTspice can simulate noise, but I've not played with it much.Quote from: dazz on June 02, 2019, 09:45:30 pmThsat's a sensible enough circuit. No offence, but it'll better than what you've posted so far.R3 in that circuit is required because the NE5534 is not stable with noise gains under three. When the input is disconnected, the noise gain is reduced, as R1 and R2 are no longer in the circuit. R3 reduces the noise gain, to prevent oscillation. It's not required if you're using an op-amp which is unity gain stable, such as the NE5532, TL072 etc.See the following thread for more information.https://www.eevblog.com/forum/beginners/op-amp-spec-noise-gain-configuration/msg2401983/#msg2401983

author: schmitt trigger
author_rank: Super Contributor
timestamp: June 02, 2019, 10:17:15 pm
content: Yansi:Would general purpose PNP transistors work here?

author: dazz
author_rank: Frequent Contributor
timestamp: June 02, 2019, 10:32:46 pm
content: Quote from: Zero999 on June 02, 2019, 10:11:36 pmNo offense taken, of course. Really appreciate your help guys, even (or specially) if it involves telling me to stop doing stupid things.I'm obviously a clueless hack, but hopefully I'll learn a thing or two in the process of building this thing

author: Yansi
author_rank: Super Contributor
timestamp: June 02, 2019, 10:49:11 pm
content: Quote from: Zero999 on June 02, 2019, 10:11:36 pmI thought more of a practicality standpoint. Noise-wise it will be horrible no doubt, but the input impedance imbalance is a real issue in practical application. With such imbalance, you can't even design a sensible EMI protection around it that will not screw the CMRR even more.H.

author: Yansi
author_rank: Super Contributor
timestamp: June 02, 2019, 11:00:03 pm
content: Quote from: schmitt trigger on June 02, 2019, 10:17:15 pmWhy wouldn't they?BC557C, BC560C, or even some higher current ones provide for less noise, like BC327-25.In the old days, the golden transistor for the preamp was a 2SB737.Other trickery may be to use two parallel transistors to get the noise another 2dB down*.Here is an example of a mixer input stage:*Noise relations for parallel connected transistors:http://leachlegacy.ece.gatech.edu/papers/Parallel.pdfIf I remember right, such trickery was used in some Allen&Heath mixing desks.

author: Zero999
author_rank: Super Contributor
timestamp: June 03, 2019, 08:20:42 am
content: Quote from: Yansi on June 02, 2019, 10:49:11 pmWhich circuit/IC are you referring to?Let's also not forget that there's little point in designing an amplifier with an input noise voltage much lower than the noise figure of microphone. A 200R dynamic microphone will have thermal resistance noise voltage of 1.8nV/√Hz at room temperature, plus some thermal acoustic noise, roughly matching its frequency response. The air molecules and the actual transducer itself will randomly vibrate, at temperatures above absolute zero.

author: dazz
author_rank: Frequent Contributor
timestamp: June 03, 2019, 12:09:15 pm
content: I'm reading about 3 op amp instrumentation amplifiers now and I'm a bit confused. Apparently it's a differential op amp with both inputs buffered through 2 low noise op amps. But that would have a very high input impedance, didn't I need low impedance at the inputs?Quote from: Zero999 on June 03, 2019, 08:20:42 amPretty sure he was talking about my circuit

author: Zero999
author_rank: Super Contributor
timestamp: June 03, 2019, 01:55:16 pm
content: Quote from: dazz on June 03, 2019, 12:09:15 pmYes, that's correct, it will have a high impedance input. The good thing about it is it doesn't require adding any resistors in series with the microphone, which increase noise. The impedance can easilly be reduced by adding resistors in parallel with the microphone.

author: Bassman59
author_rank: Super Contributor
timestamp: June 03, 2019, 04:17:37 pm
content: Quote from: dazz on June 02, 2019, 08:56:24 pmThey're easily less than half that through a proper distributor. eBay? Why bother.Also considerTHAT 1510 or 1512.

author: dazz
author_rank: Frequent Contributor
timestamp: June 03, 2019, 09:28:19 pm
content: Quote from: Zero999 on June 03, 2019, 01:55:16 pmOf courseQuote from: Bassman59 on June 03, 2019, 04:17:37 pmBecause after shipping fees to Spain it's actually pricier in digikey or mouser last time I checked.I'm making a parts list for the preamp that Yansi suggested, but I'm pretty sure that I have everything I need except for the pnp transistors.How about thisINA217? The plan right now is to build both, the one with instrumental opamps and Yensi's design

author: Audioguru
author_rank: Super Contributor
timestamp: June 03, 2019, 09:33:03 pm
content: An instrumentation amplifier has all the resistors needed perfectly matched for excellent common mode rejection. They have a high input resistance because they are used to measure high impedance heart and brain waves. A differential circuit needs the resistors matched which is either with very expensive resistors or with a trimpot or two for you to fiddle with.

author: Zero999
author_rank: Super Contributor
timestamp: June 03, 2019, 10:03:49 pm
content: Quote from: dazz on June 03, 2019, 09:28:19 pmThe INA217 looks perfectly fine to me.It's possible you wouldn't be able to tell the difference in sound between the two designs, especially if you didn't know which one was in the circuit, assuming you set the gains the same. This isn't because there won't be any difference in performance, just that it could be imperceivable.

author: dazz
author_rank: Frequent Contributor
timestamp: June 03, 2019, 10:17:02 pm
content: Thanks again guys. I'll order the parts I need to build those preamps, and while they arrive I'll see if I can get this one working with a TL082. Not sure how to set the gain in that one thoughThen I can compare their performance

author: Yansi
author_rank: Super Contributor
timestamp: June 04, 2019, 07:23:44 am
content: Look for single opamp differential amplifier at google. Gain way to easy! In this circuitabout 316. And you are supposed to trim the bottom feedback path to exact resistor ratio as the upper one for best rejection. However wit the input impedance imbalance it is pointless anyway.

author: dazz
author_rank: Frequent Contributor
timestamp: June 04, 2019, 08:24:38 am
content: Quote from: Yansi on June 04, 2019, 07:23:44 amOh, OK. I thought the trimpot was meant to balance the impedance of both inputs, even though that's not what the simulation showed.So the trimpot is there to make the ratios between R1/R4 and R2/R5 equal, to maximize common mode noise rejection, but of course, it's imposible to pick the resistors so that those ratios are equal and the input impedances are also the same.Well, at least I think I'm starting to get it (yeah, I'm a bit slow).I've order the components I needed to build the preamp you posted. I think I'll still try to build the differential one just because those components will take a couple of weeks to arrive.As for the gain control, I was considering adding a non-inverting opamp with variable gain after the differential stage, because adding a pot to the differential opamp would mess up the R1/R4 and R2/R5 ratios. I increased the values of the input resistors from 1k to 10k to lower the gain of the differential stage. I get 1k64 and 1k24 ohms of input impedance. A bit low and quite a significant imbalance, isn't it?

author: Zero999
author_rank: Super Contributor
timestamp: June 04, 2019, 09:33:33 am
content: I wouldn't bother with the potentiometer. I dare say 1% tolerance resistors will be good enough. If you're using screened twisted pair cables for the microphones, it should minimise common mode noise anyway. Another possibility is matching the resistor values by measuring them with a decent multimeter.The problem with the TL082 is it's relatively high voltage noise, which is why the NE5534 was suggested.What parts in the designYansi posted, are you having difficulty sourcing? There doesn't appear to be anything non-standard or difficult to find.

author: dazz
author_rank: Frequent Contributor
timestamp: June 04, 2019, 09:57:07 am
content: I just need PNP transistors. Ordered 100 bc557 already. Actually now that I think of it I might have a couple of cannibalized PNP transistors lying around

author: Yansi
author_rank: Super Contributor
timestamp: June 04, 2019, 12:54:15 pm
content: NE5534 on by itself (no discrete diff amp before it) is still quite noisy (TL0xx is heck of noisy) for a general purpose MIC amp. Do not go this way. Noise levels will get unacceptable when you will go with gains like 40dB or more.You can make a rough calculation of output SNR:NE5534 has a rating of 3.5nV/sqrtHz. At an audio bandwidth, this gets you to 0.65uVrms of equivalent input noise voltage. At a gain of 40dB, this results in 65uVrms noise. Considering a nominal signal level of 0dBu, that is a SNR = 20log(775/.065) = 80dB.Okay, 80dB aint that bad, but considering there will be a lot of added noise from the surrounding passive components and other culprits here and there, 80dB is the best case. In reality? 65 to 70dB I'd say. Even if 75dB SNR. Now imagine that mic amps are often used with gains over 40dB, this will worsen the SNR even further.So really, it is best to design for lowest noise right away. The discrete PNP stage is nothing complicated, in fact very cheap well known and robust solution to the problem. Also it is (or at least was) widely used back in the days, where engineers were engineers and not people gluing together fancy blackboxes (unnecessarily expensive ICs).

author: Zero999
author_rank: Super Contributor
timestamp: June 04, 2019, 01:36:25 pm
content: That's a bit of a generalisation. Whether the NE5534 is too noisy or not, depends on the application. The microphone impedance, sensitivity and how loud the sound being recorded, will all be factors. If the microphone is used in a fairly loud situation, such to record singing or a pick-up on a musical instrument, I doubt it will be an issue, as the ambient sound will always be higher than the NE5534's noise floor. If it's being used to record quiet sounds, such as insects moving around, then it certainly won't be good enough.I'm currently designing an intercom system, using the NE5534 as a dynamic microphone pre-amplifier, simply because there's no point in using anything better. It's not a balanced system: the headsets all have single core screened cable and tests have found that noise pick-up from the cable, exceeds that in the NE5534, even with a noise gain of 60dB (a two channel mixer with a gain of 50dB). I would love to use a balanced system or headsets with a built-in pre-amplifier, but it has to be compatible with an existing system, which is unbalanced, so is a no-goer.

author: dazz
author_rank: Frequent Contributor
timestamp: June 04, 2019, 04:31:14 pm
content: I believe I need much more than 40dB of gain if I want to take full advantage of the power that the amp can deliver. The power amp has a gain of 20dB, so x10 voltage gain. At 24V the voltage swing at the output of the power amp is 48V peak to peak, so at 20bB that's 4.8V at the output of the mic preamp. I read somewhere that the typical output of a dynamic microphone is 1mV, so that's 20log(4.8/.001)=73.6dB. Quite a lot of gain indeed. I understand the voltage output of the mic will depend on many factors, but does that work as a rough approximation?The plan is to design the preamp to be used with a good mic like a shure sm58 or something like that. I guess there's no point in designing for crappy equipment.So I couldn't find any pnp transistors, but there's a local store I can resort to. Bit of an inconvenience to drive there, but anyway. They have BC557C's in stock so I should be able to start breadboarding Yansi's preamp shortlyBTW, I'm guessing it's probably a good idea to roll a proper pcb for this to minimize noise issues, right? short & thin traces with proper separation and all that.Oh, and I need to modify the schematic so that it works with a single dc power supply, I'll do that now

author: schmitt trigger
author_rank: Super Contributor
timestamp: June 04, 2019, 07:49:49 pm
content: Quote from: dazz on June 04, 2019, 04:31:14 pmAnd a proper ground plane, too.

author: Zero999
author_rank: Super Contributor
timestamp: June 04, 2019, 08:26:57 pm
content: Regarding modifying the schematic for a single supply. Awhile ago, Audioguru posted some schematics showing single and dual supply configurations for inverting an non-inverting amplifiers. here's my version, which includes the differential configuration.The circuit Yansi posted can also be converted to single supply, fairly easily.The -17V supply becomes 0V and +17V, 24V. R6 and R7 can be replaced with potential dividers consisting of 10k resistors going to +24V and 0V, with the tap connected to the bases of Q1 and Q2. I can upload a schematic if that's not clear, but don't have time at the moment.

author: dazz
author_rank: Frequent Contributor
timestamp: June 04, 2019, 08:56:21 pm
content: Quote from: schmitt trigger on June 04, 2019, 07:49:49 pmYeah, I always try to have a large ground plane taking up as much area as posible.Quote from: Zero999 on June 04, 2019, 08:26:57 pmThanks Hero, this one was super straightforward. I'll keep those pics for future reference tooI have the preamp modeled in spice and working fine. Trying to figure out the best way to increase the gain. I get some 20dB with a 20V dc supply.Can I change the values of the resistors in the differential opamp to achieve more gain? I can significantly increase the gain by increasing R8 but will that mess up the CMRR?

author: Zero999
author_rank: Super Contributor
timestamp: June 04, 2019, 09:56:56 pm
content: You need to increase the value R9, so it's the same as R8, to keep the CMRR high.You will probably need to add another stage of amplification afterwards.

author: dazz
author_rank: Frequent Contributor
timestamp: June 04, 2019, 10:06:32 pm
content: Quote from: Zero999 on June 04, 2019, 09:56:56 pmUnderstood, I'll do just that

author: dazz
author_rank: Frequent Contributor
timestamp: June 05, 2019, 08:35:57 am
content: OK, I've been playing with the simulation of this preamp for a bit and there seems to be a problem.The op amp is biased very close to the negative rail and it's distorting a lot.Here's the output of the fourier analysis for a sweep in the gain potCode:Fourier components of V(micout)DC component:1.90883e-006HarmonicFrequencyFourierNormalizedPhaseNormalizedNumberComponentComponentPhase 11.000e+031.806e-041.000e+00-0.69°0.00°22.000e+033.648e-072.020e-03-91.38°-90.69°33.000e+038.163e-104.519e-06177.92°178.61°44.000e+032.217e-121.228e-0883.24°83.93°55.000e+031.890e-131.046e-09-14.35°-13.66°66.000e+032.190e-131.212e-09-5.75°-5.06°77.000e+032.814e-131.558e-09-10.74°-10.05°88.000e+032.764e-131.530e-09-9.19°-8.50°99.000e+033.352e-131.856e-090.70°1.39°Total Harmonic Distortion: 0.201955%(0.201950%).step g=10N-Period=1Fourier components of V(micout)DC component:2.10847e-006HarmonicFrequencyFourierNormalizedPhaseNormalizedNumberComponentComponentPhase 11.000e+032.247e-041.000e+00-0.68°0.00°22.000e+035.644e-072.512e-03-91.37°-90.69°33.000e+031.571e-096.993e-06177.93°178.62°44.000e+035.268e-122.345e-0884.87°85.56°55.000e+032.031e-139.038e-10-19.10°-18.42°66.000e+032.822e-131.256e-09-16.49°-15.81°77.000e+033.063e-131.363e-09-9.38°-8.70°88.000e+033.310e-131.473e-09-1.81°-1.13°99.000e+033.624e-131.613e-09-7.81°-7.13°Total Harmonic Distortion: 0.251209%(0.251205%).step g=20N-Period=1Fourier components of V(micout)DC component:2.48944e-006HarmonicFrequencyFourierNormalizedPhaseNormalizedNumberComponentComponentPhase 11.000e+032.908e-041.000e+00-0.68°0.00°22.000e+039.453e-073.251e-03-91.36°-90.68°33.000e+033.406e-091.171e-05177.95°178.63°44.000e+031.474e-115.069e-0886.21°86.88°55.000e+033.803e-131.308e-09-21.54°-20.86°66.000e+033.849e-131.324e-09-19.06°-18.38°77.000e+034.657e-131.602e-09-8.78°-8.10°88.000e+034.754e-131.635e-09-6.95°-6.27°99.000e+035.518e-131.898e-09-8.37°-7.69°Total Harmonic Distortion: 0.325115%(0.325112%).step g=30N-Period=1Fourier components of V(micout)DC component:3.28645e-006HarmonicFrequencyFourierNormalizedPhaseNormalizedNumberComponentComponentPhase 11.000e+033.947e-041.000e+00-0.67°0.00°22.000e+031.742e-064.414e-03-91.35°-90.68°33.000e+038.522e-092.159e-05177.97°178.64°44.000e+035.040e-111.277e-0786.94°87.61°55.000e+037.158e-131.813e-09-11.48°-10.81°66.000e+034.867e-131.233e-09-22.51°-21.84°77.000e+036.092e-131.543e-09-16.19°-15.52°88.000e+036.413e-131.625e-09-11.22°-10.55°99.000e+037.496e-131.899e-09-12.83°-12.16°Total Harmonic Distortion: 0.441366%(0.441364%).step g=40N-Period=1Fourier components of V(micout)DC component:5.15258e-006HarmonicFrequencyFourierNormalizedPhaseNormalizedNumberComponentComponentPhase 11.000e+035.681e-041.000e+00-0.66°0.00°22.000e+033.608e-066.352e-03-91.32°-90.66°33.000e+032.540e-084.471e-05178.00°178.66°44.000e+032.164e-103.810e-0787.19°87.85°55.000e+032.640e-124.648e-09-9.51°-8.85°66.000e+038.161e-131.437e-09-24.29°-23.63°77.000e+039.191e-131.618e-09-19.11°-18.45°88.000e+039.834e-131.731e-09-14.61°-13.95°99.000e+031.089e-121.918e-09-11.45°-10.79°Total Harmonic Distortion: 0.635190%(0.635188%).step g=50N-Period=1Fourier components of V(micout)DC component:1.01764e-005HarmonicFrequencyFourierNormalizedPhaseNormalizedNumberComponentComponentPhase 11.000e+038.787e-041.000e+00-0.64°0.00°22.000e+038.633e-069.825e-03-91.28°-90.64°33.000e+039.399e-081.070e-04178.07°178.71°44.000e+031.240e-091.411e-0687.37°88.00°55.000e+031.825e-112.077e-08-4.91°-4.27°66.000e+031.496e-121.702e-09-35.16°-34.52°77.000e+031.426e-121.623e-09-21.79°-21.15°88.000e+031.627e-121.852e-09-20.43°-19.79°99.000e+031.763e-122.006e-09-18.38°-17.74°Total Harmonic Distortion: 0.982516%(0.982515%).step g=60N-Period=1Fourier components of V(micout)DC component:2.62225e-005HarmonicFrequencyFourierNormalizedPhaseNormalizedNumberComponentComponentPhase 11.000e+031.486e-031.000e+00-0.60°0.00°22.000e+032.469e-051.661e-02-91.20°-90.60°33.000e+034.546e-073.059e-04178.19°178.79°44.000e+031.014e-086.826e-0687.56°88.16°55.000e+032.384e-101.604e-07-3.40°-2.81°66.000e+037.550e-125.081e-09-74.17°-73.58°77.000e+032.928e-121.970e-09-30.58°-29.99°88.000e+033.242e-122.182e-09-26.96°-26.36°99.000e+033.450e-122.322e-09-23.85°-23.25°Total Harmonic Distortion: 1.661638%(1.661637%).step g=70N-Period=1Fourier components of V(micout)DC component:8.82526e-005HarmonicFrequencyFourierNormalizedPhaseNormalizedNumberComponentComponentPhase 11.000e+032.788e-031.000e+00-0.51°0.00°22.000e+038.684e-053.115e-02-91.02°-90.51°33.000e+033.000e-061.076e-03178.46°178.96°44.000e+031.256e-074.504e-0587.93°88.43°55.000e+035.484e-091.967e-06-2.66°-2.15°66.000e+032.547e-109.136e-08-92.05°-91.54°77.000e+037.848e-122.815e-09-147.69°-147.18°88.000e+036.917e-122.481e-09-37.77°-37.26°99.000e+037.515e-122.696e-09-37.99°-37.48°Total Harmonic Distortion: 3.117192%(3.117192%).step g=80N-Period=1Fourier components of V(micout)DC component:0.000356279HarmonicFrequencyFourierNormalizedPhaseNormalizedNumberComponentComponentPhase 11.000e+035.657e-031.000e+00-0.32°0.00°22.000e+033.570e-046.310e-02-90.64°-90.32°33.000e+032.503e-054.425e-03179.02°179.34°44.000e+032.124e-063.754e-0488.69°89.01°55.000e+031.880e-073.323e-05-1.66°-1.35°66.000e+031.739e-083.075e-06-91.98°-91.67°77.000e+031.635e-092.890e-07178.29°178.61°88.000e+031.407e-102.487e-0883.03°83.35°99.000e+033.223e-115.697e-09-35.81°-35.49°Total Harmonic Distortion: 6.325785%(6.325785%).step g=90N-Period=1Fourier components of V(micout)DC component:0.00113987HarmonicFrequencyFourierNormalizedPhaseNormalizedNumberComponentComponentPhase 11.000e+031.023e-021.000e+00-0.03°0.00°22.000e+031.161e-031.135e-01-90.07°-90.04°33.000e+031.474e-041.440e-02179.88°179.91°44.000e+032.253e-052.202e-0389.83°89.86°55.000e+033.600e-063.519e-04-0.23°-0.20°66.000e+036.001e-075.866e-05-90.30°-90.27°77.000e+031.024e-071.001e-05179.66°179.69°88.000e+031.774e-081.734e-0689.49°89.52°99.000e+033.153e-093.082e-07-1.54°-1.51°Total Harmonic Distortion: 11.441146%(11.441146%).step g=100N-Period=1Fourier components of V(micout)DC component:0.00101971HarmonicFrequencyFourierNormalizedPhaseNormalizedNumberComponentComponentPhase 11.000e+031.253e-021.000e+000.07°0.00°22.000e+031.716e-031.369e-01-89.86°-89.93°33.000e+032.671e-042.131e-02-179.80°-179.87°44.000e+034.959e-053.957e-0390.25°90.17°55.000e+039.654e-067.703e-040.21°0.14°66.000e+031.970e-061.572e-04-89.65°-89.72°77.000e+034.055e-073.235e-05-177.85°-177.93°88.000e+037.317e-085.838e-0689.69°89.62°99.000e+032.300e-081.835e-06-33.04°-33.11°Total Harmonic Distortion: 13.864246%(13.864246%)The THD seems a bit out of whack, doesn't it? Here's a table with the THD for each gain level:Code:PotGainTHD0-14dB0.201955%1-13dB0.251209%2-11dB0.325115%3-8dB0.441366%4-5dB0.635190%5-1dB0.982516%63dB1.661638%79dB3.117192%815dB6.325785%920dB11.441146%1022dB13.864246%It gets a lot better if I reference the opamp to Vref (Vdd/2) instead of GND through R8 (R14 in my simulation below), but can I do that without ruining my CMRR again? Do I also need to add coupling caps to the opamp inputs if I do that?

author: Zero999
author_rank: Super Contributor
timestamp: June 05, 2019, 09:55:39 am
content: What's the power supply voltage? Try reducing Vref to 8V. That should increase the bias current through the transistors, thus the voltages across the collector resistors.By the way, does anyone know what the diodes are for? They're continuously reverse biased and appear to do nothing.

author: dazz
author_rank: Frequent Contributor
timestamp: June 05, 2019, 10:14:50 am
content: Quote from: Zero999 on June 05, 2019, 09:55:39 amHow the hell do I manage to miss the simplest solution every frigging time?Supply voltage is 20V in the simulation. Ideally I'd like it to work down to 12V, or 9V if possible.

author: Zero999
author_rank: Super Contributor
timestamp: June 05, 2019, 10:37:55 am
content: I think you'll struggle to get that circuit to run down to 9V, because you won't be able to get the voltage across the collector resistors to fall within the TL72's common mode range, at low voltages.You could replace the emitter resistors with constant current sources: try 1mA. See link below. Note that the diodes and resistor provide a reference voltage, which can be used for both current sources.http://www.ecircuitcenter.com/Circuits_Audio_Amp/BJT%20Current_Source/BJT_Current_Source.htmI hope you can see why I suggested an IC, for simplicity's sake, but you won't learn so much and it'll still work out more expensive.

author: dazz
author_rank: Frequent Contributor
timestamp: June 05, 2019, 11:22:40 am
content: Quote from: Zero999 on June 05, 2019, 10:37:55 amYes, learning is priority #1. I might use the IC for the actual amp eventually, but I'm definitely building this preamp.Probably a silly question, but can't I take the opamp inputs from the PNP emitters instead of the collectors where the voltage is close to Vref? I'm guessing the pnp stage needs to be emitter followers to act as buffers for impedance reasons maybe? I'm going nowhere until I understand bjt's reasonably well, so I'm going to address that before I continue messing with this circuit

author: Zero999
author_rank: Super Contributor
timestamp: June 05, 2019, 12:42:09 pm
content: Quote from: dazz on June 05, 2019, 11:22:40 amThe propose of the two PNP transistors is to boost the signal before the op-amp. The transistors are less noisy, than the op-amp so using them to amplify the signal before, improves the noise figure.Taking the signal from the emitters would be pointless, because there is no voltage gain at that point: look up emitter follower.

author: dazz
author_rank: Frequent Contributor
timestamp: June 05, 2019, 12:54:30 pm
content: Quote from: Zero999 on June 05, 2019, 12:42:09 pmYes, I know what an emitter follower is, but I'm only familiar with npn transistors and thought this was a common emitter job.I noticed something in the simulation: the dc bias at the opamp inputs is imbalanced, and that is what seems to be causing the distortion (see pic 1)So I tweaked the value of one of the emitter resistors (from 15k to 20k) until I got pretty much the same dc voltage at the opamp inputs. The distortion is gone completely and the gain skyrocketed too! (see pic 2) Why would the gain increase so much?I have no idea what I'm doing. LOL. Would a trimpot there be a good idea? Changing the Vref voltage didn't seem to help

author: dazz
author_rank: Frequent Contributor
timestamp: June 05, 2019, 10:07:22 pm
content: OK, I think the solution above was flawed. How about adding a cap like the one shown below? That seems to work fine, I get lots of gain with a few resistor tweaks so no need for another amplification stage.Well, I got the transistors today, so time to start prototyping this thing and do some actual tests.

author: magic
author_rank: Super Contributor
timestamp: June 05, 2019, 10:31:45 pm
content: Quote from: Zero999 on June 04, 2019, 01:36:25 pmConsider NJM2068, it's a dual, dirt cheap and very low noise - around 3nV/√Hz or so IIRC.

author: Yansi
author_rank: Super Contributor
timestamp: June 06, 2019, 08:49:08 am
content: You absolutely have to have a C13 in there, if operating from single supply. However, its value shall be increased way above 1uF if you want to use electrolytics, which you want anyway, cause 1uF is just too low to have a decent bass response. Depending on the R14 in there, but I'd guess 22uF may be fine.Output cap C5 shall be over 20uF also (even 47-100uF - not that uncommon to see).The higher the value, the lower the AC voltage across it -> less distortion. And also less phase mangling at the lower end of audio spectrum.And you are still MISSING the input EMI protection! Bypass both ends of C8 to ground using about 470pF caps and stick about 5 to 10 ohm resistor in series with both input pins.C11 shall be at least 470uF! You need a very low impedance in between the emitters to obtain high gain and low distortion.Use both C6 and C7 100uF.Even your frequency plot shows the response on the low end is very inadequate for audio use. You can't have a -6dB roll-off on bass in a mixing desk.I don't really see the value of Rop (R14, R18), but C9-C12 is likely limiting the frequency response upper end. There is no way this circuit would be that laze to chicken out at -3dB 20kHz. You can't design audio this way. The frequency response shall be 50kHz+ to get the flattest possible response within 20Hz to those 20kHz.Ain't nothing special analog mixing desks having bandwidths above 50kHz. It is to help to make transient responses better. Audio signal is not just a pretty sine-wave. (But understand there is really not much point in pushing the response much further beyond say 70kHz, you will just welcome noise and spurious signal, that may mix on non-linearities in the circuit and cause a perceivable interference).ALso, note the gain potentiometer shall be the C / Exponential type ("reverse log") for any practical use.

author: dazz
author_rank: Frequent Contributor
timestamp: June 06, 2019, 11:21:05 am
content: Quote from: Yansi on June 06, 2019, 08:49:08 amThanks so much Yansi. I'll change all those cap values you mentioned. Some of them I have so low because it didn't make a difference in the simulation (on the top end) and I'm used to guitar designs where that kind of low end response is usually fine. I didn't know a higher capacitance will entail lower distortion (BTW, I just got the book you recommended)Great to know that C13 is needed. I'll leave it there.Rop (R14, R18) is up at 68k (from 22k) to increase the gain a tad, but I'll probably need to tweak that value once it's built to maximize gain without distortion.The gain pot is indeed an antilog taper in the simulation. It just seemed to increase the gain much more evenly than the other tapers.

author: Yansi
author_rank: Super Contributor
timestamp: June 06, 2019, 11:47:07 am
content: Coupling capacitors typically limit only the frequency response on the low-end of the spectrum.With those 68k, 100pF is definitely the limiting factor (1/2piRC = 23.4kHz). If you want to keep the two feedback resistors 68k, then instead of 100pF I'd lower them to something more reasonable like 33pF. You just want to limit the bandwidth slightly to not allow for high frequency noise and spurious signal, but you do not want (nor need) to low pass filter the audio signal at 20kHz.Regarding the Rop=68k: It seems your maximum gain of the preamp is over 70dB. That is way to high for this circuit (SNR will become bad with such gain). I think you should lower the Rop somewhat so the maximum gain will be about 60dB, not more.The typical input gain preamp in a mixing console may provide a gain of about 10 to 50dB with the 40dB range tunable by the gain pot. If you want more than 50dB gain, you can always crank other pots on the mixing desk, to get additional 10-15dB moreThe minimum gain is basically set by the gain of the differential amplifier (opamp) part of the circuit. However, 10dB minimum gain is too much to allow for a line level signal to be injected into the MIC input, hence why mixer desks always allow means for attenuation the input signal by 10 to 20dB. Typicaly, there is a switch "20dB PAD" on the input, or the more common way is to implement two types of connectors: XLR for MIC level and a JACK (called typically also TRS 1/4") that is wired so that it attenuates the signal whenever something is plugged in - typically, just resistors in series with the signal that form a voltage divider together with the input imepdance of the MIC amplifier (10-20kohm LINE input impedance).Keep in mind that those LINE jacks are TRS (tip-ring-sleev, ie. "stereo" type in laymen terms), but are used to transfer also BALANCED signal. For stereo LINE signal you need two separate TRS jack inputs.Typically, TIP is the HOT side (positive polarity), RING is COLD (negative) and sleeves the ground as is standard.This configuration allows for plugging an UNBALANCED signal, using just a TS jack ("mono"), which shorts the COLD (negative) input to ground.I would recommend you to really look for some mixing desk service manuals/schematics to get a better idea how do these operate internally.I have never built a full diy mixing desk myself (if I would, I would do it in digital domain now, hihi - I like DSP stuff), but I would encourage to do it. I have only built several specialized blocks, for example a separate quad MIC preamp such as yours, to turn LINE level only inputs on my mixer to another four MIC inputs.Even if it will not be very useful result for practical use, you will pretty much learn a lot of the stuff during the process, which is why I love electronics.

author: dazz
author_rank: Frequent Contributor
timestamp: June 06, 2019, 12:06:39 pm
content: Yeah, it was the 100pF caps that were cutting off the high end. Obviously.If I lower Rop to 6k7 I get a nice 7 to 50dB range of gain and lots of highs. I'll start there as per your suggestion 🍻

author: Yansi
author_rank: Super Contributor
timestamp: June 06, 2019, 12:59:14 pm
content: 6k7 is a non-standard value, I'd round to 6k8, or even allow for slightly higher gain to fit to the 10dB minimum.Also a tip - make the gain pot just 5k, if you will increase the value further, the gain will not drop by much. Instead, it will make most of the turn of the pot do "nothing" and then the gain will go up. A don't forget to use the exponential (reverse log) type, with a linear one the gain can't be controlled nicely, as it will sharply peak just near the end of the turn.If you will have troubles finding the reverse log ones (seen plenty on fleabay, Aliexpress and Tayda), you can of course use normal log one, however you need to wire it then so the gain is rising with turning counter-clockwise (which is not pleasant, but still better than a linear pot).

author: Yansi
author_rank: Super Contributor
timestamp: June 06, 2019, 01:12:29 pm
content: Quote from: Yansi on June 06, 2019, 11:47:07 amI just forgot to add this:The resistor between the emitters of the PNPs define the differential gain of that stage. The single-ended gain of the transistor is still mostly the same (very low) due to the Rc/Re ratio being quite low.If you make the resistor between emitters of the transistors large (ie, none is present, gain pot set to maximum resistance or disconnected), then what you get is just a two separate common-emitter amplifier stages with just low gain (defined by approx. Rc/Re), hence why the minimum gain is mostly defined by the opamp following the transistor amp stage.By decreasing the gain pot resistance, you increase the differential gain of that stage. The single-ended gain of the circuit is still low (Rc/Re), hence why the stage has a good CMRR at very high gains.

author: dazz
author_rank: Frequent Contributor
timestamp: June 06, 2019, 01:27:02 pm
content: Oops, that was a typo. I meant 6k8. I'll rise that to 8k2 or 10K. I get minimums of 10dB and 12dB respectively with those.I see what you mean re: the gain pot. By lowering it's value it seems to perform more evenly across it's range. I don't have any C5k pots thoughThanks for the explanation of the common emitter gain stage, very helpful! So we get a high CMRR because the gain is low, and then we can "trick" the circuit to increase the gain by means of the resistor across the emitters. So you mentioned that's called emitter degeneration... off to google!One thing I'd like to ask you if I may about those bandwidth considerations you mentioned, do those apply to the mixer or the mic preamp? IOW, Do I really need that wide of a bandwidth in my mic preamp? I see most dynamic mics have a bandwidth of 50Hz-15kHz or whereabouts.

author: Yansi
author_rank: Super Contributor
timestamp: June 06, 2019, 02:00:06 pm
content: Yes, emitter degeneration. But also look for differential amplifiers* with two discrete transistors, that is where it gets interesting.*discrete ones are also often called a "long tailed pair".You may also find this interesting & practical explanation from w2aew:He does not explain the emitter degeneration though (zero ohms in between emitters).A lot of it can be found on the web and again in interesting books from Douglas Self (Audio Power Amplifier Design) etc.

author: Audioguru
author_rank: Super Contributor
timestamp: June 06, 2019, 02:58:51 pm
content: A Shure SM-58 vocals mic has its frequency response rise above 2kHz for "presence" then a sharp dropoff above 12kHz. Most people who have been deafened by sounds too loud and who are used to hearing a muffled AM radio think it sounds live. You do not want to cut high frequencies any more. If your first-order lowpass filter has a -3dB (half the power) cutoff at 20kHz then it is flat up to only 4kHz.When you increase the voltage gain of a transistor then you also increase its distortion. Negative feedback can be as simple an unbypassed emitter resistor reduces the gain and also reduces the distortion.

author: dazz
author_rank: Frequent Contributor
timestamp: June 06, 2019, 03:19:57 pm
content: Crystal clear. I think this should do. Added the EMI protection components too, so I think I'm finally ready for the build

author: dazz
author_rank: Frequent Contributor
timestamp: June 06, 2019, 03:29:01 pm
content: Oh, one more question please. Is it OK to use a LM358 instead of the TL082? The reason is that the LM358 goes all the way down to 0V, so it seems to work for lower supply voltages without distorting.The reason to pick the tl082 is noise, right? I'll put a socket to try both

author: Yansi
author_rank: Super Contributor
timestamp: June 06, 2019, 04:17:22 pm
content: 358 is utter crap. For a test, you may try. But for a final application, hell no. I would not go less than NE5532. (TL07x may be also an acceptable choice, if 20V is all you have).//this may not seem clear to a novice, but again, LM358 shall never be used for any audio applications, other than feeding a buzzer! LM324 the same applies (it is 2x LM358 inside anyway) //

author: dazz
author_rank: Frequent Contributor
timestamp: June 06, 2019, 08:01:23 pm
content: OK, I think I might have found one that should work for the final pcb version: LT6200https://www.analog.com/media/en/technical-documentation/data-sheets/62001ff.pdfEven less noise than the NE5532 at 0.95nV/√Hz, unity gain stable and rail to rail.

author: Yansi
author_rank: Super Contributor
timestamp: June 06, 2019, 09:13:33 pm
content: And who will pay for a 50pcs of $4 opamps for a mixing console?And btw, it is just 12V maximum. That won't give you much headroom for signal processing.None great expensive opamp will magically make the circuit work better, unless you know how to design it better*Stick with the industry proven NE5532 or NJM4560/4580. They are good for the task.*I mean for example, have you already studied how to optimize audio channel summing for noise performance? Using your LT6200 you may think will give you much better performance - it won't. The opamp is just 5x less noisy (14dB), but your overall summing node topology may influence the resulting noise by much more than that - in such case the LT6200 use just would not pay off.

author: dazz
author_rank: Frequent Contributor
timestamp: June 06, 2019, 09:45:37 pm
content: Well, I had no plans to commercialize it, but I see where you're coming from. I'll stick with the NE5532 then. In fact I already placed an order for a bunch of NE5534'sI have the datasheet here, looks like I need to figure out what those comp/balance pins do

author: dazz
author_rank: Frequent Contributor
timestamp: June 06, 2019, 10:09:58 pm
content: I think I already asked this, but can I reference the opamp to Vref like this and get rid of C13? or will that ruin my opamp's CMRR?It seems to allow for a much lower supply voltage without distorting. I simmed it at 12V, but works at 9V tooEDIT: I forgot to swap the tl082 for a NC5532 there, but still seems to do the trick

author: Yansi
author_rank: Super Contributor
timestamp: June 06, 2019, 10:12:27 pm
content: Balance pins are common on single-per-package opamps. These are used to trim the offset voltage to zero (you are balancing the input stage within the opamp). For an audio signal application, this is of a not that much of an issue, as a small output offset voltage is stripped by the coupling capacitors. (But it may be an issue in DC coupled circuits, such as power amplifiers).The comp pin is not very often seen now, but it serves to connecting an external compensation capacitor to change behavior ("slow down") the opamp a bit, to make feedback loops stable.

author: Yansi
author_rank: Super Contributor
timestamp: June 06, 2019, 10:17:57 pm
content: Quote from: dazz on June 06, 2019, 10:09:58 pmGood question! Not sure of hand, as I usually design these circuits with a symetrical supply voltage, but thinking about it...If your VREF source is low impedance and well bypassed against ground (which it should be!), then connect it against VREF.How is your VREF source circuit implemented?

author: dazz
author_rank: Frequent Contributor
timestamp: June 06, 2019, 10:20:53 pm
content: Quote from: Yansi on June 06, 2019, 10:17:57 pmIt's a simple voltage divider with 1k resistors (had to lower them as the load seemed too much for higher resistor values and Vref dropped significantly)But if I use NC5532's instead, since they're dual opamps, I can use one half to buffer the resistor divider and get very low impedance, right?

author: dazz
author_rank: Frequent Contributor
timestamp: June 06, 2019, 10:25:52 pm
content: See green box for Vref circuit as it stands for now. Measured some 150mW across the 1K resistors at 24V Vdd

author: dazz
author_rank: Frequent Contributor
timestamp: June 06, 2019, 10:36:48 pm
content: And I believe this is how I should buffer the Vref source with another opamp

author: Zero999
author_rank: Super Contributor
timestamp: June 06, 2019, 11:02:30 pm
content: Just a few comments, as I don't have time at the moment to thoroughly read everything and perform simulations.C13 should have been there to start off with. There's no reason why it shouldn't be there with a dual, rather than a single PSU and vice versa.Why not use the LM358? Just saying it's crap for audio, without saying why isn't very helpful. The main three issues with the LM358 are: noise, crossover distortion and insufficient slew rate. These can be problems for an audio amplifier, but they're not always as bad as many people make out.The LM358 has 40nV/√Hz of input voltage noise, so is no good for amplifying small, low level signals, such as those from a microphone. However isn't going to make much difference on a 400mV signal.Crossover distortion has been covered before and can be cleared up by adding a pull-down resistor, as mentioned earlier. The LM358 may introduce other forms of distortion and I admit, I haven't done any tests or seen any experiments to quantify it. I suspect it will be more of a problem, at higher gains.The LM358 only has a slew rate of 0.5V/μs or 500 000V/s. Try to get it to amplify a high frequency, high amplitude sinewave and it'll turn it into a triangle wave.SR = 2xΠxfxVpA 20kHz, 5Vp signal, will require an op-amp with a slew rate of at least 628 319V/s or 0.628319V/μs. In reality, you won't get an audio signal like that. Even a 10Vp signal which does have some content at 20kHz, won't have 5V of 20kHz in there, so it's a non-issue. Another thing is slew rate distortion doesn't sound nasty, like crossover distortion does, given the same figures of total harmonic distortion. Crossover distortion sounds very bad, while slew rate limiting distortion is very subtle, because it happens anyway when listening to sound, for a long distance, which attenuates the higher frequency content.https://www.electronics-notes.com/articles/analogue_circuits/operational-amplifier-op-amp/slew-rate.phpTry putting stickers over the part numbers of op-amps, swapping them in the circuit. Look at the waveform on the oscilloscope and listen to it. Is there and audible difference?Finally, as I said before, using constant current sources, rather than emitter resistors, in the differential pair will solve the problem varying power supply voltage, as well as boosting the gain and improving the common mode rejection ratio. I'll do a simulation if/when I get time.

author: magic
author_rank: Super Contributor
timestamp: June 07, 2019, 10:19:10 am
content: Quote from: Zero999 on June 06, 2019, 11:02:30 pmBecause 4558/4559/4560 are better if you really insist on cheap crap.

author: Zero999
author_rank: Super Contributor
timestamp: June 07, 2019, 12:44:54 pm
content: Quote from: magic on June 05, 2019, 10:31:45 pmYes, that was considered. It's only a little less noisy than the NE5534, which was chosen because it's more widely available and we already have a stock of them.Quote from: magic on June 07, 2019, 10:19:10 amNo, those op-amps won't work close enough to the negative rail, for this application. At least the LM358 will work. The problem is the volt drops across the collector resistors, at low supply voltages, is too low for most jellybean op-amps to work.

author: dazz
author_rank: Frequent Contributor
timestamp: June 07, 2019, 04:20:37 pm
content: The good thing is that the NC5532, TL082 and the LM358 are all compatible pin to pin. I'm socketing the opamp so I'll try them all.As for C13, I'm confused. Didn't we agree I could omit it and reference the opamp to Vref through a buffered resistor divider?I'm in the process of building the prototype and I will test both configurations but it would be nice to understand how to determine when CMRR is maximized. I think that's when the resistors ratios in the differential opamp are the same (R18 = R14 in my simulation, since both input resistors are missing and determined by the pnp outputs, which are the same), but don't know how referencing R14 to Vref instead of ground affects the math, if it does.I'm also going to simulate the constant current source in place of the emitter resistors. Apparently that's a basic building block that I need to figure out too. It has enough advantages and is simple enough to justify it going in the final pcb version, I think.

author: dazz
author_rank: Frequent Contributor
timestamp: June 07, 2019, 04:31:13 pm
content: Quote from: dazz on June 07, 2019, 04:20:37 pmCould the answer be a Thevenin equivalent, where both resistors (22K) in the divider would be in parallel (11K equivalent), and that would in turn be in series with R14 (6K8)? That would increase the value of R14 to 17K8 and ruin the CMRR.In that case, the addition of the opamp as a buffer for the divider would fix the problem, right? because the output impedance would be very high, and R14 would no longer be in series with a 11K equivalent resistance from the Vref circuit. I believe that's what Yansi meant when he said it should be fine as long as the output impedance of the Vref circuit was high it should be fine. Does that sound about right?

author: dazz
author_rank: Frequent Contributor
timestamp: June 07, 2019, 04:36:37 pm
content: Wait a minute, I can totally simulate common mode noise and test all this in LTSpice with another voltage source... I think

author: Zero999
author_rank: Super Contributor
timestamp: June 08, 2019, 11:06:06 pm
content: Here's a quick simulation of what I was talking about, with the constant current source. In the end I decided to use one current source, rather than two and the emitter degradation resistors AC bypassed with the variable resistor.This isn't the way I'd choose to do it. Unless there was an issue with clipping, I'd make the gain of the input stage high and add a potentiometer after the op-amp to attenuate it, if needs be.

author: dazz
author_rank: Frequent Contributor
timestamp: June 08, 2019, 11:28:47 pm
content: Thanks Hero!, looks great. I think I see why only one current source is needed. That's not a lot more complex than the original design. BrilliantIn other news, I finished the prototype today (on perf-board). Haven't tested it yet, but all the voltages seem right. Compared to the simulation they're all bang on.

author: dazz
author_rank: Frequent Contributor
timestamp: June 09, 2019, 03:13:22 am
content: Welp, what do you know, it works! Still not sure how well though, but it's definitely amplifying and doing so differentially as it's supposed to.So far I've only tested it with a function generator app from my tablet. When I feed it the same signal into both inputs, the sound goes away as it should.Well, italmostgoes away. I tried the following rudimentary test to approximate the CMRR: 20V dc supply, 1KHz input in one channel, maximum gain, I measured 17.7V RMS at the output of the power amp. Then I switched on the other channel so that the function generator inputs the same signal in both channels (common mode). Measured only 0.3V RMS. So if I'm not mistaken that would be 20(log(17.7/0.3) = 35dB of CMRR, which seems a piss por result. Considering how precarious the test is, I should probably ignore the 35dB figure, or take it with a pinch of salt.But then I redid the same test, this time referencing the opamp to GND through C13 instead of referencing the opamp to vref... same exact result, which leads me to believe that it probably makes no difference and I can safely leave the opamp referenced to Vref.Also tried both the TL082 and LM358 (NC5532's are on their way) and it didn't seem to make much of a difference in terms of noise

author: Zero999
author_rank: Super Contributor
timestamp: June 09, 2019, 10:03:47 am
content: C13 won't make any difference to the CMRR. The reason why I recommend having it is because it allows the value resistors in the op-amp's feedback loop to be changed, without affecting the DC operating point of the circuit.The CMMR of a simply differential pair will never be great and will vary depending on the gain, in this case. I still think you should use a three op-amp instrumentation amplifier, with a dual low noise op-amp, such as the NJM2122 for the inputs and a cheap op-amp on the output. It will offer an excellent CMMR, without any messing around.U1 and U2 are the low noise op-amps. U3 and U4 are the cheap ones.The 8V can be generated from +V (9V to 24V) using a low drop-out regulator.

author: Yansi
author_rank: Super Contributor
timestamp: June 09, 2019, 04:42:43 pm
content: You need to keep in mind, the gain needs to be variable, and you will get the same poor performance out of the circuit at low gain setting, where all the CMRR will be handled by the U3.

author: dazz
author_rank: Frequent Contributor
timestamp: June 09, 2019, 06:04:22 pm
content: Quote from: Zero999 on June 09, 2019, 10:03:47 amOh, I see what you mean now. As the resistors in the opamp are increased to get more gain, the bias voltage in the inputs decreases, which could potentially lead to early clipping. I think I could get around that by shifting the Vref voltage upwards as you suggested. But I still don't know if I need more gain. It seems to have plenty, I will know when I can test the preamp with a proper mic.Quote from: Zero999 on June 09, 2019, 10:03:47 amQuote from: Yansi on June 09, 2019, 04:42:43 pmI'll probably build that circuit too and see if I can compare their performance with the (very) limited equipment I have here.Meanwhile I put my prototype in the amp's box, which has a heavily filtered dc supply, and it's now almost dead quiet at maximum gain with a 2m lead connected at the input.

author: Zero999
author_rank: Super Contributor
timestamp: June 11, 2019, 08:46:03 pm
content: I don't see why the gain needs to be adjustable. As long as it doesn't clip, it can be attenuated by the next stage.I still think an instrumentation amplifier will have a better CMMR than a simple differential pair, especially if 0.1% tolerance resistors are used.

author: Yansi
author_rank: Super Contributor
timestamp: June 12, 2019, 11:45:16 am
content: you don't see, so tell us why yet all manufacturers of mixing desks make the input preamp gain variable, including those digital ones?Mic preamps are not all about CMRR only. There are other important factors, such as noise, PSRR, linearity (distortion THD, IMD, TIM), headroom, etc.However that is nothing new, that circuit design is a mixture of compromises.

author: dazz
author_rank: Frequent Contributor
timestamp: June 13, 2019, 05:41:47 am
content: Not positioning myself on the issue, but I did some tests yesterday with the gain maxed out and an attenuation pot and I'm probably leaving it that way. Eliminates the need for a reverse log pot and I have full control of the volume down to zero. Doesn't seem to be noisier either

author: Zero999
author_rank: Super Contributor
timestamp: June 15, 2019, 02:36:15 pm
content: Quote from: Yansi on June 12, 2019, 11:45:16 amI don't know, you tell me?Quote from: dazz on June 13, 2019, 05:41:47 amYes, that's a common design. Lots of microphone pre-amplifier circuits also have a fixed gain, with a an attenuator afterwards. It makes it easer to design for a fixed gain. You still need a log potentiometer though.

author: dazz
author_rank: Frequent Contributor
timestamp: June 15, 2019, 02:59:35 pm
content: Quote from: Zero999 on June 15, 2019, 02:36:15 pmInterestingly, a linear pot seems to work best in this case. I initially went with a log pot, but there was very little volume up until 3/4. Not sure why considering it's a volume pot.

author: Zero999
author_rank: Super Contributor
timestamp: June 15, 2019, 03:43:20 pm
content: Quote from: dazz on June 15, 2019, 02:59:35 pmWhat's connected to the wiper of the potentiometer? If there's a significant load, then it will have a more logarithmic response.Here's a simulation, comparing a truly logarithmic potentiometer with a linear 100k pot, with an 8k load: note the similarities.By the way, if it's not obvious how my potentiometer simulation works, here's a link to a tutorial I did awhile ago.https://www.eevblog.com/forum/beginners/simulating-potentiometers-using-ltspice/

author: dazz
author_rank: Frequent Contributor
timestamp: June 15, 2019, 03:54:18 pm
content: Yeah, that's it. The mic preamp's output goes to the mixer along with the guitar preamp output and the line in (where I connect my phone to play backtracks). According to LTSpice the input impedance is fairly low, some 5K Ohms. Rin is 22K, I probably should have picked larger resistors to increase the input impedance

author: dazz
author_rank: Frequent Contributor
timestamp: June 15, 2019, 04:03:26 pm
content: Thanks for the info on the LTSpice pot simulation. I'll take a look now.I modified an existing component to create my own pot with a parameter to pick the taper (1=linear, 2=logarithmic, 3=reverse log)But it seems to be rather inefficient and transient runs sometimes get stuck when I have one in circuit.Files attached

author: Zero999
author_rank: Super Contributor
timestamp: June 15, 2019, 04:51:21 pm
content: Quote from: dazz on June 15, 2019, 04:03:26 pmI'll have a look later.Did you look at the tutorial I linked to? Modelling a potentiometer from discrete resistors seems to result in a faster simulation and is more flexible, although the schematic doesn't look as nice with a symbol and it's a bit more clumsy to use.https://www.eevblog.com/forum/beginners/simulating-potentiometers-using-ltspice/

author: Audioguru
author_rank: Super Contributor
timestamp: June 15, 2019, 05:30:07 pm
content: Your "Mic output" is a very low impedance from the output of a preamp opamp. When you connect it directly to the (-) input of the mixer opamp then the mixer opamp will have a gain of almost infinity for its high frequencies. You MUST include a series resistance to set its gain low.

author: dazz
author_rank: Frequent Contributor
timestamp: June 15, 2019, 05:48:03 pm
content: Quote from: Zero999 on June 15, 2019, 04:51:21 pmI had a quick look, will test all those later today. The only reason I went with a custom pot is that it allows me to test different tapers simply by changing a parameter.Quote from: Audioguru on June 15, 2019, 05:30:07 pmYes, that was an incomplete schematic. The resistor is at the output of the mic preamp. It's of the same value Rin as in the other inputs