XLR Input on Audio Shield

Nebula525

Active member
Hello đź‘‹

I am planning on adding an XLR input for a condenser microphone onto my audio shield. I have found another thread (https://forum.pjrc.com/threads/42198-Phantom-powered-Teensy) in which they describe their hookup to the audio shield using an XLR cable.

Is it really as simple as this diagram in order to get the XLR mic hooked up or is there anything I’m overlooking? Simply just hook up the XLR outputs to the line in L and R connections assuming you have taken care of the 48V phantom power on the connection already.

https://imgur.com/a/gLHw5Gr
 
Yes, it is nearly as straightforward as that.

However:

- Input caps on the audio shield need to be rated at 48V.

- HV supply needs to be relatively well filtered.

- Paul's Audio shields are not set up for Balanced inputs, and the ADCs are too insensitive for microphone levels (even condenser mics).

Something with about 40 dB of gain and balanced to unbalanced is a better bet. There are plenty of modules on eBay using the INA128/129 instrumentation amplifier, which are my personal favorite for the unbalancing task.

Here's a circuit that I developed to go with with my CS42448 8 Channel audio shield. Note no phantom power in this version. so you need 48v electrolytic caps in front of R9-R12, 4.7uF should be OK.

Ts472 ina 128 board.png

I hope this helps
 
Fantastic! Thank you so much for your great work and schematic. I saw your audio boards previously and they looked amazing. I messaged you with an inquiry on design. Thank you!!
 
Great! So Palmerr and I have been talking about creating a spec for this project. We want to share the design with the community for anyone else who may find it helpful.

This spec is going to be for an audio interface that supports XLR microphones and guitar/line in inputs to the Teensy. Once the audio is passed into the Teensy, audio through can be used to pass the data into the computer as an audio interface.

Project Specs:

1) One XLR mic input, with switchable 48v Phantom (physical pushbutton)

2) One TRS input for instruments/mics

3) An LED signaling phantom power is turned ON on the mic line

4) Digitally controlled gain and input selection

5) Everything powered from 5V pin on Teensy 4

6) The signal from this board feeds into Paul’s board

7) (Optional) A balanced output from Paul’s board*

*It would be great to have a balanced output from Paul’s audio board in order to plug the connection right into monitor speakers if that can be done. According to this thread (https://forum.pjrc.com/threads/47431-Balanced-output-from-audio-shield) it may be just as simple as inverting the signal of one leg through the software. Maybe this may be done through analog to avoid that delay that happens in audio if easy. Not too sure which direction is better on this one, maybe the delay through software inverting isn’t noticeable?


According to Palmerr’s great suggestion, a combo jack can be used which has internal switching. Then using the internal switch on the jack, we can select the ADC’s input. This way the interface would auto-detect if a line in instrument or mic is being used.

For ADC input switching we can choose either Mic or Line in: (https://www.pjrc.com/teensy/SGTL5000.pdf) On page 27, under “Input/output switching” it shows how to switch the ADC’s input.

Unfortunately, I’m not the best at designing schematics as I’ve usually been on the programming side of things. Palmerr is wickedly amazing and offering to help draw up the first draft of the schematic. Big shout out to him and his contributions to this community! Please let me know if there is anything I can clarify.
 
I now realize that the line out on the audio board is meant to be run through an amp in order o play on monitor speakers. This makes spec #7 useless because it becomes a matter of finding the right amp board at that point if I'm not mistaken.
 
Nevin,

This all looks fine.
Project Specs:

1) One XLR mic input, with switchable 48v Phantom (physical pushbutton)

2) One TRS input for instruments/mics

3) An LED signaling phantom power is turned ON on the mic line (locally powered)

4) Digitally controlled gain and input selection (via Audio Library controls)

5) Everything powered from 5V pin on Teensy 4

6) The signal from this board feeds into Paul’s SGTL5000 board

