A few basic questions about building amplifiers... - Page 1
Forum section: electronics / beginners

author: Atheus
author_rank: Contributor
timestamp: April 10, 2017, 02:54:00 am
content: Hello again,Excuse the uber n00b questions; as I've mentioned I'm a software engineer getting into hardware for the ongoing 'IoT' revolution which is going to make people extremely rich, hopefully including meSo I'm currently looking at building a few amplifiers of different types and power ratings. I'm looking at this page (http://www.techlib.com/electronics/audioamps.html) for design right now. I suppose just to get comfortable with the 'building blocks' of electronics (as one might learn algorithms or functions they use again and again in software) so I'm not in the dark when it comes to debugging devices, getting stuck on software workarounds when a hardware bug is the real culprit. I've been building power supplies using voltage regulators, driving 7-segment displays using a shift register and multiplexing, programming some basic stuff on an Arduino and a ATTiny85, fixed an old oscilloscope... I'm getting there... I still have a LOT more to do of course! Anyway, questions...1) How can I protect expensive audio output devices from being destroyed by the amp? I might be using my phone or macbook etc as an output to test, so if I hook that up directly to a wrongly wired amp, it might send 12V directly into the phone/laptop's headphone jack and kill it. Will just a diode work? So current flows from the output to the amp but not the other way around?2) How sensitive is a small (say one-transistor) headphone amplifier to the EXACT correct parts? Can I take a design from the web and substitute with the closest components I have? For example I might just use one decoupling capacitor instead of the two shown on the schematic, and I might have a similar (but not exactly the same) transistor as the schematics... is this vitally important? I mean, as long as it's the right TYPE of transistor with adequate specs of course.3)If you only read one bit of this post please read this:what type of capacitors should I use, and where, in an amplifier?All I can tell from schematics is polarized or not, and the basic specs of the cap. I can guess the type of cap from the value (really high then it has to be electrolytic, really small is likely to be ceramic, etc) but not much else. I _think_ electrolytic caps can only operate up to a certain frequency but I'm not sure... I know they're used in amps though because I've obviously looked inside a few. You rarely get a datasheet with a bag of caps and the Hz/KHz/etc is not marked on the component... is there a known limit to electrolytic caps in general? Or does it somehow not matter because of _where_ they are in the circuit e.g. high side input voltage filtering before modulation?a) Do I have to carefully choose my electrolytics to make sure they operate at the desired frequency? What about when I get into RF frequencies (and higher) not audio?b) I don't see any non-polarized symbols on those circuits linked above. Are they wrong? Am I missing something? Or does it matter so little there's no reason to note it? What about small value caps? You can't get electrolytics in that small a value can you? I was thinking ceramic or film caps for the ones that have to operate AFTER the frequency is switched... but these are non-polarized... I don't get it!c) I see a lot of DACs available for the PI aimed at hifi folks (which presumably take the sound directly from the digital pins and replaces the DAC on the PI?). Is this worth it or not? I do NOT need hi-fi quality sound here but nor do I want crackle.d) How important is low ESR? Does it matter where exactly on the circuit the low ESR cap might be?Thanks for reading at least that bit!- I write huge walls of text, I know...Anything else I should be aware of? I'm doing several different amps of different types (transistor, darlington transistor, MOSFET, and op-amp (and quad op-amp) at least) and eventually I'd like one which I could connect to a raspberry PI as a pre-amp. Two thoughts about this: the PI has a low line output voltage (for a PC) - apparently not even enough to drive a very small speaker - do I need to read my transistor spec sheets to find one which will 'trigger'/'activate' (terminology?) at this low voltage? Or are the 'low signal to activate' (terminology?) MOSFETs designed for REALLY low signals (like from an IoT temp sensor) and I shouldn't worry about line level on devices which will drive earbuds?/edit: I just checked and the IRF610 (one on my list) requires a massive voltage to 'activate' it (comparatively massive...) of 1.5V - does this make it a no-go for the first stage of an amp driven by line-out only? Is this just a crap unit? Or is the higher 'activate' voltage needed in other parts of an amp, or other applications?Thank you!~Atheus

author: BrianHG
author_rank: Super Contributor
timestamp: April 10, 2017, 03:12:16 am
content: I would like to hear a few refinements on your specs.Now, are you just trying to drive headphones with this amp?When you say, parts you have lying around, which parts? Are you sure you don't want to buy any components or pre-fab modules?When you say HiFi quality, is the sound quality you are already getting out of your PC or iPhone/Mac/anything not good enough, or, is it just too weak?Is this just for headphones? There are high quality devices you can use here which are as simple to wire as an op amp.What's your power budget? Making a simple stereo Class A 'low power' amplifier with a few Mosfets can produce excellent sound, but, for a 5 watt stereo out, you'll sink and heat 50 watts of power continuously. (You shouldn't need this quality if your audio source is a PC or iPhone/Mac/anything, but, it is so cheap and simple a schematic.) Though, a 1 watt version would only waste 10 watts. Great for headphones and small speakers.

