Silicon ChipUSB Stereo Recording & Playback Interface - June 2011 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Let's forget aobut a carbon tax and concentrate on the environment instead
  4. Feature: The FutureWave Energy Saver by Ross Tester
  5. Feature: Rescuing Electronic Gear After The Flood by Robert Googe
  6. Project: 20A 12/24V DC Motor Speed Controller Mk.2 by John Clarke
  7. Project: USB Stereo Recording & Playback Interface by Jim Rowe
  8. Project: VersaTimer/Switch With Self-Latching Relay by John Clarke
  9. Review: Marantz CD6003 CD Player by Leo Simpson
  10. A Handy USB Breakout Box For Project Development by Jim Rowe
  11. Vintage Radio: Radio manufacturing in 1925: the Wells Gardner story by Kevin Poulter
  12. Book Store
  13. Advertising Index
  14. Outer Back Cover

This is only a preview of the June 2011 issue of Silicon Chip.

You can view 28 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "20A 12/24V DC Motor Speed Controller Mk.2":
  • 20A 12/24V DC Motor Speed Controller Mk2 PCB [11106111] (AUD $12.50)
  • 20A 12/24V DC Motor Speed Controller Mk2 PCB pattern (PDF download) [11106111] (Free)
Items relevant to "USB Stereo Recording & Playback Interface":
  • USB Stereo Record/Playback PCB [07106111] (AUD $15.00)
  • USB Stereo Recording & Playback Interface (PDF download) [07106111] (PCB Pattern, Free)
  • USB Stereo Recording & Playback Interface front panel artwork (PDF download) (Free)
Items relevant to "VersaTimer/Switch With Self-Latching Relay":
  • VersaTimer/Switch PCB [19106111] (AUD $10.00)
  • PIC16F88-I/P programmed for the VersaTimer/Switch [1910611A.HEX] (Programmed Microcontroller, AUD $15.00)
  • Firmware (ASM and HEX) files for the Versatimer/Switch [1910611A] (Software, Free)
  • Versatimer/Switch PCB pattern (PDF download) [19106111] (Free)
  • Versatimer/Switch front panel design (PDF download) (Panel Artwork, Free)
Items relevant to "A Handy USB Breakout Box For Project Development":
  • USB Breakout Box PCB [04106111] (AUD $5.00)
  • USB Breakout Box PCB pattern (PDF download) [04106111] (Free)

Purchase a printed copy of this issue for $10.00.