With the balanced output, it's relatively simple technically and can be accomplished with a single op amp package. However, it's an unusual requirement for non-pro equipment. For pro equipment, even though I love the Audio Library, I don't go below 24 bit / 48kHz, as that's today's base industry standard. The other way around it is to use an unbalanced output and a DI box.

7) (Optional) A balanced output from Paul’s board*

Having said that, I'm happy to include it the requirements, if that's what's needed.


There are several ways to accomplish this design

1. Using readily available modules to avoid board complexity and trying to solder some really narrowly-spaced pins on the SMD ICs.
There's a small trade-off on space, however the modules are so cheap that the cost is pretty much equivalent to small quantity purchases from mainstream vendors such as Mouser, Element14, etc.

This approach works efficiently for prototyping and small runs (< 20 boards), where space constraints are not onerous.

Here's an two channel example using TS472 and INA129 modules from eBay, and you can see that the pots and XLR jacks dominate the board, anyway. This board is 4" x 2-1/2" (100 x 66) so a single channel version would be about 2" x 2-1/2" as the 10 pin header would be replaced by a boost regulator to provide 48V, and a Phantom power switch replaces the pot.

Ts472 ina 128 board2.png

2. Going for a fully-worked direct-on-the-board design, which is optimal for production runs (China-based assembly around $20 per board + boards + components, for a run of 20 or so boards).

3. 48V supply (module) off-board to reduce switching noise, and to be used as a shared resource.

Over to the community for discussion.
 
Hi Palmer đź‘‹

Beautiful work!! I love the the board layout and it simply looks fantastic! Great idea of having the physical pot there for gain control.

I definitely don’t mind going with the eBay modules if you think the space saved is minimal and prices would be about equal either way.

If I do go the module route or not, I still have a few questions on the routing of connections if you wouldn’t mind. Please excuse my inexperience.

1) How does the input switching work? I see the TS pin and the RS pins on the combo jack are hooked to the output of the TS472? Doesn’t the output of the TS472 shoot the signal back into the combo jack?

From my understanding when you plug in a 1/4” cable, the connection from T and R gets cut to TS and RS. Does powering the TS and RS pins from the out+/out- of the TS472 have an effect?

Also we have to separately send the bits to the Teensy to switch the ADC separately right (a whole other thing in and of itself).

2) Does the RG1 and RG2 connection lead into the Teensy’s volume setting pads or the pads of the INA128?

3) The ten pin header hooks into the audio board correct? So if I was wanting to add 48V switched power into the board, wouldn’t I need to add that separately and feed it into the jack on pins 2 and 3 rather than replacing the whole pin header?

3.1) Also is adding phantom power as simple as adding 4.7uF caps then a push button in series on it’s own trace in between the combo jack and the in+/in- of the TS472? (I know that would probably result in a lot of switching noise)

4) Is it possible to keep the pot for gain control and have a phantom power switch too rather than replacing the pot?

Sorry for these novice questions, I’m just trying to get a better understanding of how it will all work. I really appreciate your help!
 
Nevin,

This is the design I created for my CS42448 board update. The specs you are proposing will need some changes.

Here's the schematic of the example board for your, and others', information.

Ts472 ina 128 board.png

1. The schematic explains how the switching works on the example. Yes, RG1/2 replace the pots on the INA128 boards - unsolder pot and install wire links to pads. An appropriate gain is selected on the TS472 by linking a jumper. 20 or 30 dB (difference between mic and instrument levels) should be about right.

ina128 module.PNG

ts472 module-rot.PNG

2. The pot may be unnecessary as the SGTL5000 has built in VCAs with up to 24dB gain, while the CS42448 does not. Your choice to retain it - it takes up front panel real estate, but also allows the right voltage range to be supplied to the SGTL.

3. Yes the 10 pin header is for the CS42448 board, and we'd design something appropriate for Paul's SGTL5000 board - utilising the headers he's provided.

4. Adding phantom power is pretty much as you describe - the key challenges are crosstalk between channels, and introduced common mode noise from the 48v supply. Phantom on/off switching transients can be a pain too.