author: Atheus
author_rank: Contributor
timestamp: April 10, 2017, 04:28:47 am
content: Quote from: BrianHG on April 10, 2017, 03:12:16 amI'm learning, so have no REAL aim other than that, although ending up with a functional amp or two would be nice. I would start with a pre-amp or headphone amplifier with the most basic circuit, analyze it with my (now working) scope, and swap out components to see the affect on sound quality, efficiency, heat dissipation etc.Quote from: BrianHG on April 10, 2017, 03:12:16 amI've only been doing this a few weeks and already have 13 boxes (in sight at this moment) of varying sizes full of components, not counting tools and boards and kits etc... I probably have resistors and caps in most common values... At a glance I see 40+ individual compartments just with caps sorted by value, electrolytic, ceramic, and polybox. I don't anywhere NEARLY enough compartments to sort all my resistors so they are in order in a pile about half a foot high...None of it is 'low noise' or 'audio' rated though! I am fine with it producing crap sound, as long as I know where it's coming from, and can replace the part(s) needed. Just... will it work at all?Specifically I was going to start with a DC327 and/or BC337 transistor, or perhaps a TIP122 darlington package...Quote from: BrianHG on April 10, 2017, 03:12:16 amOh of course I do! I am buying stuff...way waaaaytoo much stuff lol- when I got my first old analog scope my girlfriend told me to rent a lab space! Just looking at the dual/quad op-amps I have in my basket at my component retailer of choice comes to 20+ quid (British Pounds) not to mention the rest. Lets say budget is not a problem for now. I mostly posted this because I'm making an order for some op-amps, dual and quad op-amps (seem more common than singular in audio?), plus MOSFETs and other semiconductors.Quote from: BrianHG on April 10, 2017, 03:12:16 amNonono - you miss the point. I didn't say HiFi quality... I don't think... I'm not interested in improving sound quality on my actual systems (TV/computers) by building amps - I have a nice Denon hifi system for that. There's absolutely no way I could match it's quality. I _might_ use headphone amplifier sometimes... my backup (Apple) headphones are super quiet... but that's not the point either!. I guess I'm aiming to produce a nice noise... if that counts.The only point is to learn about amplifiers, as they are an essential building block, kinda like a logic gate, or a common algorithm at a higher level. As a software dev I could tell you when to use a relational database or when it's okay to have NoSQL (or whatever) for higher performance. Can an EE tell me similar about amps? Of course, my answer would depend on the application, so lets take some example applications; a very simple transistor headphone amp (I'm having a go at a prototype for that right now), and a higher power op-amp (dual? quad??) based one capable of driving an 8Ohm speaker.Thanks!~A

