My First Audio PCB Layout - An OPA Alice with Hex inverter

GroupDIY Audio Forum

Help Support GroupDIY Audio Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

Pariah Zero

Well-known member
GDIY Supporter
Joined
Jul 12, 2022
Messages
78
Location
Intermountain West, USA
I've never done PCB layouts for audio before, so I'm not really sure if I'm following best practices, but, I figured I'd give it a try.

I started with the OPA Alice design, and the accompanying Hex DC-DC Inverter - so I'm reasonably sure the circuits are OK.

The dimensions are largely to fit the mic bodies I have (roughly 30mm x 60 or 80 mm) -- and to put them all in one PCB.

I'm wondering if anybody has any warnings on obvious mistakes I've made. I realize it's entirely SMD; it's a totally different process, but it's still pretty DIY friendly. (I find desoldering a lot easier). I intentionally chose big SMD parts in this design with the intention to share this (as an open hardware design - after I've tested the prototype and know it works) and hopefully get some people to try a DIY SMD project.

Anyway, here's a quick picture of may layout: Red is the front/Audio signal layer, blue is the back/Hex DC/DC inverter to polarize the mic capsule. I'm trying to have the main audio lines follow as straight (and protected) a path as possible, with the idea that'll give the least noise. (I'm probably wrong somehow, but it seems reasonable to me at this point.)

Edit: Adding link to schematic:
 

Attachments

  • 1660114412490.png
    1660114412490.png
    191.9 KB · Views: 2
  • 1660114438410.png
    1660114438410.png
    162.8 KB · Views: 2
  • 1660114713858.png
    1660114713858.png
    535.2 KB · Views: 2
  • 1660114745156.png
    1660114745156.png
    270.3 KB · Views: 3
Last edited:
Only thing I notice right away is that the signal lines are going right over the hex converter that's on the other side of the board. I know the converter is oscillating well above audio, but I still wouldn't want to run the signal straight over it, as I'm unsure of what the affects would be. Alternatively I would put the circuits on two separate boards with ground planes poured on the bottom of each board and each grounded component pin connected directly to the ground plane with a via (at least on the signal board anyway). But if you are dead set on just using one board then at least make it a 4 layer board with a ground pour on one of the inner layers.

BTW, you know you can buy these assembled and ready to use, right?
https://www.jlielectronics.com/diy-accessories/
 
Only thing I notice right away is that the signal lines are going right over the hex converter that's on the other side of the board. I know the converter is oscillating well above audio, but I still wouldn't want to run the signal straight over it, as I'm unsure of what the affects would be. Alternatively I would put the circuits on two separate boards with ground planes poured on the bottom of each board and each grounded component pin connected directly to the ground plane with a via (at least on the signal board anyway). But if you are dead set on just using one board then at least make it a 4 layer board with a ground pour on one of the inner layers.

BTW, you know you can buy these assembled and ready to use, right?
https://www.jlielectronics.com/diy-accessories/
Yup, JLI definitely has them -- and probably cheaper than making my own.