5. Let's start with the modules approach and fall back to the full SMD approach if we can't resolve all the design issues or the board becomes too unwieldy.

6. Final question - does it make sense to make a dual board, as in the example, so all the SGTL 5000 inputs are provided for - that would provide two flexible Mic/Instrument channels.

Richard
 
I get how the switching works now, beautiful engineering. Combo jacks are truly a gift.

2. Ah, I see now about the pot. My thinking was to have a knob next to the combo jack as an input gain- as found on many other audio interfaces. So what we could do is use the built-in Audio board's amplifier as a gain control. It should just be a matter of having an external pot of this board's design and using the audio library's micGain function as necessary. So input gain control no longer becomes a requirement of this board, if I'm not mistaken.

3. Great!

4. If adding phantom power is asking too much, I definitely understand. Apparently it's standard to feed power to pins 2 and 3 through 6.81k resistors. Would using zener diodes help to solve the problem of cross talk?

Also I remember the 10 pin version of the combo jack (NCJ10FI-H-0) having a Ground Normal pin. According to this link: http://www.patchbays.com/norm_ground.htm Under "Sleeve Normalling" in the second paragraph they mention that when connecting to a connection with phantom power, "you need to provide that channel with a discrete, normalled ground path as well". This path would be the ground normal pin if I am not mistaken. I don't know if that helps with common mode noise.

In regards to phantom on/off switching transients according to the SGTL5000 data sheet you can configure a slow ramp up rate to minimize popping. So this value is adjustable to compensate for any transients while trading off for slower start up times, which I think is worth it. (https://www.pjrc.com/teensy/SGTL5000.pdf) Page 26: "// Configure slow ramp up rate to minimize pop (bit 0) Write CHIP_REF_CTRL 0x004F".

Let me know what you think about phantom power; I think it would be a really great addition for people who want a portable interfaces like myself with out relying on other hardware but on the other hand it isn't hard to use an external device to supply it.

Great, I'm all for the module route to start!

6. I think having a dual board would be great if that takes care of all the inputs on the SGTL5000 and we wouldn't need to add any more hardware into the mix. I'm sure many people who want to incorporate an audio interface into their projects would love dual flexible mic/instrument inputs! I didn't realize you could have two inputs. I thought there was simply only a Mic-in and a Line-in, I didn't realize that they were flexible inputs.

Nevin
 
Zeners can be yet another noise source!

Yes, you can (and generally should) turn on the SGTL's gain ramping function to reduce popping.

I was referring to the large transients that can occur when turning on/off Phantom. 48v suddenly appearing across both inputs. There are switching tricks we'll apply to reduce this.

Yes, current limited (6.8k series resistors) equal voltages to pins 2 & 3 is correct for phantom. If you're referring to Pin 1, yes, that's the normal ground return for phantom, not the case of the XLR, which is generally left unconnected to stop "people" signals being introduced the mix.

Yes, both channels allow mic/line inputs, so I'll work up a dual board.

BTW, we could try to mount the phantom switch on the bottom of the board, under each pot, if you'd like to retain the analogue volume control feature. That way the front panel doesn't get any wider. I'll play around with the options.

As for the 48V supply, I've found a circuit using a MC34063 that operates 5v -> 48, and requires only a resistor change on a commercial module from eBay. Its switching frequency is 100kHz, which is a bit on the low side (only twice the ACD sample frequency), but we should be able to isolate things well enough that it doesn't inject into the audio circuitry.

The benefit of this module approach is that advanced assembly skills and facilities are not required if people want to build one of the modules.

mc34063 boost module.jpg

Richard
 
I see, as you can tell- I don’t know much about electrical engineering.

This all sounds great! Keeping the pot if it allows us to use it as a gain control knob sounds awesome. Very cool idea of mounting the switch under the pot. Another idea could be using a push button pot/rotary encoder to set the gain input and when pressed it can switch the phantom power on and off signaling with an LED. I don’t really know how much complexity that would add though in terms of the circuit, but just another option. A small dual state push button doesn’t really take up much space anyway especially if it’s next to an LED.

That supply power module looks awesome, very nice find!

I think we are about ready, let me know if there’s anything I can do to help or clarify things.

Nevin
 
Good catch on the XL6009 modules! I'll substitute them into the design.

The rotary encoder/switch idea is a good one, though a little prone to accidentally turning on/off phantom power, and requiring more GPIOs to implement!

Your choice here:
  1. The Encoder options requires 8 free GPIOs for two sets of encoder/switches, plus the LEDs will also need to be driven by the Teensy, given the encoder switches are momentary contact only.
  2. The Pot/Switch version requires 2 Analog + 2 digital inputs, and has a locally-driven phantom ON LED.

Richard
 
I think option 2 is the better one in this case. A dual state push button shouldn't really take up too much space and allows for people to use more of their GPIOs for their projects. I know I have to have at least two analog inputs free of the 14 available on the teensy 4.0 for a joystick in my project.

I think it's also worth mentioning I'm definitely in no rush, as I am waiting for the teensy 4.1 release soon here to implement this design into my project as I switch from arduino micro to teensy for it's built in DSP abilities.

Also Paul is amazing with the support/development of this project so I am definitely wanting to use his board.

Nevin
 
Yes, I agree that option 2 makes more sense.

I re-read the SGTL5000 spec, and I got the number of mic inputs wrong - as the block diagram is somewhat misleading. There is ONE mic input, and two line inputs.

Re-reading the datasheet in detail, it appears that the mic input goes to both channels (only one input and one gain setting in the mic control register 0x002A), and is mixed with the L & R line inputs before conversion. Paul's software approach aligns with this thinking.

So, I think our best option here is to ignore the SGTL5000's mic input altogether, and go with a mic/line preamp, with local switching (as we've already discussed) - to avoid the mic input appearing in both sample channels. This aligns with the example circuits earlier in this stream, I just need to add phantom power.

