XAM
!! DRAFT !!
xam is xan's audio multiplexer (and headphone amp :)
This is a one-off project I made for myself. It's all public domain as always, so you can feel free to take ideas, or build one (beware that I only made one revision and there is a laundry list of reworks). If you're really interested, I probably have some spare bits and pieces (PCBs, acrylic cover, maybe a motorized pot), just drop me an email.
- Six line level inputs, one with switchable phono preamp, one dedicated to a tape recorder or other recording device (with tape monitor switch).
- Two line level outputs, one primary and one tape out.
- Headphone driver with two gain ranges.
- Calibratable level meter for checking recording levels.
- USB port offering full remote control (power, channel select, tape monitor select, and volume control). Implemented with no microcontroller! Isolated to avoid awkward ground loops with your computer!
TOC
- Project status
- Schematics, pics, and CAD
- Characterizations
- Assembly instructions and warnings
- USB control interface
- Theory of operation
Project status
- ✅ Working and built, including reworks
- ⬛️ Mechanical build (including acrylic cover and feet) finalized
- ⬛️ Documentation prepped for release (including bill of materials)
Schematics, pics, and CAD
- Main board schematic, PDF, 1.9 MB
- Controls board schematic, PDF, 229 kB
- Design files, GitLab (I'll zip them up when ready)
Characterizations
Frequency response
Power consumption
Description | Value | Unit |
---|---|---|
Shutdown current (normal) | 60 | µA |
Shutdown current (all relays selected after shutdown*) | 3 | mA |
Idle current (on, nothing selected) | 175 | mA |
Add'l current, volume motor active | 185 | mA |
Add'l current, one channel active | 15 | mA |
Add'l current, six channels active | 77 | mA |
Add'l current, tape monitor active | 13 | mA |
Add'l current, level meter fully lit | 44 | mA |
* Due to a design bug, it is possible to change the channel select state after the system has been powered down. The relays do not actuate, but base current still flows into the drive transistors, causing slightly increased power consumption.
Assembly instructions and warnings
PCB revision 1 (currently the only revision in existence) requires many reworks and do-not-populates; review the schematic carefully before building. Reworks are annotated with a large "REWORK" text showing what needs to be done. Added components have reference designators of 900 or above. Removed components are shown with a red X through them and do not appear in the bill of materials.
Part selection: passive components
Some of the passive components have special requirements. These are specified with a particular part number in the bill of materials, but in many cases could be substituted if needed.
Resistors: Many of the resistors contain a notation like "1WPR"; this example means "1 watt, pulse resistant". Pulse resistant parts like the Vishay PR01, PR02, PR03 series may provide superior robustness and longevity in these positions where short, brief overloads are expected, but you could probably use normal parts and it'll work fine.
Capacitors in the signal path are special. If subsitutions are chosen, these should generally be film capacitors, C0G ceramic capacitors (no X-anything or Y-anything!), or as a last resort for high capacitance parts, bipolar aluminum electrolytics. Pay attantion to tolerance as many of these set filter responses.
Tantalum: In some decoupling and timing circuits, I have used tantalum capacitors. These have a bad reputation but many desirable characteristics for certain applications. Because I do not use them anywhere with a large amount of available energy, there is no safety hazard to these parts, and because I have used them with substantial voltage margin and "soft" slew rates, you can expect a very long life from them. Furthermore, while tantalum mining is somewhat ecologically and socially harmful, this is also the case for many other raw materials in electronics, and they are used in quite small numbers here. I never design tantalum into mass produced products, and always try to buy old stock parts in low volume to reduce my contribution to coltan mining demand. If you would like me to mail you a few capacitors from my personal collection to avoid purchasing new parts yourself, just let me know.
Volume control potentiometer: This is a motorized potentiometer, allowing remote volume control. The nominal part is ALPS RK16812MG-F20-B103-M0, which has a 10k linear taper. This is my preference — audio tapers are piecewise and feel a bit crude to me, but a linear taper can be converted with a loading resistor on the wiper to produce a nice, smooth curve. If you end up needing to buy a different part, the system can be modified to support it in the following ways. If your potentiometer already has an audio taper, remove the loading resistors R33 and R38. If your potentiometer has a different total resistance than 10k, scale the other resistors in the volume control circuit (RV2, R33, R38, R85 or R81, R94, and R98) accordingly; do not go below 10k or above 100k. If your potentiometer has a different motor winding resistance (this is most likely if you use a compatible non-ALPS pot, which can be a bit cheaper on e.g. eBay; just make sure the nominal motor voltage is still somewhere around 4.5-6V), adjust R2 and R3 accordingly to drop 6.5V at the nominal motor current.
Part selection: relays
The reed relays I've specified and used in the signal path are Electrol BBF1A05A10. These have been obsolete for a long time and there's no reason for you to track some down; I'm only using them because I got a large lot really cheap a few years ago and I think they look really dope. They are footprint and electrically compatible with the cheap 5V reed relays you can easily source from eBay, AliExpress, or even LCSC (a common part number is SIP-1A05, made by many manufacturers).
Assembly: surface-mount film capacitors
The phono preamplifier uses two surface-mount film capacitors. These are tricky to solder. I suggest setting your soldering iron to the lowest temperature that will reliably melt your solder, using leaded solder if you're comfortable working with it, holding them gently with tweezers while soldering them (the heat may soften the film and you don't want to crush them), and not attempting to resolder them to "fix" a crooked placement as long as they are properly connected. Do not hot air solder them unless you have your temperature control very carefully controlled. If you're very nervous about this, you can also purchase equivalent through hole parts and bend the leads to contact the surface mount pads.
USB control interface
TODO
Theory of operation
System architecture
TODO
Phono preamplifier
The phono preamplifier circuit is based on P06 from Elliott Sound Products, with slight modifications. Rod's website has an excellent writeup on the design. It is a two-stage amplifying filter, with the first pole and zero (50 Hz, 500 Hz) provided in the loop of the first stage, and the second pole (2100 Hz) as a passive filter after the second stage. It provides excellent performance and sounds great.
The op amps are socketed so you can use anything or experiment with them. Due to the high gain I have specified a very high-end low-noise unit (LM4562), but it sounds fine with a basic part like NE5532.
Mixer
The mixer combines inputs from all six (per stereo channel) input-select relays, allowing you to select multiple inputs simultaneously to sum their signals together. I find this helpful to quickly switch between two sources without messing around with the XAM in between.
Each signal is fed through a 10k resistor into the summing junction (virtual ground) of an inverting amplifier, U4. A 10k feedback resistor sets a gain of unity for this stage, and a 270pF capacitor across it provides a low-pass cutoff at 59 kHz so we aren't passing ultrasonic garbage.
The output of this mixer then passes to the infrasonic filter, which sets the high-pass cutoff.
Infrasonic filter
This filter is also borrowed from Elliott Sound Products (P99). A four-pole Sallen-Key filter provides a practical brick wall between the infrasonic frequencies and audible bass (fc is 18 Hz; ESP claims a 36dB/octave rolloff which matches theory but I get more like 28 measured as you can see above). This allows the system to get excellent bass response while also solidly rejecting subsonic/infrasonic signals as are often generated by warped records and sometimes found in other media. It is technically an optional block, but does not noticeably affect signal quality, and avoids the distortion that could be caused by driving these large signals into speakers.
Headphone driver
The headphone driver uses a chain of two op amps in each stereo channel, with the final amplifier being a Texas Instruments OPA1622 audio power amplifier intended for headphone use. The output is DC coupled to avoid bass response degradation when driving lower impedance headphones, with an AC coupling between the op amp stages to reject any accumulated offset.
The volume control potentiometer before this stage is a linear 10k potentiometer with a 2.7k loading resistor, providing a smoother logarithmic-like curve than a traditional audio pot (with the drawback of an input impedance changing with volume setting, but the system presents a low impedance to it so this is not a problem).
Level meter
TODO
Controller: input select mechanism
A logic circuit is built to provide traditional "radio button" action from the front panel input select buttons. This means that when a button is pressed, previous selections are cleared, and also that while that first button is held, additional buttons may be pressed too in order to select several channels.
Each input has a flip-flop (U21, U26, U29) storing its selection state. Each selection signal is pulled up to 5V, and switched to near-ground when the switch is pressed. Releasing the switch in the worst case (or the switch bounce in the best case — this is actually beneficial in this circuit!) sends a rising edge into this signal, causing the flip-flop to clock in a "high" level and switch that channel in.
The front panel switches which pull the select signals to "near-ground" are in fact switching them into the base of an NPN transistor, Q11. The first signal to reach the base generates a pulse via timing circuit C105/R173, which is squared up by inverter U19E and sent to the reset input of all flip-flops. Thus, pressing a button causes an immedate all-channels mute, followed by selecting that channel when the switch bounces or is released. Pressing another button while the first is held does not create a new mute pulse (because Q11 is already turned on), allowing multiple selection.
A timing diagram showing this action, including with harmless spurious mute and select events caused by switch bounce, can be seen on the relevant schematic page.
Controller: power and reset control
A global reset signal, generated by timing circuit C109/R187 and inverter U19C, clears the state of the input select flip-flops, tape monitor flip-flop, and a state flip-flop in the serial decoder when activated. This circuit is activated by power events (On command via R181, Off command via R182, and toggles via C904/R903; all via Q12). Because power events trigger a reset, the reset signal cannot reset the power state itself; an additional capacitor C107 ensures the system receives an Off pulse (and subsequent full Reset) at a cold start.
Controller: serial decoder
A UART interface controlled via USB-CDC is used to generate control signals. These are interpreted in an unusual way to simplify the firmwareless decoder design.
Each control bit is transmitted into the system in the form of a byte, either
hex 00
to represent a control bit 1
, or hex FF
to represent a control bit
0
. Note that on a UART interface configured to 38400 8N1, these each represent
a falling pulse with width 26µs or 234µs, respectively.
When this pulse begins, the filter consisting of R169 and C103 measures its width. Schmitt inverter U19B detects whether the final ramp height at this filter exceeds a threshold, producing the data bit. Finally, the rising edge at the end of the pulse clocks the bit into the shift register (U25, U28), with Q10 resetting the filter and R168 delaying reset slightly to ensure the bit remains valid while being clocked in.
The UART byte encoding each bit is sent back to the USB host via the loopback from pin 2 to pin 3 of U22, allowing the control software to detect when a packet of bits has been fully transmitted. At the end of the packet, the DTR control signal is toggled, producing a framing pulse. This transfers the full packet from the shift register into the holding registers, where it provides control signals for various components of the controller.
Controller: volume control watchdog
To avoid the volume control motor being stuck "on" by a buggy or crashed controller, and to avoid invalid states being driven, a decoder and watchdog circuit (U17B, U23A-C and associated components) creates the motor drive signals from "spin" and "direction" commands from the host. The motor is driven in discrete bursts of about 100ms regardless of the command from the host.
Volume motor driver
TODO