What goes from 0.8% THD to 14% THD over its predicted dynamic range in a simulated environment.
The answer to this question is shocking and it went right over my head until I started work converting my own designs to suit the original DIY Perks USB-C mic.
This is one of those things I miss but the issue is with the way the original design uses a split supply to the FET. Note that the "professional" lads are working with +48V all over the place and lower voltage versions use 12-15 volts but with both supplies positive. There's no immediately obvious reason (to me) that those early designs wouldn't operate with split rails - that precedes transistors by decades.
The answer is in the peculiar way that JFETs operate and I'm not going to dive into this right now because it's... kinda weird.
Here's a 100mV sine wave. A pure wave entering the JFET gate (in red) vs. what comes out at the source and drain:
Seems OK right? Now look at this one:
So what's happened? Well we've lost about 50% of the signal but that's no biggie, we've got a big amp on the other end and sure enough we do.
But that's not the whole story. Let's take a look at each of those signals closely.
Drain:
and Source:
This isn't that clear unless you spend days looking at sine wave in simulators and on measuring gear. This represents that horrendous distortion due to non-linearity in the behaviour of JFETs.
Thankfully there is a fix even IF you've made up everything as originally specified:
Take the source pin from your MICROPHONE capsule or whatever you connected -15 to and connect that to 0V at the pre-amp.
Or replace the 2K2 resistor from the -15V (source) line to the mic with a link (green line is the new signal at the source).
That's it. You don't have to do anything with the rest of the circuit. I love it when things just work out as quick and easy as that.
Either way, we're change how current flows through the FET and keep it inside the limited area where it's still relatively linear.
Even at low levels, the current design still exhibits considerably more distortion than the modified one the main difference is that's it not that noticeable a very low levels and high-sensitivity mics like the JLI2555 (which is excellent) tend to mask that.
Here's the test setup in LTSpice for comparison. You can get the distortion figures by pressing ALT-R (run the simulation) and then CTRL-L (log) to see the Fourier results.
Take everything I say with a pinch of salt, I might be wrong and it's a very *expensive* way to learn!
Hello @marcdraco!
Thank you for sharing this modification. I’m working on the preamp section of the circuit inspired by some of your earlier designs, and I’m really excited to incorporate this modification to improve it. Could you advise on the best way to implement this adjustment in my own circuit?
I'm a little confused on how implement it on the capsule circuit since I am only using one of the JFET outputs as the mic input.
thankyou in advance!
thank you in advance
Hi there,
OK, so the diode limiter goes to the output of the amplifier. If you're using an Op Amp (vs. a THAT which is an INA) you can put the diodes in parallel to the feedback resistor R19 (100k). Unless you're working on clean PCBs, you won't need a 1G resistor to bias the gate either as leakage will usually fix that.
R15 and R16 should be omitted and the non-inverting input (pin 3 on a TL082) should be connected to ground - those resistors don't actually do anything, this system is used to bias an Op Amp in cases where only a single supply is available.
Although this FET set up does work, it's far from ideal. Looking at it through cold eyes (it's winter here and my eyeballs are freezing over) what you're looking to do is a "common drain" setup so that the FET (and not just any old JFET, it has to have a Vgs-OFF less than about 0.6V ideally, like the 2SK208 or the LSK170s. 2N3819 which is a good, general purpose JFET won't give decent results (if anything at all).
A simple way to do common drain is to wire the drain to positive rail (no resistor) and the source to the 0V (not -15) line via a 2K2 resistor. Drop R2 and leave just R1 but connect that to GND/0V.
This is one of those weird things with JFETs which makes them both attractive and a huge pain the butt. For the FET to work (as an amplifier) the junction from drain to gate (which is a diode) has to be biased the wrong way around. The drain, has to be more positive than the gate AND the gate has to be more negative than the source.
When the circuit starts up, current flows in the channel from drain to source which causes a small amount of voltage to "drop" across R1 in your schema.
This, in turn causes the gate to go more negative than the source and forces the device into a self-supporting partly on condition. Source followers give current but not voltage gain, the voltage at R1 -> next stage follows the gate minus a few fractions of a volt.
In fact, if you're using a FET input device like a TL06/7/82 series Op Amp, you don't even need a JFET at all since the capsule can drive the non-inverting input of one amp wired as a follower (output to input) and then take that to the 100x (apprx.) amplification stage.
An op amp follower is one of the simplest, if not the simplest, thing we can do with these versatile devices and it's certainly one worth learning. You'll note that the inverting input and output pins on all dual-channel, 8-pin devices are next to each other because it's such a common use.
Take everything I say with a pinch of salt, I might be wrong and it's a very *expensive* way to learn!
@marcdraco
Thank you so much for the advice—I’ll be diligently noting down everything you share.
I've swapped out the JFET with the LSK170D you recommended and I have also tweaked the cct.
Here's the circuit so far!
I'm pretty happy with the design, and I think I might add a Low pass filter but I'm still unsure if it's necessary.
I don’t think I’d enjoy working on this project nearly as much without your help. You’re truly the GOAT!
thank you in advance
Hardly a GOAT, but thank you. I'm just one of you guys with a little bit more experience.
I'm curious as to why you used a pair of parallel 330R resistors on the output. You may be aware that Op Amps don't "like" to drive capacitors. We tend to miss this little "gotcha" in sims simply because SPICE doesn't typically model the output drive current. It could do so but that would make the models much more complex. The simple solution is to put a couple of 100 ohms in series with the output capacitor to reduce the load on the output. This is entirely dependent on the individual op amp and it's something that requires a fair amount of math to get right since it's talking about Poles an Zeros in the S plane.
When you're chaining the amp to another amp (as you would be here) a couple of hundred ohms of extra output impedance won't amount to the proverbial hill of beans.
If you're designing your own board, here's a more complex (but far more efficient) power supply smoothing system. The ferrite beads (shown as inductors/coils) can be left off. The transistors are also "Darlington pairs" although it will work with single transistors. It's just that the extra gain from a Darlington makes it better at what it does.
These are called "capacitor multipliers" but the name is a bit of a misnomer, they don't multiply the capacitor's value. What they do is take the LOAD from the capacitor by allowing it to hold a steady charge and delivering a much larger amount of current.
Matt used very large capacitors for the same effect, but strictly speaking the NMA0515 and similar devices aren't supposed to drive more than 47uF and ideally no more than 10uF. This is about the amount of instantaneous current - Matt's design uses a small series resistor to prevent the sudden load on the NMA0515 from frying.
Take everything I say with a pinch of salt, I might be wrong and it's a very *expensive* way to learn!
For your FET, the LSK170A is fine and more easily available. You can also use a 2K208 and a few others. Any JFET with a low "pinch off" voltage will do the the trick as they are inherently low noise.
Take everything I say with a pinch of salt, I might be wrong and it's a very *expensive* way to learn!
@marcdraco
Hello and thank you again for your sage wisdom.
Parallel Resistors:
The reason why I chose to use a pair of 330Ω resisters in parallel is so that I can produce a 165Ω resistance for my high pass filter. This should hopefully filter out signals from 100 Hz to get rid of some of the hummm, that can come from the rest of the circuit.
I was also thinking of adding a low pass filter as well to get rid of the hasher high frequency noise, but I'm still a little unsure whether I should do that or not.
thank you in advance
The thing with "passive" filters as you've described here is they tend to work better as a discrete filter block such as a VCVS (Sallen-and-Key) filter which is very simple and tunable. The other "gotcha" is the tolerance of large capacitors is on a par with that of JFETs. They simply aren't accurate enough to produce what the math suggests. The accuracy of any filter (any circuit actually) is only as accurate as the worst performing component in it. Same with noise - and the TL0xx series can be a little noisy compared to a proper audio grade Op Amp like the OPA2134.
If you screen the circuit correctly (and that's an art-form all of its own) you shouldn't experience any mains hum, even without using the balanced line. (If this wasn't the case, millions of microphones the world over would have humm issues.)
For the negative going supply side you'd need one or two PNP transistors such as BC557s. There's a variation on the Darlington that allows you to use a NPN transistor as part of the configuration, the "Szlaki pair" but even that requires a PNP to drive a larger NPN transistor. You could put a multiplier in on part of the circuit experimentally and it would make a difference but even Amazon can supply you a box of 250 assorted transistors for about £10 or less (search for BJT Transistor Assortment Kit ).
They're not exciting but there's plenty to play with. You can make a Darlington pair with two PNP or two NPN transistors. The idea is the first transistor multiplies the gain of the second one. While "beta" (gain) is pretty inaccurate an can vary widely, the Darlington or Szlaki configurations make it so large that the differences become minimal.
The reason I've used the particular transistors here is because they are 3-terminal Darlington devices, which saves on board real-estate. Using discrete transistors is perfectly fine but it just means you have more connections to make and therefore, more to go wrong. :/
If you look at my circuit vs. your own, note the direction of the arrow on the emitter terminal. This arrow shows the direction of (conventional) current flow. Electrons go the other way... but it's convention to use conventional current flowing from Positive to Negative.
All current is flowing "back" to the 0V line (ground) so you can follow the logic by tracing the path with your finger and using the arrows as "one way streets". Current flows in the direction of the arrow and cannot flow in the opposite direction without destroying the device.
Your Sim setup needs a couple of changes. C6 and C9 aren't required (they won't hurt but they won't do a lot either since we're already buffering the NMA0515's raggy output and I expect there's sufficient overhead in the device to cope with any sudden peaks (the 10uF would be acting as an extra energy buffer in this case). If extra buffering is required a larger capacitor (100-470u) fed by a small resistor (about 10R) would be better placed. It's very much suck it and see but even the 1W 0515s should have enough current to keep up with demand.
Spice is going to bite you with those voltage sources V5 and 6 though. Your input DC is coming from the left of the circuit - look back at my example and you'll see the supply comes from the NMA0515 and moves right from there.
You can simulate rattly supply lines by putting some AC on a DC voltage. So set your voltage source to (say) 15V DC but also (in the advanced settings) add in a sine wave of say, 100mV of 100Hz and using the .TRAN with UIC (use initial conditions) command, look at the waveform at the each collector and then at each emitter.
Now you have some grasp of SPICE, it might be a good time to learn KiCAD 8. It's not quite as easy as LTSpice on the surface but it's mostly about unlearning how LTSpice does things vs. how PSpice in KiCAD does things.
KiCAD is very (and I mean VERY) short of accurate models - you're usually stuck with a generic bipolar transistor or FET or a single-pole Op Amp but this difficulty can also shape your understanding. I find LTSpice is faster to CAD with but KiCAD is a nicer simulator to work with since you don't have to fiddle with "dot commands". One gotcha with KiCAD vs. LTSpice is that the pins of any given device often don't match up to the terminals on simulator and that's easy to miss.
There are a couple of free others (like Tina TI) and one of the REALLY powerful ones (Micro-Cap) is now in the Public Domain but it's not even worth considering until you have a very good background in SPICE simulation since it really gets into the weeds before you even get to run a simulation. Lots of good models if you're in a pinch though.
You're learning apace though! Might even be time to look into some formal training from some of the free courses offered by Texas and others. It's cheaper than buying Art of Electronics by two real GOATs - Paul Horowitz and Winfield Hill. It's massive, detailed and generally avoids all that nasty math that scares a lot of us away.
Hobbyists are often better served this way I find because we want a quick solution to our problem and don't have the time or mathematical background to get into the quantum-level interactions that have to be modelled with (in many cases) fairly hairy Gorilla calculus. You only need to check out a few pages on Wikipedia to see that. I find that Wikipedia editors are often impressed by their own cleverness and write technical articles that fly right over the heads of the sort of people that Wikipedia is intended for.
Winfield is a particularly good teacher and can be found on some pro-audio forums (DIY Audio is on IIRC) - and isn't the sort of guy to jump down your throat for making a mistake; many of the old guard will though, forgetting that they were once beginners like the rest of us. He even told me where to get a copy of AofE 3rd edition for free... But I saved up and bought one as my 2nd edition is almost 30 years old at this point. I think Win is more about sharing the knowledge than trying to make a few bucks. This is the spirit of Open Source - sharing what we've learned for everyone's benefit.
Take everything I say with a pinch of salt, I might be wrong and it's a very *expensive* way to learn!
HELLO again!
I have yet again taken everything you have said into consideration and have implemented all your juicy improvements. Here is the LTSpice model and Kicad model.
thank you in advance
That looks much better. If you run the sim (either one will do) you'll see that you lose about 1.5V across the Darlington pair - this is expected and don't worry about it, it simply means the Darlingtons are doing their thing. I wish I could learn at the speed you're picking this stuff up at!
The inverting amp (second stage) here is worth a look.
I note you've put a variable gain in the network - this is probably a bit "risky" because it's a in a very sensitive part of the circuit and any signals that couple (capacitively or inductively) to the flying connections (to your gain switch) will get amplified and could be a significant source of noise. Assuming you leave it as designed here, you've got a x48 gain even if you don't add any extra impedance into the loop.
The gain of an inverting amp as here is 1+ R6/R3
Nice and simple. In dB that works out to:
20 x log(48) = 33.6 dB
You might want to start a little lower, perhaps x11, which is roughly 21dB and work from there.
A more conventional approach for this sort of thing is to place a small impedance (1K is quite sufficient for an Op Amp) from output to ground and take "taps" off at various points in the resistor chain. We usually do this with a log-track potentiometer but you can do it with fixed resistors if you work out the chain. If you use (say) 10x 100R resistors that gives you a set of linear taps.
Why log? That's because our ears aren't linear; we perceive sounds increasing in loudness on a log scale.
Doing the log dance requires a little more maths, and a spreadsheet is your friend here.
Let's say we're going to have 6dB steps which isn't unreasonable as each step is twice as loud as the previous one.
To get the voltage gain we need we just reverse shuffle the calculation around to convert from dB to voltage gain.
So take the required gain for each step, lets take 12dB as an example:
10 ^ (12/20) = 4
So to set the gain at 4, you'd use a 3K feedback for R6. 3K3 is the nearest preferred (and easily available value). I tend to use the 5% tolerance values called the E24 set because it's so popular (see: https://en.wikipedia.org/wiki/E_series_of_preferred_numbers). Most resistors are now available in the E96 set which will get you much closer but these values are harder to source - same with the E192 set. These devices are for precision circuits where a very accurate response is required and these often use trimmers to get the precise value the designer requires.
This matters in things like medical equipment and especially measuring devices, industry and so on.
Our ears are incredibly sensitive to direction and frequency but not that sensitive to absolute volume so you don't need to be absolutely bang on and find a resistor network that gives you precisely 40dB. +/- 1dB doesn't make a whole hill of beans.
And Now For Something Completely Different
When I mention that our ears are sensitive to frequency and direction, I'm alluding to simulated surround sound where a DSP alters sounds before they are mixed, adding low-pass filters and very tiny delays to the channels to simulate a human head: a technique called HRTF or Head Related Transfer Functions. Dolby (most famously), DTS and Boom audio are all available for Windows systems and can do this for you. But here's the gotcha, if your headphones can't accurately reproduce the sound (most can't) the surround effect is reduced - especially things like objects behind or above us. Competitive gamers are most affected by this which is probably why we invariably see them all wearing fancy headsets in competition.
As another segue since we're on hearing, if you watch other mammals, cats in particular, you'll see that their ears operate almost on a swivel. If a cat hears something behind, it can rotate it's ears to pinpoint the exact position of that sound in relative space, in much the same way as we use our binocular vision. Pretty neat!
If you're wondering what the devil HRTF is, the simple explanation is that our heads act as low-pass filters AND time delays. The speed of sound is about 340 M/S in air which seems really fast when you consider that the average human noggin is about 140-150mm.
But our brains are fast and they multi-task too. Our vision is incredibly complex and each "frame" we see has to be processed before we perceive it. As I recall our perception of the world around us is about two tenths of a second behind "real time" but because we see the world as a continuous stream, that's invisible. Same way as we aren't aware of normal blinking (until you think about it) because our brain just doesn't include the blanking.
While the visual cortex is busily processing the vision deltas (the changes as they happen, a technique used in MPEG) our auditory cortex is able to figure out the time delay between something arriving at our left ear vs. our right ear. That's the time-difference it takes for sound to arrive at one ear vs. the other.
In addition, our skull absorbs sound and crucially, because our noggins are spherical, the amount of low-pass filtering that goes on is different depending on where the sound is coming from. Over the course of our early development we learn to understand how these time and frequency changes determine the position of something in space.
But the really mind boggling thing the DSP designers face is that not everyone hears the same way. You and I will be able to recognise the sound of car, train, baby crying, electrolytic capacitor exploding, etc. but if we use a fake skull and measure those sounds we see that this is not quite the same.
King Charles famously has protruding ears (pinnae). Sounds coming from the front of his head will measure louder than sound coming from directly in front than from something behind because the sound is in the shadow of the pinna.
And then there's the issue of the shape of the pinna which is different for every one of us like a fingerprint. Everything here conspires to wreck the calculations based on a "standardised" human head. Very high-end surround systems can correct for this sort of thing but I won't even attempt to describe that.
Take everything I say with a pinch of salt, I might be wrong and it's a very *expensive* way to learn!
@marcdraco
Hello !
I think I might be done with the amplifier circuit now! Unless there are any glaring issues.
Updates to the design:
- The 10uf capacitor has been replaced with a 2.2uf, since it's the highest polypropylene capacitor that I can realistically purchase.
- The 330 ohm resistors have also been removed to accommodate for a logarithmic potentiometer
- The 47 ohm resister has been replaced with a 470 ohm resister to bring the maximum gain to just under 60db, so that the potentiometer can, go from 0db to 60db
- I have decided that all 10uf capacitors will be electrolytic (Nichicon VZ), 0.1uf will be ceramic and the 2.2uf will be bipolar electrolytic
- And to top it all off, I learnt some interesting things about ears!
Thank you so much for helping me every step of the way, and I'll make sure to update you when the microphone is done!
thank you in advance
That's in pretty good shape now with one gotcha that's even less obvious - and trust me, it can catch the unwary out (cough, splutter) if you're not paying attention to the datasheet (or was snoozing in the lecture theater, "who me guvnor?").
Every op amp can only operate over a limited frequency range. Audio frequencies only go up to 20KHz audible (or 10-15Khz for an adult).
It matters when it comes to high-gain as you have here (that's about 53dB) which isn't unreasonable on its face until you look at the "gain bandwidth" of the device which is 3MHz in the case of the TL082.
The way to see your predicted performance at that gain is to take the GBW and divide it by the total stage gain (470) which comes to:
3,000,000 / 470 = 6400 (aprx.)
The limitation of the device means that you're creating a low-pass filter with a cutoff of about 6K which is going to sound awful. Since that gain is fixed, it will affect the output regardless of the pot rotation: and you'd be chasing me with a big stick! 🙂
You'd just about get away with an OPA2134 at this gain (that works out with a roll-off about 17KHz which is beyond the hearing of many adults).
The solution is to keep a single stage gain as low as you can - 100 (40dB) works out at 30KHz for the TL082 and should be sufficient for most electrets, although the JLI2555 is a little insensitive due to the better quality design which prioritizes quality over sensitivity.
You don't need a poly(put-the-kettle-on) cap on the right-hand side of the circuit as leakage here isn't an issue. Poly-caps are primarily for places where absolute insulation is required which isn't the case here. That's not to say it's wrong, but it's probably overkill.
It's safe to assume the impedance of the following stage is >10K (it's probably more) so you can use that to calculate the value of that capacitor more accurately. There's a high-pass filter formed between the series capacitor and impedance of the next stage.
If you do the math you'll see you can get away with a fairly small capacitor (220 - 470nF) are sufficient because they will start to roll off the sub-bass frequencies which the capsule isn't that sensitive to anyway.
I Want More Gain!
There are going to be times if you're doing stuff like this and you want a LOT of gain but you also need to keep the in operational frequency range of a modest op amp.
The solution also exposes why op amps are called op amps and not "amplifiers".
An early use for these devices (the very earliest ones used valves!) was in "analog computers" (something I might cover as a project some time because it's so fascinating).
These amps performed incredibly complex calculations in a fraction of a second where computers of the time (1940s) were slow, large and clunky.
The idea is you put your starting values in at one end (as voltages) and then read the result at the output.
One of the simplest is multiplication - or gain - and we know from early math that if we chain multiplications we get a result that's the same as if we did it one single step, so:
x10 followed by x10 = 100
So if you chain two inverting stages set for a gain of x10, the output will be 100 BUT your GBW is only divided by the gain of the individual stages, not the overall circuit.
As an example I've plotted the gain for a single stage OP07 (a low-frequency op amp with a GBW of around 600KHz) for gains of 40dB (red) and 60dB (blue).
As predicted, the gain rolls of quite steeply beginning at 6KHz for 40 dB and 600Hz for 60 dB. I use the OP07 as an example because of its low GBW and you can try this for yourself easily in LTSpice.
If you compare this to a "single pole, universal op-amp, you'll see there is no difference in gain and that can catch you out if when you're using generic models (a la KiCAD).
Take everything I say with a pinch of salt, I might be wrong and it's a very *expensive* way to learn!