For the controls, I like the layout below, as the phantom LED is soldered under the board (below the phantom switch) and the level pot is right next to the input jack.

control layout.png

This layout is 125mm (5") wide (board edges). If that's too wide, then we could go with just an instrument input on channel 2 - which would save about 25mm (1/4" jack narrower than XLR, and no phantom switch).

There's also no problem with creating individual mic/ine modules, and just leaving the voltage boost module off one of them.
 
Richard,

The design looks great! I wonder if they made the mic input output through both channels to facilitate mono recording, as mono is a typical way to record microphones. Anyway, if we have flexibility to record either mics or instruments on both channels and both ways of input perform the way they're expected to, I think we are in good shape. Having two inputs with phantom power has me wondering how this board would perform in regards to current especially if being powered from USB. I believe most powered mics actually don't draw a lot of current, so I think we should be in good shape there too.

The 5" board size sounds perfect too, especially since people can create individual modules as necessary. I plan to incorporate a simple "DAW" to my project and handling input switching is currently unfamiliar to me with the audio library/board. This brings up a question, how will the two inputs be handled by the SGTL5000? Will they be handled as two separate input channels and show up that way as input devices on a computer and teensy software or will they output their audio on the same channel?

Also further thinking about the needs of this project has brought up one more capability that I believe is necessary in this board. How can we handle clipping? Typically many audio interfaces will incorporate some LED to indicate when the signal is being clipped.

Thanks for bearing with me and my novice questions. We are getting closer and closer!
 
Happy to include clipping LEDs - software controlled.

Here's a first cut at the schematic.

1. I went back to "real" rather than virtual volume controls - it's a lot easier to avoid clipping if you can control the gain before it gets to the SGTL.

2. Mic/instrument on both inputs, auto switching.

nevin schematic v3.png

And the layout (75 x 125mm):

nevin layout v3.png
 