Make high-quality audio recordings with this . . . USB Stereo Recording & Playback Interface It uses balanced mikes and has S/PDIF & line inputs as well By JIM ROWE Now you can use your laptop PC to make high-quality stereo audio recordings with professional standard balanced microphones. This interface unit lets you make recordings at sampling rates up to 48 kilosamples/second and provides high-quality stereo analog line outputs for playback or monitoring. There’s also an S/PDIF digital audio input for recording and an S/PDIF digital audio output for playback. 36  Silicon Chip siliconchip.com.au VCCCI VCCP1I VCCP2I VCCXI VDDI INSIDE THE TEXAS INSTRUMENTS PCM2902 5V TO 3.3V LDO REGULATOR S/PDIF DECODER USB PROTOCOL CONTROLLER VINL FIFO ADC VINR Vcom SSPND POWER MANAGER LOCK DIN SELECTOR USB TO HOST ISOCHRONOUS IN ENDPOINT USB SIE TRANSCEIVER CONTROL ENDPOINT ANALOG PLL DAC DOUT 12MHz XTAL SEL0 SEL1 ISOCHRONOUS OUT ENDPOINT HID0 HID ENDPOINT S/PDIF ENCODER XTI D+ ANALOG PLL FIFO PLL (X8) D– DGNDU VOUTL VOUTR Vbus (+5V) 96MHz HID1 HID2 TRACKER (SPACT) AGNDC XTO AGNDP AGNDX DGND Fig.1: this block diagram shows what’s inside the PCM2902 stereo audio CODEC IC. It provides line-level analog stereo inputs & outputs, an S/PDIF digital audio input, an S/PDIF output and a full-speed USB interface. W HILE MOST LAPTOPS have a built-in sound card, they’re no good for high-quality audio recordings. Most built-in sound cards are of somewhat indifferent quality when it comes to the recording side and they don’t provide balanced inputs for professional type microphones, which are really necessary for making highquality recordings. Hence, if you want to use a laptop, you need an “audio front-end” with balanced-input microphone preamps feeding a pair of high-quality analogto-digital converters or “ADCs”. And since most laptops have at least one USB port, the easiest way to connect such an audio front-end to them is via a USB cable. This has the added advantage of allowing the audio frontend to draw its power from the laptop, via the same cable. So that was the rationale behind the low-cost audio front-end unit we’re describing here. Or at least, those were our basic goals when we started its development. Along the way it “grew some” when we realised that it wouldn’t be too difficult to provide it with various bonus features: siliconchip.com.au (1) line-level analog stereo recording inputs; (2) line-level analog stereo outputs for playback and/or monitoring; and (3) S/PDIF digital audio input and output for direct digital recording and playback. In effect, it has become a flexible multi-purpose USB audio interface – not just for laptops but for virtually any PC. It’s easy to build and much lower in cost than comparable commercial units. What’s more, there’s no software to install – you just connect it up and it runs on Windows XP SP3, Windows Vista and Windows 7 (both 32 & 64bit). It should also work with recent Linux and Mac operating systems. What’s inside? The heart of the project is the PCM2902 from Texas Instruments. This was originally developed by BurrBrown, which was acquired by TI not long ago. The PCM2902 is described as a single-chip stereo audio CODEC with an inbuilt full-speed USB protocol controller, SIE (serial interface engine) and transceiver. As well as providing line-level analog stereo inputs for recording and line-level stereo outputs for playback, it includes an S/PDIF digital audio input for recording and an S/PDIF output for direct digital playback. And of course, it has an inbuilt full-speed USB interface. Fig.1 shows the goodies packed inside the PCM2902. To the right of centre is the USB protocol controller block which provides four main USB “end-points”: (1) a control end-point which receives control commands from the PC host; (2) an HID (human interface device) end-point which allows inputs to the chip to generate keypress events on the host PC, to control muting, volume, etc; (3) an isochronous IN end-point which handles the transfer of audio recording data from the ADC section IN to the PC via the USB; and (4) an isochronous OUT endpoint which handles the transfer of audio playback data OUT of the PC via the USB, feeding it to the DAC section. Don’t worry too much about these terms but you might like to know that “isochronous” means that the audio data packets are transferred at a conJune 2011  37 What The Acronyms Acronym s Mean ADC: an analog-to-digital converter, which samples incoming analog (audio) at a designated rate such as 44,100 samples per second and outputs the samples as a digital serial bitstream. A stereo ADC samples both channels simultaneously but interleaves the samples in the output bitstream (ie, L-R-L-R and so on). CODEC: short for “coder/decoder” – basically a combination of one or more ADCs with one or more DACs. It can also include functional blocks for encoding and decoding the digital samples. DAC: a digital-to-analog converter, which converts digital data samples into the equivalent analog voltages or currents. A stereo audio DAC is really two separate DACs, one of which converts the left channel samples in the incoming bitstream, while the other DAC converts the right channel samples. FIFO: a First-In-First-Out buffer, which provides temporary storage for a stream of digital data. Although it functions like a serial delay line, most FIFOs are actually implemented with dual-ported random-access RAM. LDO: a Low-DropOut voltage regulator – ie, one which requires a very small difference between the unregulated input voltage and the regulated output voltage in order to operate correctly. PLL: a Phase-Locked Loop, which is a functional block designed to lock an oscillator to an exact multiple or sub-multiple of a frequency from another oscillator. SIE: short for “Serial Interface Engine”. A functional block which manages the packaging/transmission and reception/unpackaging of data transferred via a serial interface like USB. S/PDIF: the Sony/Philips Digital Interface Format, a protocol and physical layer specification used to transport digital audio signals between devices and components. The signals can travel over either a coaxial cable or an optical fibre cable (in the latter case it is usually called “TOSLINK”). It is a consumer-level adaptation of the original AES/EBU (Audio Engineering Society/European Broadcasting Union) standard for professional digital audio. The serial audio data stream is encoded with “biphase mark coding”. TOSLINK: short for Toshiba Optical Serial Link, the version of S/PDIF which uses optical fibre cables to carry the digital audio bitstream. USB: short for “Universal Serial Bus”, the serial data communications bus now very widely used to link PCs with a broad range of peripheral devices. The original USB 1.0/1.1 standard supported communication at Low Speed (1.5Mbits/second) and Full Speed (12Mb/s). When USB 2.0 was subsequently introduced this also covered High Speed (480Mb/s), while the recently adopted USB 3.0 standard adds Super Speed (5Gb/s). USB 1.1 and 2.0 use a standard 4-wire cable, with different connectors at each end – Type A for connection to the “downstream” port of the PC or an intermediate hub, and Type B for connection to the “upstream” port of the USB peripheral device. stant rate (isochronous = equal time). You might also want to note that we’re not actually making use of the HID end-point in this project. To the right of the USB protocol controller block are the USB SIE and transceiver sections which transmit and receive all the data and control packets transferred over the USB signal lines. Just above the protocol controller is the power manager block which controls the power taken by the external circuitry, as directed by the host PC’s USB driver. Thus, when the PC directs the PCM2902 protocol controller to switch the device into low power “suspend” mode because no activity has been detected for a few milliseconds, the power manager block drops the logic level on the SSPND-bar output pin. This is used by external control circuitry to turn off power to everything but the “brains” of the PCM2902 chip itself. As soon as the PC directs the protocol controller to resume normal operation, the power manager pulls the SSPND-bar line high again, so power is restored to the external circuitry and 38  Silicon Chip it can get back to work. The sections to the left of the USB protocol controller block in Fig.1 are those involved in processing the record and replay signals. In the upper area, there’s the stereo ADC section for converting incoming analog audio into 16-bit digital samples, together with the S/PDIF digital audio input decoder. The digital bitstream from one of these is fed through a FIFO (first in, first out) buffer to the isochronous IN endpoint of the USB protocol controller, for transmission to the PC host. By the way, if there’s a signal from the S/PDIF input decoder it becomes the recording signal but if there is no S/PDIF signal, the bitstream from the ADCs is fed to the FIFO block as the recording signal. In the lower area of the block diagram there’s a second FIFO buffer which is fed from the protocol controller’s isochronous OUT endpoint with audio playback data received from the PC host. The output of this second FIFO is fed to the stereo DAC section to be converted into analog playback audio. At the same time, it is fed to the S/PDIF encoder section to produce a digital playback bitstream. So the playback signals simultaneously appear at both the analog audio outputs and the digital S/PDIF output. Note that the clock signals used by all parts of the PCM2902 are derived from a single 12MHz oscillator inside the chip itself (apart from the crystal and some minor components). An internal PLL (phase-locked loop) is used to multiply the crystal frequency by eight, producing a 96MHz clock that’s used to drive most of the chip’s circuitry – including the ADCs, DACs and USB control circuitry. An important feature of the PCM2902 is the “tracker” section you can see just below the USB protocol controller. This takes the 96MHz internal clock and locks it to an audio clock signal derived from the USB data packets, using what TI calls its “SpAct” architecture. This is claimed to reduce clock jitter for both recording and playback and also allows simultaneous recording and playback at different sampling rates. Note that the PCM2902’s ADCs use 16-bit delta-sigma conversion and can work at any of seven standard samsiliconchip.com.au pling rates: 8, 11.025, 16, 22.05, 32, 44.1 and 48kHz. The DACs also use 16-bit delta-sigma architecture but can only operate at the three most popular sampling rates: 32, 44.1 or 48kHz. As you can see then, the PCM2902 is a very powerful chip, containing all the main functions needed for a high-quality USB stereo recording and playback interface. Circuit description Refer now to Fig.2 for the complete circuit of the USB Stereo Recorder & Playback Interface. Now that you’ve seen inside the wondrous PCM2902 chip, you should be able to follow its operation without any problems. All the circuitry to the left of the PCM2902 itself (IC3) is concerned with preparing the incoming audio signals for recording. The left-channel analog recording circuitry is shown at top, with identical circuitry for the right channel below it. Each channel has a balanced microphone input connector (CON1 & CON3) and each of these feeds a balanced-input mic preamp using three sections of an MCP6024 low-noise, low-voltage CMOS quad op amp (IC1c,b&d and IC2c,b&a). The gain of these preamps is adjusted via a dual-gang potentiometer (VR1a & VR1b). This allows the gain to be optimised without running into overload. The maximum preamp gain is 201, which should be sufficient for most microphones. The line-level output from each mic preamp (ie, at pin 14 of IC1d & pin 1 of IC2a) is fed to its corresponding position on double-pole switch S1. Alternatively, the second position of each pole is used to select the signals from the line-level input sockets (CON2 and CON4). The signals selected by S1a and S1b are then fed to third-order active low-pass filters based on IC1a & IC2d. These fare used for “anti-aliasing” and filter out any audio components above about 22kHz. Without these filters, there could be audible alias components being generated as part of the sampling process. The outputs of the anti-aliasing filters are in turn fed to the ADC inputs of the PCM2902 (VinL at pin 12 and VinR at pin 13) via 1µF coupling capacitors. Note that because the op amps in IC1 and IC2 are being operated from a single DC supply rail (Vcc) of approximately 4.0V, they must be siliconchip.com.au Specifications Purpose: a digital stereo recording and playback interface for laptop PCs, which links to the PC via a standard USB cable and is powered from the PC’s USB port via the same cable. Features include: • Twin balanced-input microphone preamps for use with professional type microphones. • Selectable line-level stereo analog inputs. • High-quality stereo ADCs for recording at any of seven standard sampling rates (8, 11.025, 16, 22.05, 32, 44.1 and 48kHz). Built in stereo DACs for replay at any of three standard sampling rates (32, 44.1 and 48kHz). • • An S/PDIF digital audio input to allow recording directly from an S/PDIF digital audio signal, as an alternative to the analog audio inputs. • An S/PDIF digital audio output to allow playback via a high-quality digital sound system, as an alternative to the analog audio outputs. 16-bit delta/sigma ADCs and DACs. • Fully compliant with the USB 1.1 specification. • • Installs automatically on Windows XP SP3 and later operating systems (plus recent Mac & Linux systems) using the standard USBaudio.sys drivers – no custom drivers required. • Fully compatible with Windows-based audio recording and playback software such as “Audacity”. Frequency response: Recording = 20Hz - 17kHz +0dB/-1.0dB, 15Hz - 20kHz +0dB/-2.0dB; • Playback = 30Hz - 18kHz +0dB/-1.0dB, 20Hz - 21kHz +0dB/-2.0dB • Low current drain (below 70mA). biased midway between Vcc and 0V to ensure maximum output swing with minimum distortion. This Vcc/2 bias voltage is derived from a resistive voltage divider consisting of two 2.7kΩ resistors (just above IC1a). The same voltage is also used to bias the replay filters and output buffers in IC4, which we’ll come to in a moment. The only remaining part of the recording circuitry is CON5. This is the S/PDIF digital bitstream input. Its signal is simply fed into the Din input (pin 24) of the PCM2902 via a 100nF capacitor. 150nF capacitor and a resistive divider to provide the correct peak-to-peak amplitude. The external components needed by the PCM2902’s 12MHz master clock oscillator are shown just below the Dout output pin. Apart from the 12MHz crystal itself, there are two low-value NPO ceramic capacitors which are used to bring the crystal’s frequency into the correct range (12.000MHz ±6kHz), plus a 1MΩ biasing resistor to ensure that the oscillator has minimum “start-up” delay when power is applied. Replay circuit USB interface The replay circuitry is shown to the lower right of the PCM2902. The DAC output signals appear at VoutL (pin 16) and VoutR (pin 15) of the PCM2902 and are fed via 1µF coupling capacitors to active low-pass filters based on IC4b and IC4c. These two filters are identical to those used in the recording channels and remove any glitches that are present in the DAC outputs. The filtered signals are then passed through unity gain buffer stages IC4a and IC4d and fed to the line output connectors (CON7 & CON8) via 1μF capacitors. The S/PDIF digital replay output appears at the Dout pin (pin 25) of the PCM2902. This is then fed to the S/PDIF output connector (CON6) via a The only part of the circuit we haven’t yet discussed is the USB interface and power management section. Because the SIE and USB transceiver are inside the PCM2902, the external part of the USB interface is really very simple. As shown, the four pins of USB connector CON9 are connected to the corresponding pins on the PCM2902, via 22Ω suppressor resistors in the case of the D+ and D- signal lines and via a 2.2Ω current-limiting resistor in the case of the Vbus line. The +5V supply applied to pin 3 (Vbus) when the interface is connected to the PC host (via a USB cable) is passed through an LDO (low dropout) regulator inside the PCM2902. The June 2011  39 100 100nF 470nF 100k LEFT MIC INPUT 1 100k 9 2 47pF 22pF 100k BOX & FRONT PANEL 2.7k 4 Vcc/2 8 IC1c 10k 22pF CON1 3 10 IC1: MCP6024 100 LEFT CH MIC LEVEL VR1a 10k 10k 100 F 10k 10k 12 10k IC1d 14 10k MIC 5 15k 820pF 33k 82pF 3 2 1 IC1b 7 220nF 100k Vcc/2 100 100nF 100k 10 100k 2 47pF 22pF 100k BOX & FRONT PANEL 9 8 IC2c S/PDIF IN MIC/LINE INPUT SELECT IC2: MCP6024 10k 100 RIGHT CH MIC LEVEL VR1b 10k 10k Vcc 10 F 4 10k 22pF CON3 3 IC1a 11 150k 1 CON5 10k 2 3 10k IC2a 10k 1 MIC LINE 8.2k S1b 1nF 15k 820pF 33k 82pF 12 13 IC2d 14 6 470nF 5 IC2b 7 220nF 11 100k 100k SC 1nF LINE 100nF 2011 8.2k 6 470nF 470nF RIGHT LINE INPUT S1a CON2 RIGHT MIC INPUT 2.7k 13 100k LEFT LINE INPUT Vcc 10 F Vcc/2 CON4 150k 100nF USB STEREO RECORDING & PLAYBACK INTERFACE Fig.2: the circuit for the USB Stereo Recording & Playback Interface. Quad op amps IC1 & IC2 form balanced micro­phone preamp and filter stages, while IC4(a)-4(d) filter and buffer the line outputs from IC3. In addition, IC3 directly interfaces to the S/PDIF input & output sockets and to a type-B USB socket. LDO’s output in turn appears at pin 27 (Vddi). Because the D+ signal line of the USB interface is connected to this pin via a 1.5kΩ resistor, this means that the D+ signal line is pulled up to a voltage close to Vbus. According to the USB specification, this is the correct way of indicating to the PC host controller that a USB device is capable of full-speed (12Mb/s) operation. Finally, we come to the power man40  Silicon Chip agement circuitry which is based on REG1, a REG103GA-A LDO regulator made by TI. There are two features that make this regulator special. The first is that its output voltage can be adjusted, something that’s not all that common with LDOs. The second is that it’s provided with an enable input (pin 5), so its output can be turned on and off very quickly by a control signal applied to this pin. These two features, together with its use of internal DMOS circuitry to achieve an exceptionally low drop-out voltage (typically <20mV for 90mA output current) make the REG103GAA ideally suited for this sort of application. REG1’s output voltage is set to 4V by the resistive divider connected to pin 4 (ADJ). In addition, pin 5 (EN) of REG1 is connected to pin 28 (SSPND-bar) of siliconchip.com.au REG1 REG103GA-A Vcc (~4.0V) 2 A D1 1N5819 K +3.6–3.85V 10 VcccI 12 14 SSPND Vcom Vbus D– IC3 PCM2902 D+ 23 11 28 5 HID0 6 HID1 7 HID2 27 VddI 9 SEL1 8 SEL0 26 DGND VinL TANT 24 DgndU VoutL 1 F TANT 100nF 1.5k 2.2 3 TO HOST PC CON9 USB TYPE B +5V 1 22 2 1 F TANT 1 2 3 4 22 4 Din VccXI 1 F TANT GND 3,6 TANT 10 F 100nF ADJ EN 5 +5V 1 13k 10 F AgndC 1 F MKT 4 10nF 27k 100nF IN OUT 16 1 F 8.2k MKT 1nF 100k 1 F TANT 15k 820pF BOX & FRONT PANEL 33k 4 5 IC4b 82pF 7 6 3 2 IC4a 1 1 F 100 Vcc/2 13 17 VoutR VinR 8.2k Dout XTI Vcc/2 15k 1nF Vccp1I XTO 1 F TANT 1 F MKT 1 F TANT 19 15 820pF IC4: MCP6024 33k 10 82pF 9 AgndP AgndX 18 22 IC4c 8 12 13 11 IC4d 14 1 F 100 RIGHT LINE OUT CON8 220k 25 20 1M 21 150nF X1 12MHz Vccp2I CON7 220k 100k 1 F MKT LEFT LINE OUT 47pF S/PDIF OUT 220 CON6 110 39pF PCM2902 REG103GA-A 1N5819 A the PCM2902. So whether or not REG1 provides this output voltage depends not only on the presence of +5V from the PC via pin 1 of CON9 but also on the logic level of the SSPND-bar control signal derived from the power management circuitry inside IC3. If the PC directs the USB protocol controller inside IC3 to reduce the USB device’s power level and enter “suspend” mode, the power managesiliconchip.com.au K 6 1 14 28 5 ment circuitry inside IC3 pulls pin 28 down to 0V. This in turn pulls the EN pin of REG1 low and switches off the Vcc output voltage. As a result, IC1, IC2 & IC4 all shut down, as does the circuitry inside IC3 which gets its power from the Vcc line via diode D1 and pin 10 (Vccci). When the PC directs the USB protocol controller inside IC3 to resume normal operation, its power manage- 1 ment circuitry pulls pin 28 high again. REG1 then switches its output voltage (Vcc) back on again, thus restoring normal operation. At this stage, you may be wondering how the protocol controller, SIE, USB transceiver and master clock oscillator inside IC3 are able to respond to any directions from the PC after it has entered suspend mode (ie, when REG1 has turned off the power). The secret June 2011  41 S M OTT O B © 2011 TOP 2 + 22 22 REG1 27k 13k 5819 IC3 PCM2902 + D1 2.2 100nF REG103 3 1 150nF 4 10nF 110 33k 15k 8.2k 10 F IEC Code 1u0 470n 220n 150n 100n    10n    1n 820p   82p   47p   39p   22p EIA Code 105 474 224 154 104 103 102 821 82 47 39 22 1 F + 1 F 10 F 1 F 1 F + + 39pF 12.0MHz X1 1M 47pF + 1 F pin. As a result, it’s only these sections inside IC3 which “go to sleep” in suspend mode. Since these are the parts of the PCM2902 which draw the most current, they need to be shut down when the device enters suspend mode. The result of this power management system is that the total current drawn by the USB Stereo Recording & Playback Interface in suspend mode is less than 220µA; much lower than the 60-70mA drawn in operating mode. This means that it comfortably meets the appropriate USB specification – that all USB devices must be capable of entering a suspend mode, where they must draw no more than 2.5mA from the USB power line. + 1 F 1 F EARTH WIRE CONNECTS TO SCREEN LUGS OF CON1 & CON3 Fig.3: follow this diagram to install the parts on the PCB, starting with REG1 & IC3. The parts with blue outlines mount on the case lid and are connected via wire extension leads. Note that you can substitute 1μF monolithic ceramic capacitors for the 1μF tantalums shown on the overlay. here is that these sections inside the PCM2902 are all powered from the internal LDO which is fed with the +5V applied to its Vbus pin (pin 3) from pin 1 of CON9. This voltage is available all the time, as long as the device is connected µF Value 1µF 0.47µF 0.22µF 0.15µF 0.1µF 0.01µF 0.001µF    NA   NA   NA   NA   NA + 1.5k 8.2k 1 F 100 F 820pF 1 F IC4 MCP6024 15k 33k 100nF 100k 100k DGND (CON3) 100nF 82pF 1nF 100nF 1 1 F 1nF 15k 33k R MIC IN 22pF 2 100k 100k 100k 1102 © 1 107106111 160170 S 470nF USB TYPE B 1 F 220 1nF AGND (CON1) 470nF 100k 1 47pF 3 22pF 100k L MIC IN 2 + 10 F 10k 10k 10k 10k 470nF 3 100k 470nF 22pF 47pF 1 F 82pF 82pF 100 100 100 100 10k VR1 IN + 100nF 10k 10k 10 F 22pF 10k OUT L 100k 10k + E 820pF 100 8.2k IC2 MCP6024 100nF 10k 82p 10k IC1 MCP6024 33k 820pF 100 8.2k 100k 220nF 10k 150k L 150k 1nF 15k R Value 1µF 470nF 220nF 150nF 100nF 10nF 1nF 820pF 82pF 47pF 39pF 22pF CON9 220k E 100k 100k R 220nF 100nF S1 220k MIC/LINE E Table 2: Capacitor Codes SPDIF IN/OUT CON5&6 TO HOST 820pF CON7&8 2.7k LINE OUTPUTS CON2&4 2.7k LINE INPUTS to a PC host via a USB cable. Hence these sections inside the PCM2902 are always able to respond to commands from the PC. The rest of the circuitry inside IC3 (eg, the ADCs and DACs) is powered from the Vcc line via D1 and the Vccci Building it All parts except for switch S1, po- Table 1: Resistor Colour Codes o o o o o o o o o o o o o o o o o o No.   1   2   2   12   4   1   4   1   12   4   2   1   1   1   6   2   1 42  Silicon Chip Value 1MΩ 220kΩ 150kΩ 100kΩ 33kΩ 27kΩ 15kΩ 13kΩ 10kΩ 8.2kΩ 2.7kΩ 1.5kΩ 220Ω 110Ω 100Ω 22Ω 2.2Ω 4-Band Code (1%) brown black green brown red red yellow brown brown green yellow brown brown black yellow brown orange orange orange brown red violet orange brown brown green orange brown brown orange orange brown brown black orange brown grey red red brown red violet red brown brown green red brown red red brown brown brown brown brown brown brown black brown brown red red black brown red red gold brown 5-Band Code (1%) brown black black yellow brown red red black orange brown brown green black orange brown brown black black orange brown orange orange black red brown red violet black red brown brown green black red brown brown orange black red brown brown black black red brown grey red black brown brown red violet black brown brown brown green black brown brown red red black black brown brown brown black black brown brown black black black brown red red black gold brown red red black silver brown siliconchip.com.au CON9 2 REG1 27k 13k 5819 + D1 IC3 PCM2902 tentiometer VR1 (microphone gain) and the two XLR mic input sockets (CON1 & CON3) are mounted on a double-sided PCB coded 07106111. This is housed in a standard diecast aluminium box measuring 119 x 94 x 57mm. Fig.3 shows the parts layout on the PCB. Begin by checking the board for any defects (especially around IC3 & REG1), then test fit the RCA sockets to make sure their mounting holes are the correct sizes. Check also that the corner cut-outs have been made. Once that’s done, start the assembly by installing the two SMDs (IC3 & REG1). IC3 (PCM2902) comes in an SSOP-28 package, while REG1 comes in a 5-pin SOT223 package. As shown in Figs.3 & 4, both devices are mounted on the top of the board. It’s important to use a soldering iron with a very fine tip to install these two devices. You also need some finegauge resin-cored solder and some solder wick. A magnifying lamp or magnifying glass will also be handy. REG1’s pins are more widely spaced than IC3, so install it first. Start by carefully positioning the device accurately siliconchip.com.au over the pads on the board, then lightly tack solder one of its outside pins. Adjust its position if necessary, then solder the remaining pins. Note that you also have to solder its heatsink tab (opposite the pins) to the matching rectangular pad on the PCB. IC3 is a bit trickier to install but the procedure is similar. Make sure it is orientated correctly, with the dimple in the “pin 1” corner at upper right, then lightly “clamp” it into place using a pair of self-closing tweezers. Check that it is accurately positioned, then place a tiny drop of solder on the tip of your iron and just touch the tip to the end of pin 1, so that the solder flows down and “tacks” the pin to the PCB pad. Now do the same for pin 15 which is diagonally opposite, at the lower left corner of the device. These two “tacked” pins will now hold the device in place while you solder the remaining pins. Use a minimum of solder for each pin but don’t worry if you make a few inadvertent solder bridges between the tracks or adjacent pins. Once you’ve soldered all 28 pins, use a magnifying glass to check for 1.5k + 1 F 10 F + + 10 F + 1 F This view shows the completed PCB. Note that male XLR connectors are shown here but ideally they should be female, in line with the usual convention. Female XLRs can be fitted to the front panel and the connections between pins 3 and 1 of each connector swapped over between the connector’s rear lugs and the pads on the PCB. Instead of passing straight down, short lengths of insulated hookup wire can be used to make these connections, thereby ensuring there will be no accidental shorts. REG103 22 22 + 2.2 8.2k 100nF 1nF 820pF 33k 15k 100nF 82pF 3 1 150nF 1 F 220 4 10nF 110 USB TYPE B 12.0MHz X1 1M + 1 F + 39pF 47pF 1 F 1 F Fig.4: this enlarged section of the PCB shows the mounting details for REG1 & IC3. Use a fine-tipped iron to solder their pins (see text). solder bridges. If you do find any, they are quite easy to remove using a narrow strip (ie, 2mm wide) of desoldering braid or solder wick. The trick is to place the braid directly over the bridged pins (or tracks), then press the braid firmly down onto the pins using the tip of your iron for a couple of seconds. The braid then not only heats up the pins but also “sucks up” and removes the solder bridge as well. In practice, you’ll find that this is much easier to do than it sounds, especially if the PCB has a solder mask. Once you’ve finished, check all the pins again with a magnifying glass, just to make sure. It will be harder to remove any remaining problems later when the adjacent parts are in place. The “through-hole” parts can now be installed on the PCB starting with the single wire link and the resistors. Check each resistor using a digital multimeter before soldering it into place on the PCB, then fit diode D1 June 2011  43 1 9.5 9.5 23.5 A 10 9.5 14.5 11.5 A A 12.5 7 C C C 7 21 19.5 B B 12.5 B HOLE E: 6.5mm DIAM. HOLE F: 7.0mm DIAM. HOLES A: 11.0mm DIAM. HOLES B: 12.0mm DIAM. CL HOLES G: 24mm DIAM. HOLES C: 3.5mm DIAM. HOLES D: 3.0mm DIAM. ALL DIMENSIONS IN MILLIMETRES 29.7 49.25 21.5 The PCB is a neat fit inside the case. In practice though, it’s first attach­ed to the lid before the entire assembly is dropped into place. Note our comments on P43 about using female XLR connectors. D D E 28.5 17 F 4.5 D 17.5 9 D CL 9 Drilling the case 13 8 25 31 G G D 12.25 D 9 D D 9 (LID OF BOX BECOMES FRONT PANEL) Fig.5: this is the drilling template for the case. Start each hole with a small pilot drill to ensure accuracy and use a tapered reamer to enlarge the holes for the RCA sockets (A & B). The two holes for the XLR sockets (G) can be made by drilling a series of small holes around the inside diameters, knocking out the centre pieces and filing for a smooth finish. (watch its orientation) and the 14-pin DIL sockets for IC1, IC2 & IC4. Follow with the low-value ceramic and MKT capacitors, then install the electrolytic and tantalum capacitors. The electrolytics and tantalums are all polarised, so be sure to fit them with correct orientation as shown on Fig.3. Note that both the circuit and overlay depict the use of six 1μF tantalum capacitors. Alternatively, you can substitute 1μF monolithic ceramic capacitors (see parts list). The 12MHz crystal (X1) is next on the list and this goes in just below IC3. It should be fitted with a thin insulat44  Silicon Chip and the USB type B socket. Make sure that the ICs are correctly orientated. ing washer underneath it, so that its metal case cannot make contact with any of the nearby copper tracks on the top of the board (it’s a good idea to fit this even if the PCB has a solder mask). This insulating washer can be made from a small rectangle of clear plastic film, with two small holes punched in it 5mm apart to allow X1’s pins to pass through. Alternatively, you can mount the crystal so that its case is slightly proud of the PCB. The PCB assembly can now be completed by plugging in the three ICs and fitting the three double-RCA sockets If you build this project from a kit, the box and its lid may be supplied pre-drilled and the lid may also come with a screen-printed front panel. If not, then you’ll have to drill and cut the holes in the case yourself. Fig.5 shows the drilling details. Note that holes “B” in the rear panel for the “upper” RCA sockets are 12mm diameter, while holes “A” for the “lower” sockets are 11mm diameter. The reason for this difference is that the larger “B” holes allow easier entry of the lid/PCB assembly into the box, during final assembly. Having drilled, cut and de-burred all of the holes, the next step is to fit the front panel to give the unit a professional finish. Fig.6 shows the front-panel artwork and you can either copy this or download the panel in PDF format from the SILICON CHIP website and print it out. The panel can then be laminated and attached to the lid using double-sided tape. Once it’s in position, cut out the holes using a sharp hobby knife. Final assembly Now for the final assembly. The first step is to fit switch S1, potentiometer VR1 and the two XLR sockets to siliconchip.com.au LINE OUTPUTS LINE INPUTS USB TO HOST S/PDIF IN S/PDIF OUT MICS RECORDING SOURCE SELECT LINE MICROPHONE GAIN LEFT MIC INPUT USB STEREO RECORDING/ PLAYBACK INTERFACE RIGHT MIC INPUT SILICON CHIP Fig.6: this full-size front panel artwork can be copied or you can download it in PDF format from the SILICON CHIP website and print it out. siliconchip.com.au M3 x 20mm SCREWS ATTACH 10mm SPACERS TO LID, ALSO PASS THROUGH THESE SPACERS TO ATTACH 25mm SPACERS BOX LID (FRONT PANEL) (VR1) (S1) S1 the lid assembly. Cut the pot shaft to about 10mm long before fastening it in position. The switch and pot are secured using the supplied nuts, while the XLR sockets are each held in place using a two M3 x 10mm machine screws, star lockwashers and nuts. The next step is to fit extension leads to the terminals of both S1 & VR1. These leads are run using 0.7mm tinned copper wire and should be about 25mm long for S1 and about 35mm long for VR1. That done, sleeve the extension wires with either 1.5mm heatshrink tubing or 2mm varnished cambric tubing. The sleeves for the leads from S1 should be about 18mm long, while those for VR1’s leads should be about 28mm long. The three main connection spigots on the rear of XLR sockets CON1 & CON3 are fitted with similar extension leads. These need to be only about 12mm long, as the sockets extend downwards much further than the switch and pot terminals. They also don’t need any insulating sleeves, as there will be only about 4mm free above the PCB when it is subsequently mounted on the lid. Fig.7 shows how the assembly goes together. Before mounting the board in place, you need to fit four 35mmlong spacers to the holes near the corners of the lid. These spacers are 10mm SPACERS (CON3) 25mm SPACERS SLEEVES ON POT & SWITCH WIRES (CON9) CON5 AND CON6 (PCB) M3 x 6mm SCREWS ATTACH PCB TO 25mm SPACERS NOTE: SMALL COMPONENTS ON PCB OMITTED FOR CLARITY Fig.7: here’s how the assembly fits inside the case. Six wire extensions are required for VR1, six for switch S1 and three each for the XLR sockets. June 2011  45 Parts List 1 double-sided PCB, code 07106111, 109 x 84mm 1 diecast metal box, 119 x 94 x 57mm (Jaycar HB-5064) 1 mini DPDT panel-mount toggle switch (S1) 1 10kΩ 16mm dual pot. (VR1) 1 knob to suit 2 female XLR connectors, panelmount (Jaycar PP-1054, Altronics P 0804) 1 12.000MHz crystal, HC49/4H case (X1) 3 dual RCA sockets, PCB-mount (Jaycar PS-0280, Altronics P 0212) 1 type-B USB socket, PC-mount (Jaycar PS-0920, Altronics P 1304) 3 14-pin DIL IC sockets 4 M3 x 25mm tapped metal spacers 4 M3 x 10mm tapped metal spacers 4 M3 x 20mm machine screws, Phillips head made up using M3 x 25mm and M3 x 10mm tapped metal spacers which are stacked together and secured using M3 x 20mm machine screws. As shown, the screws go through the front panel and initially secure the 10mm spacers in place. The 25mm spacers are then wound on over the protruding ends of the screws. Once the spacers are in position, you’re ready to attach the PCB to the lid. It will be necessary to dress 4 M3 x 10mm machine screws, Phillips head 4 M3 x 6mm machine screws, Phillips head 4 M3 hex nuts 4 M3 star lockwashers 3 4G x 9mm self-tapping screws 1 600mm length of 0.7mm tinned copper wire 1 330mm length of 1.5mm heatshrink tubing 1 200mm length of insulated hook-up wire Semiconductors 3 MCP6024-I/P quad op amps (IC1, IC2, IC4) (from Microchip Direct) 1 PCM2902 stereo audio CODEC (IC3) (from RS Components) 1 REG103GA-A adjustable voltage regulator (REG1) 1 1N5819 Schottky diode (D1) Capacitors 1 100µF 16V RB electrolytic 2 10µF 16V RB electrolytic the leads from S1, VR1 and the XLR sockets so that their ends align with their matching holes in the PCB. It also helps if the various leads have their ends trimmed to staggered lengths, so that they can be guided through in sequence. A pair of long-nose pliers can be used to help guide the leads through their respective holes. If this proves too awkward, remove S1 and potentiometer VR1 from the lid, 2 10µF 16V tantalum 6 1µF 25V monolithic ceramic or tantalum 6 1µF MKT polycarbonate 4 470nF MKT polycarbonate 2 220nF MKT polycarbonate 1 150nF MKT polycarbonate 7 100nF MKT polycarbonate 1 10nF MKT or greencap 4 1nF 50V NPO ceramic 4 820pF 50V NPO ceramic 4 82pF 50V NPO ceramic 3 47pF 50V NPO ceramic 1 39pF 50V NPO ceramic 4 22pF 50V NPO ceramic Resistors (0.25W 1%) 1 1MΩ 4 8.2kΩ 2 220kΩ 2 2.7kΩ 2 150kΩ 1 1.5kΩ 12 100kΩ 1 220Ω 4 33kΩ 1 110Ω 1 27kΩ 6 100Ω 4 15kΩ 2 22Ω 1 13kΩ 1 2.2Ω 12 10kΩ then slip their leads down through the PCB. The lid can then be introduced to the PCB, at the same time guiding the six XLR socket leads through their holes. Once it’s in position, secure the board using four M3 x 6mm machine screws, then slip the switch and pot back up through their mounting holes and do up their nuts. Finally, the leads from the XLR sockets, the pot and the switch can be soldered to the PCB pads and trimmed to length. Earth lead Fig.8: the USB Audio CODEC should become the default device when the USB Stereo Recording & Playback Interface is plugged in (Windows XP dialog boxes). 46  Silicon Chip There’s just one more wiring step to complete the front panel/PCB assembly. This is to fit an insulated “earthing” lead which connects from the PCB earth copper to the body/screen lugs of the XLR connectors. This in turn connects the PCB earth to the metal case when it’s all later screwed together. Fig.3 shows how to install this lead. It’s run using insulated hook-up wire and is connected to the PCB earth copper just to the right of CON9. It then runs across the board to the screen lug of CON3 and then to the screen lug of CON1. That done, the PCB/front panel assembly can be completed by fitting siliconchip.com.au Fig.9: here’s how the interface appears in the “Sound” dialog box (launched via Control Panel) under Windows 7. Fig.10: the USB Audio CODEC should also appear in Device Manager under “Sound, video and game controllers”. the mic gain pot (VR1) with its control knob. The final step in building the project is to slip the PCB/front panel assembly down into the box. This is done by tilting it at an angle so that the RCA connectors can enter their clearance holes in the back of the box. This then allows you to swing down the front of the assembly and lower it all the way into the box. That done, fasten the lid to the box using the four M4 countersink-head screws supplied and use three 4G x 9mm self-tapping screws to secure the three dual RCA sockets to the rear of the case. These self-tapping screws pass through the “C” holes on the rear siliconchip.com.au Fig.11: this scope grab compares the S/PDIF digital audio output from the interface (yellow trace) with the analog audio output waveform (blue trace), when a WAV file is being played back. The timebase here has been slowed down to show the audio waveform clearly. Fig.12: this second scope grab shows the same S/PDIF digital output (yellow) and the analog audio output (blue) but with a much faster timebase speed so you can see the S/PDIF waveform. At this speed the analog waveform appears to be an almost flat horizontal line. panel and ensure that the RCA sockets are not pushed back inside the case when the cables are attached. Don’t over-tighten these screws, otherwise you’ll strip the holes in the plastic bodies of the RCA sockets. Installation & testing Testing involves little more than connecting the unit to a spare USB port on a PC running Windows XP (Service Pack 3), Windows Vista or Windows 7. Alternatively, you can connect it to a spare downstream port on an external USB hub that’s connected to the PC. After a few seconds, you should hear a greeting from the PC’s sound system to indicate that the operating system has recognised that a new Plug and Play USB device has been connected. It then shows pop-ups from the System Tray as it identifies the device and automatically installs the standard USB audio drivers for it. The next step is to check that this has all taken place correctly. In Windows XP, click the Windows Start button, launch the Control Panel and double-click on “Sounds and Audio Devices”. This should bring up the Sounds and Audio Devices Properties dialog. If you then click on the “Audio” tab, you should see “USB Audio CODEC” listed in the drop-down device selection lists for both Sound Playback and Sound Recording (Fig.8). This June 2011  47 Fig.13: Audacity is an excellent freeware program for recording and editing audio files, with versions available for Windows, Apple Macs and Linux systems (from audacity.sourceforge.net). should also be the case if you click on the “Voice” tab. Now click on the “Hardware” tab and select “USB Audio Device”. You should see the following information in the Device Properties area: Manufacturer: (Generic USB Audio) Location: Location 0 (USB Audio CODEC) Device Status: This device is working properly. If you are using Windows 7, launch the Control Panel and double-click on the “Sounds” icon. This brings up the dialog box shown in Fig.9 and you should see that the “USB Audio CODEC” has been installed as the default device. You can also check the device has been correctly installed in Device Manager. Launch Device Manager from Control Panel, then expand the “Sound, video and game controllers” entry and check that “USB Audio CODEC” is listed – see Fig.10. This applies to both Windows XP and Windows 7 (and Vista). lists under both the Audio and Voice tabs of the Sounds and Audio Devices Properties dialog (Windows XP). You can also use the Volume tab to adjust the replay volume and to get Windows to provide a volume control icon in the system tray at the end of the taskbar. Your new USB Stereo Recorder & Playback Interface will now be the default device on your PC for both audio recording and playback. And because it’s fully compatible with all the standard audio drivers built into Windows XP/SP3 and later operating systems, you’ll be able to use it with virtually any of the popular audio recording, editing and playback applications. Even if you don’t have such a suita- Using it Using the unit with your PC for audio recording and playback is straightforward. The first step is to select it as the “Default device” in the drop-down 48  Silicon Chip Fig.14: you can exit the VIA HD Audio Deck applet by right-clicking its icon in the System Tray. ble application installed on your PC at present, there are quite a few available for free downloading on the web. One I can recommend is Audacity which can be downloaded from the Audacity website at audacity.sourceforge. net The current version for Windows XP/SP3 is V1.2.6 but there’s also a beta V1.3.13 that’s described as “the best version for Windows 7 and Vista”. There are also versions for Apple Macs and Linux systems. Via shutdown error Finally, note that with this device connected, you may get a shut-down error on machines with Via sound systems which automatically launch the Via Audio HD Deck applet. You can prevent this by closing this applet before shutting down – just right-click the Via HD Audio Deck icon in the System Tray and click “Exit” (Fig.14). Another option is to prevent the Via HD Audio Deck applet from automatically starting when the PC is booted. That’s done by clicking Start, typing in msconfig, selecting the Startup tab and clearing the relevant check box. Or you can simply ignore the shut-down error and click OK to close the applet SC and force a shut-down. siliconchip.com.au