Silicon ChipA PIC-Based Musical Tuning Aid - July 2008 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Now is the time for Australia to build nuclear power stations
  4. Feature: House Wiring: Looking At Light Switches by Ross Tester
  5. Review: Agilent MSO7034A Mixed Signal Oscilloscope by Mauro Grassi
  6. Project: DSP Musicolour Light Show; Pt.2 by Mauro Grassi
  7. Feature: Drumroll – Yet Another PICAXE by Stan Swan
  8. Project: A PIC-Based Musical Tuning Aid by Jim Rowe
  9. Project: Balanced Mic Preamp For PCs & MP3 Players by John Clarke
  10. Project: Bridge Adaptor For Stereo Power Amplifiers by Leo Simpson
  11. Vintage Radio: The Astor KM 4-Valve Reflexed Receiver by Rodney Champness
  12. Advertising Index
  13. Book Store
  14. Outer Back Cover

This is only a preview of the July 2008 issue of Silicon Chip.

You can view 30 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 "DSP Musicolour Light Show; Pt.2":
  • dsPIC30F4011-30I/P programmed for the DSP Musicolour [1010708A.HEX] (Programmed Microcontroller, AUD $20.00)
  • dsPIC30F4011 firmware and source code for the DSP Musicolour [1010708A.HEX] (Software, Free)
  • DSP Musicolour User Manual (PDF download) (Software, Free)
  • DSP Musicolour Infrared Remote Control PCB pattern (PDF download) [10107083] (Free)
  • DSP Musicolour main PCB pattern (PDF download) [10107081] (Free)
  • DSP Musicolour display PCB pattern (PDF download) [10107082] (Free)
  • DSP Musicolour front & rear panel artwork (PDF download) (Free)
Articles in this series:
  • DSP Musicolour Light Show (June 2008)
  • DSP Musicolour Light Show (June 2008)
  • DSP Musicolour Light Show; Pt.2 (July 2008)
  • DSP Musicolour Light Show; Pt.2 (July 2008)
  • DSP Musicolour Light Show; Pt.3 (August 2008)
  • DSP Musicolour Light Show; Pt.3 (August 2008)
  • DSP Musicolour Light Show; Pt.4 (September 2008)
  • DSP Musicolour Light Show; Pt.4 (September 2008)
Items relevant to "A PIC-Based Musical Tuning Aid":
  • PIC-based Musical Tuning Aid PCB [04107081] (AUD $7.50)
  • PIC16F877A-I/P programmed for the Musical Instrument Tuning Aid [0410708A.HEX] (Programmed Microcontroller, AUD $20.00)
  • PIC16F628A firmware and source code for the Musical Instrument Tuning Aid [0410708A.HEX] (Software, Free)
  • PIC-based Musical Tuning Aid PCB pattern (PDF download) [04107081] (Free)
  • Musical Tuning Aid front panel artwork (PDF download) (Free)
Items relevant to "Balanced Mic Preamp For PCs & MP3 Players":
  • Balanced Microphone Preamp PCB [01107081] (AUD $10.00)
  • Balanced Microphone Preamplifier PCB pattern (PDF download) [01107081] (Free)
  • Balanced Microphone Preamp front panel artwork (PDF download) (Free)
Items relevant to "Bridge Adaptor For Stereo Power Amplifiers":
  • Balanced/Unbalanced Converter PCB [01106081] (AUD $5.00)
  • Unbalanced to Balanced Converter PCB pattern (PDF download) [01106082] (Free)
  • Balanced-Unbalanced Converter PCB pattern (PDF download) [01106081] (Free)

Purchase a printed copy of this issue for $10.00.