Can't say anything about the ths472 chip, doesn't look professional audio level one to me. Something like That1512 would be much better choice:
https://www.mouser.fi/ProductDetail/THAT/1512P08-U?qs=9Udfh7QmL4sFBLonIQFgcw==
ThatCorp has good application notes available. Can't go wrong. Also the phantom power should be filtered much better either using a capacitance multiplier or a bare rc filter after the boost converter. Groupdiy.com is the place to look for information on mic pres.
 
If we were going for a 24 bit design and had +/-12V supplies readily available the THAT1512 chip is an excellent match. I'm very familiar with it. Its EIN (equivalent input noise) of 4.6 nV/root(Hz) @ 20dB gain is top class.

If you're intending to use the Teensy Audio Library, then with 16 bit resolution, the theoretical maximum is 96 dB S/N and with practical limitations and headroom, this comes down to 80-85dB practical S/N. There is a good discussion on this at http://openaudio.blogspot.com/2017/03/teensy-audio-board-self-noise.html

I believe the TS472 will deliver that kind of performance, as its stated EIN is 10 nV/root(Hz), but I'll do some measurements on one to see how it performs in practice. It's only 6dB below the THAT chip's performance, and the loss is significantly less than is given away by the 24/16 bit sample depth reduction (48dB theoretical, practically more like 20dB if you assume the bottom 4 bits is mainly noise!).

Having said all that, I'm happy to design with the THAT chip if that's your desire, it will mean adding a +/- 12V (or even +/- 5V) supply. We'll need to be careful that we don't exceed the USB's 5v supply capability. The chips themselves don't consume much, but the switching supplies can have significant no-load current. I'll check.

I agree that more filtering of the 48v supply is warranted. BTW, my current phantom input configuration is based on Fig 5 from the THAT1512 datasheet.

GroupDIY tends to be a mixture of very sage advice, and folks who are keen to try out all kinds of interesting ideas to get the last iota of performance out of their designs. Capacitance multipliers are an aspect of analogue regulator design, which don't apply here. With 400kHz switching supplies, most of the noise is well-outside the audible range, and aliasing with the sampling multiplier (in this case 128Fc ~= 6 MHz) is more of a concern. Also the CMRR of the preamp (typically 60-80dB), kills any remaining output noise from phantom power.

We already have RC filters after the 48V converter, however I'll change R19/20 to ferrite beads, upgrading the existing RC pi configuration.

In all the technical discussions, we haven't any clarified non-technical specifications.

1. What's your price point expectation? I have been assuming a low-cost design. Say $20-30 for components on top of the board fabrication (say $10). If you're looking at professional assembly, that adds around $30/board for short runs (depending on complexity).

2. What level of assembly capability do we want to require? I have been assuming that we are restricting the design to simple assembly (passive components and modules, but not multi-pin SMD packages), so that others without extensive facilities (e.g. reflow ovens, and SMD rework stations) can complete the design.

3. What are the physical specifications and constraints - board size, panel layout etc?
 
Awesome! I'm glad we are getting more discussion on this.

The layout looks great to me in terms of physical size. I think 5" width for two inputs is not a bad deal and since this design has flexibility for reducing the inputs/features- even better. I like the idea of this board being lower cost as you've described and being able to be assembled by anyone. I personally don't mind whatever route we do go on assembly, as I will be able to mount SMD components if it comes down to it. Also it's really helpful that it would work with the audio library/official audio board.

I just have a few questions if you don't mind.