author: rs20
author_rank: Super Contributor
timestamp: April 10, 2017, 04:38:32 am
content: Quote from: Atheus on April 10, 2017, 04:28:47 amI find this assertion questionable; I'd consider the task of faithfully amplifying mereaudio(0.02 MHz) to be rather easy with modern components. I think any reasonably competent electronics hobbyist could achieve this with research and persistence; building the marketing machine and brand image of Denon is afargreater achievement that one shouldn't confuse with the quality of the amplifier itself. Not to mention that as a hobbyist, you don't have to grapple with tricky cost/performance tradeoffs down to the cent-per-unit that cheaper competitors to Denon have to deal with.I know the above is risking sidetracking the conversation, but I think there's an important specific point I'm trying to portray to the OP: All this corporate stuff I mention above is of no concern to you (not right now at least). Considering a particular brand of amplifier to be some sort of out-of-reach goal is somewhere between a) selling yourself short or b) starting to drift vaguely towards the ocean of audiophoolery.

author: Atheus
author_rank: Contributor
timestamp: April 10, 2017, 04:59:14 am
content: Quote from: rs20 on April 10, 2017, 04:38:32 amDude, I'm not selling myself short, I've literally only been working with electronics (as such) for a few weeks- I'm little more than a total beginner. Of course understanding the maths and higher level stuff helps. I'm a programmer. I worked recently at an IoT company taking data from an in-house device and turning it into an web API. We had a proper EE lab I used to hang around in, and it really inspired me to have a go.I totally get that with practice, I could build something very high quality (to beat the Denon say - nothing beats something you've build by yourselfforyourself because you won't skimp on anything), but I'm not there yet.I _could_ just buy pre-assembled modules for my ideas, tie them together with a bit of old wire, and end end up withsomething... but (and please excuse the CompSci analogies) isn't that like learning Java (or whatever) without knowing anything about what's going on 'under the hood'? You might be able to produce things... but not novel things and/or make them efficient. At a low level you wouldn't know how your code ends up compiled into what instruction set which works on XYZ processor and then you have to account for the VM etc... On a much higher level, with no basic CompSci you wouldn't know how to efficiently sort an array, or what data structure or protocol to use to store and send certain data. I'm taking a similar approach here.

author: rs20
author_rank: Super Contributor
timestamp: April 10, 2017, 05:18:08 am
content: Quote from: Atheus on April 10, 2017, 04:59:14 amCool, this is all I really meant to say.Quote from: Atheus on April 10, 2017, 04:59:14 amI'm a software engineer by day, so I have no problems with CompSci analogies! Assembler = transistors, C = op amps, Java = amplifier PCBs from eBay. Where the analogy breaks down slightly is that it's a bit of a pain to connect assembler with Java, because who has time to learn JNI? But in electronics, all these different levels of abstraction actually communicate in exactly the same way -- analog voltage levels. So I totally endorse your observation that learning using opamps and transistors will allow you to learn more, but also don't be afraid to use the odd module (for example, for DC-DC power conversion, etc) to make your projects feasible.