I haven't designed a PCB in a while, and kind of feel a need to scratch an itch. It's just not as satisfying to click "buy" as it is to lay out the PCB, get it delivered, lay over the solder stencil, squeegee paste, pick & place, bake the board in a toaster oven (I dunno; there's something that makes me giddy when the solder hits liquidus and the parts snap into place), test with a multimeter, then finally see if it works.

Plus, there's bragging rights at work when colleagues see a PCB that has my name on it, as well as other clues I designed it on the solder mask.

The Hex inverter placement is definitely a bit of a gamble - I'm wondering myself if it'd do anything audible; the inverter runs at 100+ kHz and with negligible current, so I'm betting that there just won't be enough in the audible frequency range to care. I'll find out.

Worst case: I cut the power trace on the prototype and just leave it depopulated on the other prototype boards. (and just grab one of JLI's hex inverters - or an electret capsule - I do want to try a mid-side mic...

I did do a couple of minor tweaks while verifying the parts I ordered matched the footprints I designed. I'm happy to see the OPA1642 is apparently back in stock again (at least at Digikey).
 
I started with the OPA Alice design

It would be helpful to include the schematic with your posting, just so all the info is in one place, and to help verify you did not make any transcription errors when entering into your schematic/layout package (Kicad?).

I intentionally chose big SMD parts in this design with the intention to share this

The capacitor footprints you have chosen do not extend the pad past the component body. That is fine for reflow, but really difficult to hand solder. If you are using Kicad there are optional footprints with "_HandSolder" at the end of the name with larger pads. That allows a space to place the tip of the soldering iron so it can contact the trace and the component plating at the same time to heat both quickly and evenly.

audio lines follow as straight (and protected) a path as possible

Not sure what you are getting at with the "protected" comment, the two things you do to protect against interference are:
keep the loop area as small as possible to reduce magnetic induction, which for differential signals means the hot and cold (+ and -) signals should stay close to each other and always route together, not get split up; and
use solid conductors connected to reference to prevent electrostatic interference into high impedance nodes (i.e. ground planes).
Routing in a straight line does not influence capacitive or magnetic behavior, so is not really relevant to "protection" of the audio signals.

One problem with placing all of the oscillator circuit on a single layer is that CMOS causes a lot of noise on the power supply as the output transitions from the high side driver to the low side driver. The way to counteract that is to have low inductance capacitor connections as close to the + and - power supply pins as possible. For SOIC style devices with the power pins on opposite corners that generally means putting caps underneath the package, and possibly putting a ground or power pour under the device body so you can have caps at each end as well. You can't really do either of those with a single layer layout.

the inverter runs at 100+ kHz and with negligible current

Delivers negligible current to the capsule, but the capacitors still have to be charged and discharged at every cycle, and CMOS often has shoot through, where you get a narrow (short time) pulse of current from positive supply to ground as the high side device is turning off, but not fully off, and the low side device is beginning to turn on. That is still low on average, but the short term peaks can be relatively high, and can cause high frequency ringing in the supply inductance that couples into the rest of the circuitry.

If you want to see how big an effect that is for your particular circuit, you could breadboard the circuit and install a small resistor in the power supply feed to the hex inverter, and measure the voltage drop caused by the current pulses at the power supply pin. Keep the ground lead of your 'scope short, and make sure your 'scope can display to at least 10MHz to see how fast the transitions really are.
You can also take the longer ground lead that comes with most probes, and clip it on the probe tip, then move it over and around the running circuit. The current transitions in the circuit will induce a voltage into that wire loop as a single turn air-core transformer, and give you some idea of the magnetic field changes in the vicinity of the circuit.

I started to work up an LTSpice circuit to demonstrate, but I realized that there aren't any models included with LTSpice that model the power supply shoot through. I'm not sure it is worth building up a full MOSFET level circuit simulation of an inverter gate when you can just measure an actual circuit, and then you don't have to worry about how closely the simulation matches the parasitic effects of the devices you use.
 
You should also include a PTFE insulated terminal pin for connecting the high impedance input to (was it?) the pin 3 (non-inverting input) of the OPA1642, and lift the pin and solder a short wire to the terminal. I don't know what is the exact size for the hole, I've owned about 3.8mm dia terminals, guess it depends on the terminals.

https://www.digikey.co.uk/catalog/en/partgroup/ptfe-terminals-and-pins/26742
 
Last edited:
It would be helpful to include the schematic with your posting

Added the link to the original post.
Not sure what you are getting at with the "protected" comment, the two things you do to protect against interference are:
keep the loop area as small as possible to reduce magnetic induction, which for differential signals means the hot and cold (+ and -) signals should stay close to each other and always route together, not get split up; and
use solid conductors connected to reference to prevent electrostatic interference into high impedance nodes (i.e. ground planes).
Routing in a straight line does not influence capacitive or magnetic behavior, so is not really relevant to "protection" of the audio signals.
My career didn't end up following an electronics/hardware path at all (I wound up in software) so I've forgotten quite a bit. figured I wanted to have the signals close to each other (At least I got that idea mostly right).

I know a bit about ground planes, but I vaguely recalled they're not as useful in the audio frequency range - but again, they're some old and probably untrustworthy memories. I'm happy to re-learn, I'm just not aware of what I've forgotten, apparently.

Keep the ground lead of your 'scope short, and make sure your 'scope can display to at least 10MHz to see how fast the transitions really are.
Oh, the toys I wish I had... Hopefully in a few months.

I'll have to revise the design a bit.
 
vaguely recalled they're not as useful in the audio frequency range

Partially true, but that charge pump isn't in the audio frequency range, is it? The TI datasheet for a schmitt trigger hex inverter lists "typical" transition time as 40ns. That equates to a bandwidth of around 9MHz at the output pins of the inverter gates.
 
The capacitor footprints you have chosen do not extend the pad past the component body. That is fine for reflow, but really difficult to hand solder.

I've generally found hand soldering SMD less rewarding than reflow; I've been making solder paste stencils from soda cans for years, and places like OSHstencils make them pretty cheap too. It's a good point that others may not feel the same way, however.
 
You should also include a PTFE insulated terminal pin for connecting the high impedance input to (was it?) the pin 3 (non-inverting input) of the OPA1642, and lift the pin and solder a short wire to the terminal. I don't know what is the exact size for the hole, I've owned about 3.8mm dia terminals, guess it depends on the terminals.

https://www.digikey.co.uk/catalog/en/partgroup/ptfe-terminals-and-pins/26742

What's the reason? It seems odd to pry up a pin on a SMD board when there's a short distance to the terminal to begin with.

I realize air is a better insulator than FR-4, but prying up an SMD pin is not something I've seen in any of the OPA Alice designs - is it to try to decouple from any possible noise of the Hex inverter on the other side?

I'm not trying to argue; Analog is definitely an area I know well.

The boards I've done as a hobby have been microcontroller / digital boards - the rails are my friends, and distances and frequencies have been low enough that I just haven't had to worry much about EMI/RFI.
 
Last edited:
- is it to try to decouple from any possible noise of the Hex inverter on the other side?

No, it is to avoid leakage current across the PCB. Any left over flux which is not cleaned off, any oil from your skin, what might seem like a trivial amount of contaminant becomes noticeable when trying to maintain GOhm impedance. If you solder directly to the PCB, you should clean the PCB very well to remove any flux and contaminants, then seal with a conformal coating to prevent moisture absorption.
 
No, it is to avoid leakage current across the PCB. Any left over flux which is not cleaned off, any oil from your skin, what might seem like a trivial amount of contaminant becomes noticeable when trying to maintain GOhm impedance. If you solder directly to the PCB, you should clean the PCB very well to remove any flux and contaminants, then seal with a conformal coating to prevent moisture absorption.
Whew. At least that's an issue I know I need (and how) to handle already.
 
The way to counteract that is to have low inductance capacitor connections as close to the + and - power supply pins as possible. For SOIC style devices with the power pins on opposite corners that generally means putting caps underneath the package, and possibly putting a ground or power pour under the device body so you can have caps at each end as well. You can't really do either of those with a single layer layout.
Now that I've taken more time to read this -- I definitely remember this, and do try to put these caps as close as possible on my μcontroller boards. I tried something vaguely similar here (I've generally located caps next to the CMOS devices, though obviously not underneath)

I recall looking JLI's hex inverter board, and the original (mostly) through hole board at pcbway - neither of which have the cap near the inverter either. So I shrugged and figured I could get away with it.

I'm happy to learn my uneasiness wasn't unfounded.

Out of curiosity - Am I wrong in thinking that even though the output lines are balanced and parallel and close to each other, they're simply too close to the inverter to actually receive the and identical signal and null out noise from the inverter?

Would it work better to switch from its current form of really being two one-sided boards smashed together, and instead try and lay it out to be to a two-sided board with an island for the OPA Alice, an Island for the Hex inverter, and a keep-out region (and ground plane) for the signal wires as they cross the hex inverter island?
 
Along the lines of trying a different layout: I am thinking of something like this, with the Hex inverter somewhat like this rough draft: It'll have its own area, its own ground plane (more on that in a bit), and then the mic signal lines will have plenty of room to be routed farther away from the inverter.

One question with this setup: The OPA Alice has the Pin1 ground, but it also has a virtual ground (GND1) for the op amp & hex inverter. I assume the ground plane I want to use for the zone would be the GND1 virtual ground, and not the Pin1 ground that's coming from the XLR cable, correct?

1660285572464.png
 
No, it is to avoid leakage current across the PCB. Any left over flux which is not cleaned off, any oil from your skin, what might seem like a trivial amount of contaminant becomes noticeable when trying to maintain GOhm impedance. If you solder directly to the PCB, you should clean the PCB very well to remove any flux and contaminants, then seal with a conformal coating to prevent moisture absorption.
If you are not going to use a separate pin terminal and solder the SMD opamp directly onto the PCB it might be useful at least to use a guard ring around the +IN pin of opamp. Analog Devices has many application notes with example like this:

figure3.jpg

(Google for "op amp guard ring" etc.)
 
If you are not going to use a separate pin terminal and solder the SMD opamp directly onto the PCB it might be useful at least to use a guard ring around the +IN pin of opamp. Analog Devices has many application notes with example like this:

figure3.jpg

(Google for "op amp guard ring" etc.)
I've actually torn up and started a full re-layout, I'll definitely take your advice.

I've also read this post, which also has the same point. It's clear your point is to guard against very minuscule amounts of leakage current.

Pulling up the pin and soldering a wire isn't something I'm against -- it just surprised to mangle a part rather than solder it down. (Learning is fun!)

Looking back at the schematic: There are two Op Amps, with two +IN pins: Pin 3 and Pin 5. I imagine I want to treat both HiZ inputs identically - which leaves the question of exactly how do I want to place the 1GΩ resistor and the virtual ground net (GND1)? Would I want to have a guard ring around the virtual ground's net as well (the GND1 net on the schematic).

1660418659825.png
 
neither of which have the cap near the inverter either. So I shrugged and figured I could get away with it.

You can sometimes get away with things in one context that don't work in another, e.g. separate PCB vs. same PCB.

Am I wrong in thinking that even though the output lines are balanced and parallel and close to each other, they're simply too close to the inverter to actually receive the and identical signal and null out noise from the inverter?

It is not only a matter of physical proximity, the frequencies generated by the inverter circuit are above the frequencies where feedback is effective in linearizing the behavior of the op-amp input devices, so you can get noise created at lower frequencies by the non-linearity. The level of output you get from a purely common mode signal is known as the common mode rejection ratio, and if you plot CMRR against frequency, it falls from low frequency to higher frequencies, and the slope usually gets steeper at frequencies above the point where feedback is effective (which is going to vary by device and circuit configuration).

Would it work better...to be to a two-sided board with an island ...for the Hex inverter

Likely. The way commercial microphones generally solve the problem is:
  • distance, either putting the voltage boost circuit on a separate PCB, or off on one side by itself
  • compactness; keep the circuit small and self-contained, with all wiring kept short so it cannot act as an effective antenna
  • isolation, by using ferrite beads or small inductors with capacitors to filter the power line going in and the high voltage coming out of the boost circuit
  • keep the circuit narrow-band for easier filtering. The hex inverter circuit has the advantage that it is easy to get parts, doesn't really require a lot of specialized know-how to get it running, and doesn't require any custom magnetics. Most commercial designs use an LC oscillator which generates a clean sine wave rather than square waves, and uses a small transformer or coupled inductors to boost the voltage

The OPA Alice has the Pin1 ground, but it also has a virtual ground (GND1) for the op amp & hex inverter. I assume the ground plane I want to use for the zone would be the GND1 virtual ground, and not the Pin1 ground that's coming from the XLR cable, correct?

Using the term "Pin 1 ground" can lead you down some wrong paths. Pin 1 is the shield connection of the connector. It also happens to be the phantom power return path. Ideally you would not have to mix shield function and current return functions, but you do here, so the important point is to not force radio frequency currents on the shield into your audio circuit. You do that by connecting pin 1 directly to the connector shell/mic body (assuming you have a conductive mic body), and then make sure the circuit reference ground just connects at one point either to the mic body or to the connector shell if you do not have a good way to make contact to the body metal.

What you have called "virtual ground" could also be thought of as just a reference voltage for the op-amp inputs, so you could just run a trace to the 1G resistor, and a trace to the second op-amp non-inverting input.
It is only the way the schematic is drawn that caused you to call it a "ground" node, but if you look at the current flow, there is basically no current returning to that node, and nothing has to be referenced to that voltage.

I imagine I want to treat both HiZ inputs identically

The non-inverting input of the second op-amp isn't actually a hi-z node. Look at what is driving it: the reference voltage created by a (relatively) low value resistor divider, and that is bypassed with a large capacitor. At 20Hz the impedance of that capacitor is only 170 Ohms, and falling above that frequency, so that op-amp pin is a low impedance node.
The first op-amp non-inverting pin, on the other hand, is connected to a 1 G-Ohm resistor to the reference voltage, and bypassed by the capsule capacitance, which may be in the range of 50pF, so 1,000,000 times smaller than the 50uF capacitor bypassing the reference voltage divider. So the impedance at that pin is in the range of 6 orders of magnitude higher than the same pin on the second op-amp.

Would I want to have a guard ring around the virtual ground's net as well (the GND1 net on the schematic).

No, the reference voltage, what you call the virtual ground, is a low impedance node. Notice that in the picture pasted in by Mhelin the guard ring goes under a component. The end of the component inside the ring is on the high impedance side, the end of the component outside is on the low impedance side.
 
That was a lot to digest, so please forgive me if I missed something - I'm really grateful.

After trying a few different layouts and not really being satisfied, I've decided I really don't have the room with the components I have to try a single board with zones - and it's best to take advice and go with a dual board layout, and a traditional filled zone. It'd also give me room to maybe change out the hex inverter for something else in the future if I decide to try something different.

I also realize I've got to fix the net the Hex inverter uses for its filled zone; the silkscreen labels are also a total mess. It's late, I'm tired, and I'm going to sleep.

The Op Amp has a guard ring around the HiZ input - and there are properly sized holes for PTFE terminal pins.
  • * The GΩ resistor can be stood on its end and the op amp's pin can be lifted off the pad, and the pin can be wired 'in the air' to avoid any leakage current
  • The GΩ Resistor can be soldered to the board SMD style as well (With the op amp fully soldered down as well).
I've also changed the footprints to the "hand solder" type, in case anybody else wants to use this board in the future.

So far, it's looking like this:

1660466457073.png1660466485095.png
 
Well, while I refresh my memory on Common mode noise rejection on PCB's (for the right thing to do with the fill areas on the back of the boards):

Attached are the updated schematics and layout. (The schematic has been updated to use KiCad hierarchy better). Both are in PDF Format for better resolution.

1660605073683.png
1660605103017.png
 

Attachments

  • Alice_Layout.pdf
    244 KB · Views: 0
  • Alice_Schematic.pdf
    142.2 KB · Views: 1
Last edited:
I almost have a first article:

866669B3-B713-4400-B296-E8C6ED143683.jpeg

I ordered the PCB's with a set of solder paste stencils, and after spreading out the paste, it took a bit time to pick & place the parts.

Much to my horror, I discovered that I had fat fingered the quantity for a couple of components - nothin' like ordering a SINGLE 200 Ω SMD resistor, especially when you need two, and it's cheaper to buy ten.

After a quick bake in a toaster oven, I've got some nicely soldered boards.

... mostly. I messed up one of the diode arrays, so I'll have to rework that, as well as fix a pair of solder bridges in the op amps.

Then I'll check connections, and clean the boards, and hook up the lifted HiZ pin 3 of the Op Amp to the GΩ resistor and PTFE insulated pin.

Hopefully then I'll be able to try out one of the channels. (Since I'll have to wait to get that other 200 Ω resistor...)

Oh well... it gives me a reason to throw in the BOM for Rog's RF mic board parts.
 

Latest posts

Back
Top