1. On the SGTL5000 data sheet I am only seeing one set of line inputs under the pin definitions. (https://www.pjrc.com/teensy/SGTL5000.pdf pg. 3 - 4) How would input switching to the SGTL5000 work between both combo jacks if the pin head on the audio board is only looking for a line input and a mic input?

2. Can we differentiate between the two line inputs in the software? Would they show up as two separate stereo input channels/devices on the computer or would they merge into one?

3. For software controlled clipping LEDs, would we simply monitor the line going into the SGTL5000 and turn on the LED if the line exceeds 0v?

Sorry for all the questions, just trying to get a complete understanding and in case anyone else may have the same questions in the future.
 
Last edited:
OK, Most of the components will be reasonable in size (0805 or bigger) so straightforward enough to hand solder - it's the ICs with 0.5mm lead spagin that get really tricky! The THAT chips are available in SOIC packages that will be OK if we go down that path.

1. Each of the combo inputs goes to one of the SGTL5000 inputs (L or R). We are completely ignoring the (single) mic input on the SGTL5000 as it is Mono, and is mixed in to both channels before the ADC.

2. If you have some spare GPIOs (and the T4.1 will have plenty!) then I can add sensing on the Combo jack (GND pin switch) to indicate which input is in use. The channels would show up independently.

3. For monitoring overload, the analyse_peak() audio object is used, and the LED turned on for a period when the value approaches (or equals) the max sample value.

Questions are good! Keep them coming!
 
Great, thank you for your enlightenment on this topic. Super awesome getting to learn from someone who really knows their stuff like you!

1. Very cool. This doesn't mean audio will only be showing up in the left or right channel right? We should be able to use a mixer object to output to both left and right. Very clever use of the hardware!

2. If the sensing is needed for the channels to show up independently, then I think this is a pretty necessary feature. Since the board displays two inputs physically, in my opinion, it would make sense for it have two inputs on the computer for audio. This would bump us up to the 10 pin jack for the ground switch or would it work with the built in ground?

That's about all the questions I have. Hope everything is going well out there!
 
Last edited:
One further question- would using one side of the line input per a combo jack lose stereo compatibility of signal going into the jack? For example, if I am using a guitar pedal that produces stereo effects such as a phaser. Would this signal be collapsed down to one channel into the SGTL5000?
 
Here's another idea for the circuit.

THAT1512 for the mic preamp (fixed gain). +/-5V supplies.

LM833 final preamp (inst) volume control for both Mic/Inst input.

Max mic gain is 30 + 20dB = 50dB, may need to add another 10dB to the THAT1512 to bring it up to 60dB which is about right for low output microphones. I'll change R5/R36 to 47 ohms to make the gain right.

Mic/line sense inputs and overload LEDs as before.

that1512 preamp.jpg
 
Here's another idea for the circuit.

THAT1512 for the mic preamp (fixed gain). +/-5V supplies.

LM833 final preamp (inst) volume control for both Mic/Inst input.

Max mic gain is 30 + 20dB = 50dB, may need to add another 10dB to the THAT1512 to bring it up to 60dB which is about right for low output microphones. I'll change R5/R36 to 47 ohms to make the gain right.

Mic/line sense inputs and overload LEDs as before.

The mic pre (1512) should really have a gain control (linear or rev log 10k potentiometer in series with a large capacitor > 1000uF). Even then there can be too much gain when recording loud sources considering there is the second gain stage. That second stage could be left out if you run the line level stuff into mic pre attenuated with some resistors - may be difficult using the switches built into the combo XLR connector.

Also consider running the 1512 from the 48V phantom supply, the +/-5V is too little supply voltage for proper operation. Only the input resistors and ref pin need to be referenced to virtual ground, the ref input though should be driven by a circuit with a 1 ohm output impedance, so you would need an additional op amp for a that purpose. Another problem is the 1512 can be supplied only with +/-20V so you will need additional regulator stage. It can be simply a zener (~30V) and a transistor. See the JLM Baby Animal schematics here for an example: http://www.jlmaudio.com/Baby Animal Mic Pre with JLM14 & OPA2604.pdf

If you don't want to spend so much for the 1512 part another nice though a little bit noisier mic pre alternative could be the Joemeek CurrentSense mic pre:
https://www.gearslutz.com/board/att...-joe-meek-twinqcs-schematics-cscct-resize.jpg
That was used also on the E-Mu 1820M audio interface in addition to many Joemeek preamps.

If you used the OPA2604 instead of LM33078 (though it is a little bit different amp being a FET one) you could run it straight from the 48V supply (virtual ground at 24V). OPA1678 dual is another good and inexpensive amp for max. 36V supply.
 
Last edited:
Back
Top