author: BrianHG
author_rank: Super Contributor
timestamp: April 10, 2017, 05:52:06 am
content: Ok, rule/step #1 in audio amplification. You stated that you only have a 12v DC source you want to work with, not a + and -12v source. (This is for a simple amp, we can take a look at more exotic things as we go.)For the audio input and the output, the average voltage, or voltage bias is 0v. Since in the amp you will be designing has a GND and +12v, plus the audio signal going in and coming out of the transistors or op-amp circuit will be centered around 6v, this allows the amp to operate and feed a + and - signal since audio is AC, you need an input and output capacitor. These 2 capacitors generally also define the lowest possible audio frequency your amplifier will operate at.For the audio in, usually in consumer audio equipment, we like to use a load of 50K. This means with a 22uf electrolytic, you generally get a good response down way below 20hz. Now as you asked about the polarity. Since the input is expected to be at 0v and the input to your amplifier will be anywhere above that point, the - of the cap faces the audio input side and the + faces the input of the remaining amp circuitry. Many professional amps us an AC cap here since the low uf values are available in AC.As for the output to your speaker, now, you will be dealing with drive a low impedance load. Anywhere from 32 ohm down to less than 4 ohm depending on headphones/speakers being used. This means for low frequency you need a big ass cap. The output of your amp's transistors will be centered at 6v with a 12v supply, but, the other side of the speaker will be connected to your GND. This means that this cap should have it's + connected to the output of the transistors and the - side goes to the speaker. This cap will basically have a 6 volt charge in it at all times since the speaker is a resistor to GND. The cap uf value depends on the load you will be driving and the lowest possible frequency you which to support by the amp. A smaller value for headphones since you only need to drive a 32 ohm load while speakers at 8 or 4 ohm require a much higher value.Does this help you determine the polarity direction of the primary input and output caps on a single supply amplifier?Q: Do you have any schematic entry or simulation software? We can progress by designing out amp from here on...