A PIC-based Musical Tuning Aid By JIM ROWE This compact device will help you tune almost any musical instrument – acoustic or electronic. It can produce any note on the tempered musical scale (standard pitch) in any of the eight most commonly used octaves, with an accuracy of better than ±0.08% or 1.3 musical cents. The selected note is compared with that from the instrument either by ear or visually by using an eight-LED stroboscopic beat indicator. A FEW GIFTED individuals have “perfect pitch” which allows them to recognise by ear when the note of a musical instrument is accurately tuned (within 1 musical cent, or 1/100th of a semitone). However, the vast majority, including many musicians, simply don’t have this ability or anything like it. For most of us, the only way of tuning an instrument is by 58  Silicon Chip comparing its notes with those from tuning forks or some other source of accurately known sound frequencies. Until about 1970, tuning forks were really the only option. The standard method was to use a single tuning fork at one standard note frequency or “pitch” (usually A = 440.00Hz). The corresponding note of the instrument was first tuned against this frequency, then the other notes of the octave were tuned against this note using the technique of “beats” or heterodynes. This technique involved tuning each note high or low until the audible difference frequency between one of its harmonics and a harmonic of the reference note was correct (for that particular note). Once the notes in the middle octave had been tuned siliconchip.com.au NOTE INDICATOR LEDS1–13 FREQUENCY REFERENCE (16MHz) LINE LEVEL OUTPUT OCTAVE INDICATOR LEDS14–21 VOLUME ADJUST 5-BIT R-2R RESISTOR DIGITAL TO ANALOG CONVERTER PIC16F877A MICROCONTROLLER (IC1) AUDIO AMPLIFIER (IC2) BUILT-IN SPEAKER OCTAL COUNTER (IC4) S2 DOWN S1 UP S4 DOWN NOTE SELECT S3 UP OCTAVE SELECT LED22  RING OF 8 LEDS  LED29 Q1 SWITCH SQUARER (A = 101) AMPLIFIER (IC3a) (IC3b) INPUT FROM MIC OR INSTRUMENT Fig.1: block diagram of the Musical Instrument Tuning Aid. It’s based on a PIC microcontroller (IC1) and a 16MHz crystal frequency reference. The PIC divides down the frequency reference and drives a 5-bit DAC (digital-to-analog converter). This in turn feeds audio amplifier IC2 to deliver the selected tone (set by switches S1-S4). IC3a, IC3b, IC4 and LEDs 22-29 form a simple stroboscope beat indicator, to enable precise “visual” tuning. in this way, the corresponding notes in the other octaves could be tuned against them by adjusting for a zero beat. It was a pretty tedious business and required plenty of patience, as well as a good ear. Instrument tuning became a lot easier in the 1970s when electronic musical tuning aids appeared. In most cases, these aids were based on special ICs known as “top octave synthesiser” or TOS chips, which had been developed mainly for the second generation of electronic organs. Inside a TOS chip were 12 or 13 digital frequency dividers, each of which produced one note of the top octave for the organ by dividing down from a shared crystal oscillator (usually around 2MHz). So by combining a TOS chip with a multi-stage binary divider, it was quite easy to produce a device which could generate virtually any note in any octave, all accurate enough to be used as a tuning reference. As well as becoming available commercially, a number of these TOS-chip-based tuning devices were described for hobbyist construction in the 1980s. These were very popular because they were much cheaper than the commercial units. However, manufacturers stopped making TOS chips when electronic organ makers didn’t need them any more, because they had changed over to designs based on siliconchip.com.au microcontrollers, digital samplers and VLSI devices. PIC micro With TOS chips no longer available, the easiest way to produce a musical tuning aid these days is to use a micro­ controller. And that’s exactly what we’ve done in designing the project described here. Based on a readily available PIC micro, the “Musical Instrument Tuning Aid” can produce any note of the tempered musical scale at standard pitch (A = 440.00Hz) and spans the eight most commonly used octaves. All notes are derived from a single crystal oscillator (nominal frequency 16.000MHz) and the frequency accuracy is better than ±0.08% (in fact, much better in many cases). Since ±0.08% corresponds to about ±1.3 cents, this means that the tuning should be accurate enough even for those with perfect pitch. The reference notes produced by the unit can be easily used for instrument tuning by ear, because they are fed to an inbuilt amplifier and speaker. In addition, there’s a simple “ring of LEDs” stroboscope which allows you to tune for zero beats by eye. To do this, the instrument’s note is fed into the unit – either directly or via a microphone – and the instrument’s tuning adjusted until the rotating pattern on the LEDs slows down and stops. When the LEDs stop, the instrument is correctly tuned to that note. The note frequency produced by the Tuning Aid is set using four pushbuttons on the front panel. Two pushbuttons step the selected octave up or down, while another two pushbuttons select the note. In addition, the front panel carries a power on/off switch, plus a screwdriver-access hole to allow an on-board volume trimpot to be adjusted. Power for the unit comes from either an internal 9V battery or an external 9-12V DC supply such as a car battery or mains plugpack. The circuit is assembled onto a single PC board and is housed together with a 57mm speaker and its battery in a small UB1 jiffy box. How it works Refer now to Fig.1 which shows the block diagram of the Tuning Aid. It’s based on a PIC 16F877A 8-bit microcontroller which does most of the work. The PIC’s clock oscillator uses a 16.000MHz crystal, which also serves the reference frequency. The main job done by the PIC is to generate the desired top octave frequency for whichever note you select, by dividing down from the 16MHz clock. The notes are selected very easily and simply by using pushbutJuly 2008  59 Table 1: The 104 Note Frequencies Produced By The Tuning Aid (Hz) NOTE OCTAVE 1 OCTAVE 2 OCTAVE 3 OCTAVE 4 OCTAVE 5 OCTAVE 6 OCTAVE 7 OCTAVE 8 ERROR* C 32.688 65.376 130.751 261.502 523.004 1046.008 2092.016 4184.032 –0.0473% C# 34.645 69.289 138.579 277.157 554.314 1108.628 2217.256 4434.512 –0.0093% D 36.680 73.360 146.721 293.442 586.884 1173.768 2347.537 4695.074 –0.0758% D# 38.867 77.735 155.470 310.939 621.880 1243.760 2487.519 4975.038 –0.0601% (the third harmonic) will be audible for most adults. This is especially true for the top octave. Visual tuning So that’s how we generate the main reference note 329.809 659.619 1319.238 2638.476 41.226 82.452 164.905 5276.952 E –0.0521% outputs of the new tuning 2793.246 43.644 87.289 174.577 349.156 698.311 1396.623 5586.491 F –0.0207% aid, which are used for tuning instruments by ear. 2958.528 5917.056 46.227 92.454 184.908 369.816 739.632 1479.264 F# –0.0482% Now let’s look at the method G –0.0389% 48.980 195.921 391.843 783.685 1567.371 6269.483 97.960 3134.742 used to allow visual tuning, 51.909 103.819 207.638 415.275 830.550 1661.100 3322.200 6644.400 G# –0.0072% using the “ring of LEDs” 440.133 880.266 55.017 110.033 220.066 1760.533 3521.065 7042.131 A +0.0303% stroboscope. 233.205 1865.639 58.301 116.602 466.409 932.819 3731.278 A# +0.0527% 7462.555 The stroboscope is very simple, consisting mainly of 494.063 988.126 1976.251 3952.502 +0.0363% 61.758 123.516 247.031 7905.005 B eight LEDs connected to the C' 2092.012 8368.048 65.375 261.502 523.003 –0.0474% 1046.006 4184.024 130.751 outputs of an octal (times-8) *Compared with the notes of the tempered musical scale, at standard pitch (A4 = 440.000Hz). All frequencies are with PIC clock oscillator = 15.9992MHz. counter (IC4). The counter’s clock input is driven by an tons S1 (UP) and S2 (DOWN), with the On the other hand, if the PIC reads output from the PIC, which provides selected note shown clearly by one of out every second waveform sample, pulses at a frequency which is a binary LEDs1-13 (red). it will take only 128 top octave note multiple of the main note output for The octave for the desired note is pulses to generate a single period of the octave concerned. As a result the selected in very similar fashion, using the output note waveform. This will counter’s outputs cyclically pulse high pushbuttons S3 (UP) and S4 (DOWN). therefore give the correct division ratio in sequence, in step with the main In this case, the selected octave is in- to produce the second-octave equiva- note output. dicated by LEDs14-21 (green). lent of the selected note. Because the eight LEDs are conInside the PIC, the selected top ocSimilarly, if it reads out every fourth nected to the counter outputs, this tave note frequency is divided down waveform sample, it will take only means they can turn on in sequence to produce the corresponding note 64 top octave pulses to produce one as the outputs pulse high, provided in the selected octave. This division period of the output note waveform that transistor Q1 is also on. This is done in a novel way, as part of the – giving the correct division ratio for transistor is turned on and off using method used to shape the unit’s main the third-octave note equivalent, and the audio signal from the musical note output into a reasonable approxi- so on. instrument, to control which LED is mation of a sinewave (at least for the This is how the frequency division lit at any instant. lower octaves). This involves using needed to produce the notes in each As shown on Fig.1, the signal from the PIC micro to drive a simple DAC octave is combined with the “sample the musical instrument is first fed (digital-to-analog converter) based on playback” method of producing the through amplifier stage IC3b which an R/2R resistor ladder, with five bits output note waveform. This works operates with a gain of about 101 of resolution. quite well, producing a good 5-bit times. It is then fed through a “squarer” The idea here is that the PIC’s approximation of a cosine waveform stage based on IC3a, emerging as a very EPROM memory stores a set of 256 for all notes in the four lowest oc- clean square wave. This is then used to 5-bit samples, corresponding to a sin- taves. The only catch is that the note turn Q1 on and off, with the net result gle period of a cosine waveform. The waveform becomes more “steppy” that Q1 is turned on for the positive PIC reads out these samples from the for the highest octaves, where the half cycles and off for the negative memory and feeds them in sequence resolution inevitably drops because half cycles of the instrument’s note to the DAC, to produce the output note we must step through the samples in waveform. waveform. This is then fed through larger “jumps”. So that’s how the stroboscope works. volume trimpot VR1 to audio ampliAs a result, in the fifth octave, the As Q1 turns on and off, it (and the fier IC2 which then drives the speaker. output waveforms have only 4-bit octal counter) turns the LEDs on and Now if the PIC reads out the wave- resolution, while in the sixth octave off as well. form samples in one-by-one order, it they have only 3-bit resolution. And How does this produce a LED patwill take 256 of the top octave note in the very top octave they have only tern that’s useful for tuning? Well, pulses to produce a single period of the single-bit resolution – ie, they become consider the situation where octal output note waveform. In other words, square waves. counter IC4 is fed with a clock signal there will be an effective frequency This diminishing waveform reso- that’s exactly eight times the frequency division of 256, or 28. lution isn’t really much of a prob- of the note to which we want to tune This happens to be exactly the lem though, because the effective the instrument. When the instrument right division ratio to produce the waveform distortion consists almost is tuned to a frequency close to that bottom-octave equivalent of the se- entirely of odd harmonics – and in note, Q1 will turn on for a period that’s lected note. many cases only the lowest of these long enough to allow four of the LEDs 60  Silicon Chip siliconchip.com.au siliconchip.com.au July 2008  61 K LED1  A   LED7 A A A A  K K K K A A A    A O8 LED21 O7 O6 O5 LED19 A A O3 O4 LED17 A O2 RD0 RB4 RB3 RB2 9 40 39 38 22 21 RE1 RB7 RB6 RB5 RD3 RD2 20 RD1 19 37 36 35 RB1 RB0 RD7 RD6 RD5 RD4 RC7 RC6 RC5 RC4 11,32 4 5 7 17 18 RE0 RE2 RA4 RA0 13 14 8 10 6 2 RA1 3 RA2 RA3 RA5 RC2 RC3 OSC1 12, 31 Vss 1 RC1 16 RC0 15 MCLR OSC2 IC1 PIC16F877A Vdd 33pF X1 16.0MHz 2.0k 2.0k 2.0k 2.0k 2.0k 2.2k DOWN 33pF 2.0k 1.0k 1.0k 1.0k 1.0k 13 14 15 S3 DOWN O5 O6 O7 O8 O9 1 5 6 9 11 +5V 8 O5-9 12 O0 O1 O2 O3 3 2 4 7 IC4 4017B O4 10 16 Vdd A S4 4x 4.7k OCTAVE SELECT UP CP1 Vss CP0 MR S2 100 F NOTE SELECT UP S1 2x 100nF MUSICAL INSTRUMENT TUNING AID     O1 C' B A# 34 A LED15 A 33 30 29 28 27 26 25 24 23 G# G F# F E D# D C# C LED22     K Q1 PN100    E C COM LED29  K A 100nF IN IN 47k B 180 4.7k 100 F 16V 33nF OUT 78L05 GND OUT REG1 78L05 1 10M 10k 2.2k 220 4 IC3a 2 3 7 +8.1–11.1V 2 3 1nF IC3: LM358 2.2M 10k VOLUME TANT VR1 1 F +8.3–11.3V 470 F 16V S5 ON/OFF 4 1M 1 6 5 A 5 220nF C E PN100 B K A LEDS CON3 MIC/INSTR INPUT SPEAKER 8 47nF 220k 1k 9-12V DC INPUT CON2 LINE AUDIO OUT CON1 330 F 10 220k 10 F 7 8 33nF 22 F 16V K 1N4004 TANT 1 F 10k IC3b 8 6 22k 9V BATTERY A IC2 LM386N K D1 1N4004 Fig.2: the complete circuit diagram. PIC micro IC1 monitors switches S1-S4, divides down the 16MHz crystal accordingly and drives LEDs1-21 which indicate the note and octave selected. IC1’s RA0-RA3 & RA5 outputs also drive a resistive ladder network which forms the 5-bit DAC. IC4 is wired as an octal counter and is driven by IC1’s RE0 output. This counter, in company with op amp stages IC3b & IC3a and LEDs22-29, makes up the zero beat indicator circuit. 2008 SC  470 K LED20 K LED18 K A LED14  A LED16 K  LED12  ALED11 LED13 470 K K K LED9 LED8 K  A LED10 A K  K  A   LED6 K K LED5 LED4 K  A K LED3 LED2 K  A K +5V 10 F 470 F 78L05 IC4 4017B LED25 LED26 1 330 F 8  SPKR CON3 LED27 O3 O4 O2 O6 O5 O7 O8 LED14 LED15 LED16 LED17 LED18 LED19 LED20 LED21 Q1 PN100 + S1 UP DOWN NOTE SELECT S4 S3 10M DIA G NI NUT CISU M S2 LED22 + 1 F 1M IC3 LM358 1 1nF 9V BATTERY + – 220nF + CON1 S5 4004 O1 LED8 LED10 LED12 LED13 220k LED6 10k LED5 LED29 180 100 F 220k LED1 LED3 LED23 C’ 10k 2.2k 2.2M F F# G G# A A# B 4.7k C C# D D# E LED28 LED24 LED9 LED11 S 470 100nF LED7 R 470 LED4 220 T LED2 MINI SPEAKER MIC/INSTR INPUT PIC 16F877A REG1 CON2 LINE OUT + D1 9-12V DC IC1 100nF 1 1 VR1 10k 1k + 100nF 1 F 22k 10 2.0k 2.0k 2.0k 2.0k 2.0k 2.2k IC2 18070140 8002 C 100 F 47nF 33nF VOLUME + 47k 1.0k 1.0k 1.0k 1.0k 2.0k LM386N 33pF 33pF X1 16MHz 4.7k 4.7k 4.7k 4.7k 33nF 9V BATTERY (CLIP LEAD) 22 F UP DOWN OCTAVE SELECT POWER Fig.3: follow this parts layout and wiring diagram to build the unit. Make sure that all polarised parts are correctly orientated and note particularly the orientation of switches S1-S4 (their flat sides go to the left). to light in sequence, ie, during the positive half cycles. Conversely, Q1 will be turned off for the rest of each note period (ie, during the negative half cycles). As a result, half the ring of LEDs will light and the other half will remain off. However, unless the instrument note is tuned to the exact note frequency, this “half on/half off” pattern will rotate either clockwise or anticlockwise, depending on whether the instrument note frequency is too high (sharp) or too low (flat). So all you need to do, to tune the instrument correctly, is to adjust its note up or down in frequency until the pattern rotation slows down and stops. By the way, the actual pattern displayed on the LEDs depends on the frequency ratio between the strobe counter’s clock pulses and the instrument note and this again varies over the octaves. However, the tuning procedure is always the same: the instrument note is adjusted until the pattern rotation slows down and stops. A stationary pattern indicates “zero beat” and correct tuning. Circuit details Refer now to Fig.2 for the circuit of the Musical Instrument Tuning Aid. It uses just four ICs and a handful of other parts. 62  Silicon Chip IC1 is a PIC 16F877A device, chosen because its 40-pin configuration allows very easy interfacing to the control buttons, LEDs and resistive ladder DAC. As shown, the 13 note indicator LEDs (LEDs1-13) are connected directly to I/O pins RC4-RC7, RD4-RD7 and RB0-RB4 and share a common 470W current limiting resistor. The eight octave indicator LEDs (LEDs14-21) are connected to outputs RD0-RD3, RB5-RB7 & RE1 in similar fashion. In addition, note select pushbuttons S1 & S2 are directly connected to I/O pins RC0 & RC1, together with 4.7kW pull-up resistors. Octave select buttons S3 & S4 are connected to RC2 & RC3 in the same way, while crystal X1 is connected between pins 13 & 14. The resistive ladder network acts as a 5-bit DAC to produce the tuning aid’s main note output waveform and is driven from pins RA0-RA3 and RA5 of the PIC. A 33nF capacitor is connected across the DAC output to provide a measure of low-pass filtering, after which the note signal is fed via a 47kW resistor and 1mF coupling capacitor to volume control trimpot VR1. From there, the signal is then fed to IC2, a standard LM386 low-power audio amplifier which drives an 8ohm mini speaker. Because the lowfrequency response of 57mm mini speakers is quite poor, the 33nF capacitor and 22kW resistor connected around IC2 are included to provide a small amount of bass boost to improve the audibility of notes in the lowest octave. The audio output signal from IC2 is also fed to line output socket CON2 via a 1kW isolating resistor. This allows the signal to be fed to an external amplifier if desired or alternatively, to a digital counter or scope if you want to check its frequency or use the signal for other kinds of testing. Octal counter IC4 is the counter for the LED stroboscope. This is a 4017B Johnson decade counter with its ninth output connected back to its reset input to configure it as an octal counter. LEDs22-29 are connected to outputs O0-O7, while the counter itself is fed strobe clock pulses from the RE0 pin of the PIC (IC1). The note signal from the instrument being tuned (or from a microphone picking up the sound) is fed into the circuit via CON3, a 3.5mm jack socket. It is then fed to op amp IC3b (LM358), which is wired with a gain of 101, as determined by its 1MW and 10kW feedback divider resistors. From there, the amplified signal at pin 7 is fed to IC3a, which is configsiliconchip.com.au This view shows the fully assembled PC board. Note that the switches are mounted in cut-down IC socket strips – see Fig.4. CUT-DOWN IC SOCKET STRIPS ured as a comparator with positive feedback, so it becomes a Schmitt trigger “squarer”. This stage converts the signal from IC3b into a clean square wave. This is then fed to the base of transistor Q1 via a 4.7kW resistor, to switch it (and the strobe LEDs) on and off. As stated earlier, power for the circuit comes from either an internal 9V battery or an external 9-12V DC supply (fed in via CON1). Diode D1 provides reverse polarity protection, while S5 is the on/off switch. REG1 provides a regulated +5V supply rail for IC1 & IC4, while IC2 runs directly from the unregulated input supply. IC3 runs from this same unregulated supply via a decoupling circuit consisting of a 220W resistor and a 100mF capacitor. Note that the battery is automatically disconnected from the circuit when an external supply is plugged into CON1. Construction Apart from the battery and mini speaker, all of the parts are mounted on a PC board coded 04107081 and measuring 147 x 84mm. This board has rounded cutouts in each corner so that it fits inside a standard UB1 size jiffy box. It is attached to the rear of the case lid via five M3 x 15mm tapped spacers. The three input/output connectors are all mounted at the righthand end of the board, while the LEDs, pushbutton switches S1-S4 and power switch S5 siliconchip.com.au all protrude through matching holes in the lid. Note that connectors CON1-CON3 all mount directly on the top of the PC board, as does switch S5. However, pushbuttons S1-S4 are not tall enough to mount directly on the board, and so must be plugged into spacer sockets made by cutting down a couple of 14pin DIL IC sockets (more on this later). Fig.3 shows the parts layout on the PC board. Here is the suggested order of assembly: (1) Fit the three wire links to the board, followed by the PC board terminal pins for the battery and speaker connections. These terminal pins should be fitted from the underside (copper side) of the board, because the wires to be soldered to them later are under the board. (2) Install connectors CON1, CON2 & CON3, then fit the sockets for IC1, IC3 & IC4, making sure you orientate each of these as shown in Fig.3 (to guide you later when it comes to plugging in the ICs). Note that a socket is not used for IC2; this is soldered directly to the board (later), to ensure stability. (3) Install the resistors, making sure that you fit each one in its correct position. Follow these with the volume trimpot (VR1). (4) Fit the disc ceramic, monolithic and MKT metallised polyester capacitors (these can go in either way around), then fit the tantalum and electrolytic capacitors. Note that the tantalums and electrolytics are all polarised, so be sure to fit them with the correct orientation. (5) Fit diode D1, regulator REG1, transistor Q1 and finally IC2. Be sure to install each of these with the orientation shown on the overlay diagram. (6) Now fit all of the LEDs. These are all fitted vertically, with the lower end of their bodies spaced 13mm above the board (so that they will just protrude through the holes in the box lid when the board is later mounted behind it). The easiest way to do this is to cut a strip of thick cardboard to a width of 13mm and then use this cardboard strip as a spacer between each LED’s leads while it is soldered into position. In practice, the cardboard strip can be left under each horizontal row of LEDs until they are all soldered in place and then withdrawn to be used for the next row of LEDs. It can also be used when you’re fitting the “ring of LEDs” (ie, LEDs22-29). (7) Next on the list are the spacer 14-PIN DIL IC SOCKET (PRESSED CLIPS) CUT CUT CUT CUT REMOVE CENTRE CLIP BY PUSHING UP FROM BELOW Fig.4: the socket strips for pushbutton switches S1-S4 are made by cutting eight 3-pin strips from two low-cost 14-pin IC sockets, then removing the centre pin from each strip. July 2008  63 SILICON CHIP Musical Instrument Tuning Aid C# D# F# G# VOLUME LINE OUTPUT MIC OR INSTRUMENT INPUT STROBE A# C D E F G A B C' 1 2 3 4 5 6 7 8 OCTAVE SELECT POWER 9-12V DC INPUT NOTE SELECT Fig.5: this full-size artwork can be copied and used as a drilling template for the front panel. socket strips for pushbutton switches S1-S4 (necessary to ensure they protrude through the matching holes in the box lid). These spacer strips are cut from low-cost 14-pin IC sockets. Fig.4 shows how these strips are prepared. Each switch is mounted on two 3-pin sections cut from one side of a 14-pin socket but with the centre pin of each section pushed out and discarded. Note that only the spacer strips are soldered to the PC board. The switches then later plug into them (8) Fit crystal X1, toggle switch S5 and the five M3 x 15mm tapped spacers which are used to attach the board assembly to the rear of the case lid. These spacers are attached to the board using M3 x 6mm pan-head screws and washers, while similar screws with countersink heads are used later to attach the spacers to the lid. (9) Complete the board assembly by plugging IC1, IC2, IC3, IC4 and the switches into their sockets. Be sure to orientate the ICs and the flat sides of the switches as shown in Fig.3. Preparing the box Unless you’re building the Music Tuning Aid from a kit, you will now need to prepare the case by drilling the required holes. A photocopy of the front panel artwork (Fig.5) can be used as a drilling Table 2: Resistor Colour Codes o o o o o o o o o o o o o o o o No.   1   1   1   2   1   1   2   5   2   6   5   2   1   1   1 64  Silicon Chip Value 10MW 2.2MW 1MW 220kW 47kW 22kW 10kW 4.7kW 2.2kW 2kW 1kW 470W 220W 180W 10W 4-Band Code (1%) brown black blue brown red red green brown brown black green brown red red yellow brown yellow violet orange brown red red orange brown brown black orange brown yellow violet red brown red red red brown red black red brown brown black red brown yellow violet brown brown red red brown brown brown grey brown brown brown black black brown 5-Band Code (1%) brown black black green brown red red black yellow brown brown black black yellow brown red red black orange brown yellow violet black red brown red red black red brown brown black black red brown yellow violet black brown brown red red black brown brown red black black brown brown brown black black brown brown yellow violet black black brown red red black black brown brown grey black black brown brown black black gold brown siliconchip.com.au 25 ew See revi’08 e n u in J HIP SILICON C 25 9 7 12 A C B ALTITUDE 3500-SS HOLES A & C: 10mm DIAMETER, HOLE B: 7.0mm DIAMETER (ALL DIMENSIONS IN MILLIMETRES) DETAILS OF HOLES IN END OF UB1 BOX, FOR CONNECTORS Fig.6: this diagram shows the drilling details for the righthand side panel. template for the lid. Alternatively, you can download and print out the artwork from the SILICON CHIP website (www.siliconchip.com.au). The holes for switches S1-S4 should be drilled or reamed to 10mm dia­ meter, while the hole for S5 should be 6.5mm in diameter. All of the holes for the LEDs should be 3.5mm, as should the adjustment hole for the volume trimpot. The spacer screw holes are also drilled 3.5mm but countersunk on the top. Another three holes are drilled in the righthand end of the box, to allow access to the three input-output connectors. The locations and diameters of these holes are shown in Fig.6. Finally, you will have to drill two 3mm holes in the bottom of the case for the battery clamp screws and a pattern of holes to allow the sound from the speaker to escape. In the latter case, it’s simply a matter of drilling an array of 5mm holes inside a guide circle 43mm in diameter. Position this guide circle centrally in the left half of the case bottom. Once these holes have been drilled and deburred, clamp the battery into position and glue the speaker in place. The U-shaped battery clamp can be made from a piece of scrap aluminium and is secured using two M3 x 6mm screw, nuts and lock washers. The speaker can be secured using five or six small dobs of epoxy cement around the rim of its frame. The case should then be placed aside for the epoxy cement to cure overnight. The final step in preparing the siliconchip.com.au Table 3: Capacitor Codes Value 220nF 100nF 47nF 33nF   1nF 33pF mF Code 0.22mF 0.1mF .047mF .033mF .001mF      NA IEC Code EIA Code 220n 224 100n 104   47n 473   33n 333    1n 102   33p   33 box lid is to fit the front-panel label. First, print out the artwork on an adhesive-backed label and then apply a rectangle of clear “Contac” or similar adhesive film to the front to protect it from scratches and finger grease, etc. The label is then trimmed to its correct size and the corner holes removed using a leather punch or sharp hobby knife, to provide a guide when you’re positioning it on the lid. Once it’s attached to the lid, the remaining holes can be cut out using either a sharp hobby knife or a hole punch (a hole punch will do a much neater job). Final assembly The PC board assembly can now be attached to the back of the lid and secured using M3 x 6mm countersink head screws. Make sure that all the LEDs and switches go through their mounting holes before doing up the screws. Note that one of switch S5’s nuts is removed before fitting the board and then refitted to the switch when the Valve Stereo HiFi Amplifier 32W/Channel, 4 or 8Ω “This particular valve amplifier performs very well” Leo Simpson SILICON CHIP June 2008 A blend of quality components and modern design Beautifully finished in 7mm brushed aluminium Four stereo analog inputs Gold plated connectors and selectors Extended bandwidth of 10Hz to 90kHz Carefully chosen design layout and wiring location Direct input coupling improves transient response Specialised wide-bandwidth audio output transformers Class A/B pentode output using genuine Russian-made Electro-Harmonix EL34 valves Matched pairs, factory bias adjusted Stainless steel heat shields improve overall efficiency High quality capacitors Beautiful in looks, design and listening The A3500-SS is an exclusive and advanced version developed by Stones Sound Studio. Retail price is just $1899, available now from ELECTRONIC SERVICES AUSTRALIA 138 Liverpool Rd, Ashfield NSW (Locked Bag 30, Ashfield NSW 2131) Ph: (02) 9798 9233 Fax: (02) 9798 0017 Web: www.wagner.net.au July 2008  65 Parts List 1 PC board, code 04107081, 147 x 84mm 1 UB1 plastic utility box, 158 x 96 x 53mm 2 PC-mount momentary pushbutton switches, red (S1,S2) 2 PC-mount momentary pushbutton switches, green (S3,S4) 1 mini toggle switch, SPDT (S5) 1 16.000MHz crystal, HC49U/ US case (X1) 1 PC-mount 2.5mm DC power connector (CON1) 1 PC-mount RCA socket (CON2) 1 PC-mount 3.5mm mini jack socket, (CON3) 5 M3 x 15mm tapped spacers 5 M3 x 6mm machine screws, countersink head 5 M3 x 6mm M3 machine screws, pan head 1 40-pin IC socket 1 8-pin IC socket board is in position. Don’t tighten it down too much, otherwise the panel label may buckle and tear. The switch nut on the underside can be wound up to the bottom of the lid to help prevent this. The next step is to solder two 150mm lengths of light-duty hookup wire to the speaker terminals. The other ends Capacitors 1 470mF 16V RB electrolytic 1 330mF 16V RB electrolytic 2 100mF 16V RB electrolytic 1 22mF 16V RB electrolytic 1 10mF 16V RB electrolytic 2 1mF 25V tantalum 1 220nF MKT metallised polyester 3 100nF multilayer monolithic ceramic 1 47nF MKT metallised polyester 2 33nF MKT metallised polyester 1 1nF disc ceramic 2 33pF disc ceramic 1 16-pin IC socket 2 14-pin IC sockets (see text) 1 57mm 8-ohm mini speaker 4 self-adhesive rubber feet 1 9V battery clip lead 4 PC board terminal pins, 1mm diameter 2 150mm lengths of insulated hookup wire 1 10kW horizontal PC-mount mini trimpot Semiconductors 1 PIC16F877A microcontroller (IC1), programmed with 0410708A.hex 1 LM386N audio amplifier (IC2) 1 LM358 dual op amp (IC3) 1 4017B CMOS counter (IC4) 1 78L05 +5V regulator (REG1) 1 PN100 NPN transistor (Q1) 21 3mm red LEDs (LED1-13, LED22-29) 8 3mm green LEDs (LED14-21) 1 1N4004 diode (D1) Resistors (0.25W 1%) 1 10MW 2 2.2kW 1 2.2MW 6 2kW 1 1MW 5 1kW 2 220kW 2 470W 1 47kW 1 220W 1 22kW 1 180W 2 10kW 1 10W 5 4.7kW of these wires are then soldered to the relevant PC stakes underneath the PC board (near CON2). The 9V battery clip leads are connected to the other two terminal pins, between CON3 and CON1. Note that the black lead must connect to the outermost of these pins (-), while the red lead connects to the innermost pin (+). That completes the assembly of the Musical Instrument Tuning Aid. Now for the check-out procedure. Check-out time Before applying power, adjust volume trimpot VR1 so that it is about 30° clockwise from its fully anticlockwise position. That done, connect the bat- Above: the three holes in the end of the case provide access for the DC input socket (left), the mic/instrument socket and the line output socket. Left: a pattern of holes is drilled in the bottom of the case beneath the loudspeaker mounting position, to allow the sound to escape. 66  Silicon Chip siliconchip.com.au The PC board is fitted with five tapped spacers and secured to the lid using machine screws. A clamp fashioned from scrap aluminium secures the battery, while the speaker is secured using a few dobs of epoxy resin. tery snap lead and switch on. Because the PIC’s program is set to deliver a default output note of A = 440Hz, you should immediately be greeted by a tone of this frequency from the speaker. At the same time, the red “A” note LED (LED10) should light, along with the “octave 4” green LED (LED17). If nothing happens, the odds are that you have reversed the battery clip lead connections at the PC board or diode D1 is in the wrong way around. Assuming it works so far, try changing the note by pressing either S1 or S2 (red). Each time you press one of these buttons, the note produced by the Musical Instrument Tuning Aid will step up or down by a semitone – until you get to the upper or lower limit. Similarly, pressing switches S3 or S4 (green) should step the tone frequency up or down through the octaves. To check the operation of the beat siliconchip.com.au stroboscope, first reset the unit’s output to A = 440Hz. This can be done either by using the pushbutton switches to return to this note and octave or by simply switching the unit off and then waiting a second or two before turning it on again (to get the note by default). Now feed an audio signal of around 440Hz into the unit via CON3. This should preferably come from an audio oscillator, so you can easily vary its frequency. As soon as this external signal is applied, four or more of the stroboscope’s ring of LEDs (LEDs22-29) should light. If the signal frequency is not very close to 440Hz, they will probably all appear to be continuously lit. However, if you carefully adjust the input signal frequency to approach 440Hz, only four of the strobe LEDs should light at any time. In addition, this semicircle of light should rotate – either clockwise or anticlockwise. As you adjust the frequency closer to 440Hz, the speed of rotation will slow down. In fact, it will stop rotating altogether when the two frequencies are equal. If you then keep adjusting the signal’s frequency “out the other side”, the stroboscope LEDs will begin rotating in the opposite direction, slowly at first and then faster as the frequencies move further apart. If all of this happens as described, your Musical Instrument Tuning Aid is working as it should and the assembly can be fastened into its box. At the same time, you will have seen just how easy it is to use the ring of LEDs stroboscope to achieve exact “zero beat” tuning of the notes from virtually any musical instrument. It’s simply a matter of setting the unit to the note concerned and then adjusting the instrument until the SC strobe LEDs stop rotating. July 2008  67