author: rs20
author_rank: Super Contributor
timestamp: April 10, 2017, 06:03:16 am
content: +1 to everything BrianHG said above, except in addition to what he suggests, you haveanother optionfor the output stage:Bridge-tied load. There are chips available that support this for you, to the extent that you just follow the recommended diagram in the datasheet. Benefits of BTL:- No need for giant output capacitors, because both side of the BTL float at around 6V, so the speaker has no DC voltage across it (because, at rest, it's connected between 6V and 6V).- You get twice the effective output swing: you can push nearly +/- 12V into your speakers, rather than the +/- 6V you'd get with a normal single-ended AC-coupled output.Downside is that you need twice as many amplifiers, although this is all encapsulated into a single chip for you so perhaps not a big problem.You'll notice that the wiki page for BTL mentions that it's often used for car applications. Cars have a (roughly!) 12V, single-ended supply -- which matches your spec, so chips designed for cars might be applicable for you. (Although, probably overkill if you only want to drive headphones).

author: BrianHG
author_rank: Super Contributor
timestamp: April 10, 2017, 06:22:34 am
content: I'm taking things a step at a time. Bridged amp follows more exotic, but highly used in car audio and low voltage amps, configurations. The OP want to learn about amp and maybe start with parts he has on hand. But you are right that the bridge amps get rid of that big output cap.

author: Atheus
author_rank: Contributor
timestamp: April 10, 2017, 10:15:47 am
content: Quote from: BrianHG on April 10, 2017, 05:52:06 amBack with much more detail later - ordered about £80 worth of audio gear lol - plenty to experiment withJust for now though, no, 12V as a power source for amp was just an example. I'm sure I can come up with whatever voltage is needed. Is it easier to explain with + and - values?I was thinking 12V wall wart, or perhaps a larger external supply at 12V or 15V to the amp, but step it down with a linear 5V regulator for any logic, isolated somehow... optocoupler?

author: BrianHG
author_rank: Super Contributor
timestamp: April 13, 2017, 03:48:31 am
content: Next step, determining output power and power supply requirements of you amp design.Now, if we were to use a single 12v source as a power supply and a matched darlington NPN and PNP transistor, we can say that if we drive the bases right to the 0v and 12v rails, our output will be from 2v to 10v. With a center voltage at 6v, this means our output has a +4v and -4v range, or driving a full square wave, a 4v AC output. (This is a close enough approximation to peak watts, not RMS watts, we are not interested in getting values down to the mw.)Sending 4v AC into an 8 ohm speaker, we will get 0.5amps. Multiply 0.5amp with 4v, you have 2 watts peak power.Sending 4v AC into an 4 ohm speaker, we will get 1amp. Multiply 1amp with 4v, you have 4 watts peak power.Now if we doubles the supply to 24v, 2v out to 12v center to 22v at the top, we now have a 10v AC range.10vac/8ohm speaker=1.25amp, 1.25amp*10vac=12.5 watts.10vac/4ohm speaker=1.25amp, 2.5amp*10vac=25 watts. (well, you get the picture)Now, instead of darlington, we can use an N-Channel Mosfet and a P-Channel Mosfet in linear mode. Since we do not need to supply current to bias the 2 opposing gates like in the transistors, it is easy to stretch our output voltage right to almost the rails with a boot-strap capacitor at the center voltage between the gate bias voltage. This means that with the 24v supply into an 8 ohm resistor, if done right, you should get at least 1v more AC if not 1.5, going from 12.5 to 16.5 watts with the 8 ohm speaker.The next step for you is decide whether to use BJTs, or MOSFETs.For your amp, for now, I wouldn't attempt a power supply above 30v, my next recommendation will be to do a 2 stage op-amp to power BJT/Mosfet design, 1 stage for signal gain, the second dedicated to driving the output power mosfets in a TO-220. However, you will need a fairly massive heatsink for mounting the mosfets with insulation tabs to isolate their tabs.The other direction would be an exclusive headphone Class A amplifier (this will be remarkably high quality if your source audio is great). 12v is fine for this and a small IC sized heatsink will do.For power, I would recommend an analog, old fashioned transformer, preferably AC if you have access to one. For the headphone, I would recommend a 10 watt transformer at least, for a power speaker amp, I would use a transformer with at least 1.5x rating of your output wattage if not double or more. For stereo speaker amp, double this number.Always ask questions, we should avoid miss understandings to save time and money...

author: BrianHG
author_rank: Super Contributor
timestamp: April 13, 2017, 03:57:42 am
content: Ohh, BTW, you will need an Oscilloscope and reasonable volt meter and some scrap additional parts before you can actually safely build such an amp, though there are additional things to go through first.As for protection, the is no such thing as optically isolated audio amps, though there exists isolation transformer, also known as ground loop isolators, they do cost $$$, crap up the sound, and don't guarantee protection as AC electrical signals travel in both directions through these devices.If you are afraid, an old cheap walkman or cd player, portable or home should suffice. Battery powered devices are the safest as your weak link in you design is the quality of the wall AC adapter. This is why I said earlier to use an old fashioned transformer. If it is a non damaged device, it will isolate you from the AC mains.What would you like to try first?

author: rs20
author_rank: Super Contributor
timestamp: April 13, 2017, 04:22:20 am
content: Quote from: BrianHG on April 13, 2017, 03:57:42 amThis statementisn't true. However, whatistrue (as pointed out by BrianHG) is that it's vastly easier and better to just use an isolated power supply, rather than try to add isolation to your audio path.

author: edavid
author_rank: Super Contributor
timestamp: April 13, 2017, 04:51:32 am
content: Quote from: Atheus on April 10, 2017, 02:54:00 amWith a capacitor. Many audio devices will already have an output capacitor, but it won't hurt to add another one, unless it's too small.QuoteYou can usually make substitutes, but it may lead to some debugging fun.QuoteYou almost never use ceramic capacitors in audio circuits.Film capacitors are good (mylar is the worst type of film, but still usually OK).Electrolytics are generally OK at audio frequencies. You can't use them if they might see reverse bias.QuoteThe symbol is just showing where the outer film of the cap should be connected, ideally. It doesn't imply DC polarity.QuoteYou need to read about biasing. However, an IRF610 is too big a FET to use in an audio preamp.

author: BrianHG
author_rank: Super Contributor
timestamp: April 13, 2017, 05:32:05 am
content: Quote from: rs20 on April 13, 2017, 04:22:20 amOk, yes, true, even one of my old phone line interfaces for tape recording was optically isolated instead of transformer as a test. I guess I should have said that optically isolated amp would require a supply to power the input side, then another isolated supply for the main power output section, ohhhh, wait, the OP said he had only 80$ of audio junk... I guess I could have been more clear.