Silicon ChipVU/Peak Meter With LCD Bargraphs - May 2007 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: New 20W class-A module is a step closer to perfection
  4. Feature: Jaycar Sunswift III Solar Car Shatters Record by Leo Simpson
  5. Feature: Turntables – Give ’em A Spin by Barrie Smith
  6. Project: A 20W Class-A Amplifier Module by Leo Simpson & Peter Smith
  7. Project: Adjustable 1.3-22V Regulated Power Supply by John Clarke
  8. Project: VU/Peak Meter With LCD Bargraphs by John Clarke
  9. Project: Programmable Ignition System For Cars; Pt.3 by John Clarke
  10. Project: GPS-Based Frequency Reference: Circuit Modifications by Jim Rowe
  11. Vintage Radio: A look at the Kurrajong Radio Museum by Rodney Champness
  12. Project: Throttle Interface For The DC Motor Speed Controller by Leo Simpson & Brank Justic
  13. Advertising Index
  14. Book Store
  15. Outer Back Cover

This is only a preview of the May 2007 issue of Silicon Chip.

You can view 33 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.

Articles in this series:
  • Turntables – Give ’em A Spin (May 2007)
  • Turntables – Give ’em A Spin (May 2007)
  • Turntables – Give ’em A Spin; Pt.2 (June 2007)
  • Turntables – Give ’em A Spin; Pt.2 (June 2007)
Items relevant to "A 20W Class-A Amplifier Module":
  • Preamp & Remote Volume Control PCB for the Ultra-LD Mk3 [01111111] (AUD $30.00)
  • Speaker Protection and Muting Module PCB [01207071] (AUD $17.50)
  • 20W Class-A Amplifier Power Supply PCB [01105074] (AUD $20.00)
  • 20W Class-A Amplifier Module PCB, left channel [01105071] (AUD $15.00)
  • 20W Class-A Amplifier Module PCB, right channel [01105072] (AUD $15.00)
  • PIC16F88-I/P programmed for the Low Noise Stereo Preamplifier with Remote Volume Control (Programmed Microcontroller, AUD $15.00)
  • PIC16F88 firmware and source code for the Low Noise Preamplifier with Remote Volume Control (Software, Free)
  • Speaker Protector and Muting Module PCB pattern (PDF download) [01207071] (Free)
  • 20W Class A Low Noise Stereo Preamplifier/Remote Volume Control PCB pattern (PDF download) [01208071] (Free)
  • 20W Class A Amplifier Module PCB patterns (PDF download) [01105071/2] (Free)
  • 20W Class A Amplifier Power Supply PCB pattern (PDF download) [01105073] (Free)
Articles in this series:
  • A 20W Class-A Amplifier Module (May 2007)
  • A 20W Class-A Amplifier Module (May 2007)
  • 20W Class-A Amplifier Module; Pt.2 (June 2007)
  • 20W Class-A Amplifier Module; Pt.2 (June 2007)
  • 20W Class-A Amplifier Module; Pt.3 (July 2007)
  • 20W Class-A Amplifier Module; Pt.3 (July 2007)
  • 20W Class-A Amplifier Module; Pt.4 (August 2007)
  • 20W Class-A Amplifier Module; Pt.4 (August 2007)
  • Building The 20W Stereo Class-A Amplifier; Pt.5 (September 2007)
  • Building The 20W Stereo Class-A Amplifier; Pt.5 (September 2007)
Items relevant to "Adjustable 1.3-22V Regulated Power Supply":
  • Adjustable Regulated Power Supply PCB pattern (PDF download) [10105071] (Free)
Items relevant to "VU/Peak Meter With LCD Bargraphs":
  • VU/Peak Meter main PCB [01205071] (AUD $12.50)
  • VU/Peak Meter button PCB [01205072] (AUD $5.00)
  • PIC16F88-I/P programmed for the VU/Peak Meter (Programmed Microcontroller, AUD $15.00)
  • PIC16F88 firmware and source code for the VU/Peak Meter (Software, Free)
  • VU/Peak Meter PCB patterns (PDF download) [01205071/2] (Free)
  • VU/Peak Meter front panel artwork (PDF download) (Free)
Items relevant to "Programmable Ignition System For Cars; Pt.3":
  • Programmable Ignition System main PCB [05104071] (AUD $10.00)
  • Programmable Ignition System Trigger Module PCB [05104072] (AUD $5.00)
  • Programmable Ignition System Hand Controller PCB [05104073] (AUD $10.00)
  • PIC16F88-E/P programmed for the Programmable Ignition System [ignprgm.hex] (Programmed Microcontroller, AUD $15.00)
  • PIC16F88 firmware and source code for the Programmable Ignition System (Software, Free)
  • Sample timing maps for the Programmable Ignition System (Software, Free)
  • Programmable Ignition System PCB patterns (PDF download) [05104071/2/3] (Free)
  • Programmable Ignition System front panel artwork (PDF download) (Free)
Articles in this series:
  • Programmable Ignition System For Cars; Pt.1 (March 2007)
  • Programmable Ignition System For Cars; Pt.1 (March 2007)
  • Programmable Ignition System For Cars; Pt.2 (April 2007)
  • Programmable Ignition System For Cars; Pt.2 (April 2007)
  • Programmable Ignition System For Cars; Pt.3 (May 2007)
  • Programmable Ignition System For Cars; Pt.3 (May 2007)
  • A Knock Detector For The Programmable Ignition (June 2007)
  • A Knock Detector For The Programmable Ignition (June 2007)
Items relevant to "GPS-Based Frequency Reference: Circuit Modifications":
  • PIC16F628A-I/P programmed for the GPS Frequency Reference [GPSFrqRfv3.HEX or GPSFrqRfv4.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC16F628A firmware for the GPS-Based Frequency Reference (v3 & v4) (Software, Free)
  • Updated PCB pattern for the GPS-Based Frequency Reference (PDF download) [04103073] (Free)
  • Display PCB pattern for the GPS-Based Frequency Reference (PDF download) [04103072] (Free)
  • GPS-based Frequency Reference front and rear panel artwork (PDF download) (Free)
Articles in this series:
  • GPS-Based Frequency Reference; Pt.1 (March 2007)
  • GPS-Based Frequency Reference; Pt.1 (March 2007)
  • GPS-Based Frequency Reference; Pt.2 (April 2007)
  • GPS-Based Frequency Reference; Pt.2 (April 2007)
  • GPS-Based Frequency Reference: Circuit Modifications (May 2007)
  • GPS-Based Frequency Reference: Circuit Modifications (May 2007)
  • Improving The GPS-Based Frequency Reference (September 2011)
  • Improving The GPS-Based Frequency Reference (September 2011)

Purchase a printed copy of this issue for $10.00.

VU/peak meter with LCD bargraphs Use it as a recording level indicator or simply as a signal level display This easy-to-build bargraph VU meter makes it easy to record audio signals at the correct level. It shows both the average signal and peak levels in stereo on an LCD and you can adjust both the display range and number of steps. A digital display option is also available. By JOHN CLARKE I F YOU ARE SERIOUS about making quality recordings, then you need to accurately monitor the audio signal level being fed into the recording device. This is to ensure that the signal level is within a range that the recorder can accept. In particular, correct audio signal levels are quite important for modern digital recorders. These do not toler62  Silicon Chip ate any amount of excess signal level and will severely distort such signals. Dynamic range Any audio signal, be it speech or music, varies constantly in level and the difference between the highest and lowest levels is called the “dynamic range”. When recording, it’s important that the lowest signal levels must be sufficiently above the “noise floor” of the recording equipment, to prevent them from being buried in noise. On the other hand, the highest signal levels must be kept low enough to prevent signal overload and the inevitable distortion that accompanies this. Ensuring that an audio signal stays within these bounds can be quite difficult unless its level is accurately monitored using a meter. This meter must respond not just to the average signal level but to peak levels as well. Fig.1 illustrates why it is so import­ ant to get the signal levels correct. Note that each waveform shown is not the audio signal itself but the instantaneous signal level plotted against time. These signal level variations occur constantly in music and speech. In music, for example, the level may range from soft passages to quite loud passages. siliconchip.com.au presses the signal rather than severely clipping it. However, as previously indicated, this is not true for digital recordings where any signal that goes above the maximum is simply clipped. The ideal recording level is shown in Fig.1(c). This is where the signal levels are well above the noise floor but do not exceed the maximum level. By doing this, we ensure both low distortion and the best possible signal-to-noise ratio. VU meter In the past, audio signal levels were commonly measured using a “Volume Unit” or VU meter. In fact, these have been used since broadcasting began and are still widely used by the recording industry. In practice, a VU meter displays the average signal level and is calibrated to show the true RMS value for a sinewave signal. The true RMS value is simply the DC equivalent value of the AC waveform. One drawback of conventional VU meters is that they are rather slow to signal variations. Typically, they take some 300ms to respond fully to a signal and this means that they are unable to respond to the fast transients that often occur in speech and music. As a result, many modern VU meters also include “peak displays” that show the levels of any sudden transients. However, they only show transients that are sustained for a defined time and this assumes that any short duration transients that are clipped are inaudible. SILICON CHIP VU meter Fig.1: this diagram shows why it is important to set the correct signal level for recording. In “A”, the average signal level has been set too low, resulting in lots of background noise. In “B”, the level is too high and the recording system will overload and distort. Diagram “C” shows the correct level - ie, well above the noise floor but with the peaks below the maximum recording level. Fig.1(a) shows an example of a recording that’s been made with the signal level set too low. What happens here is that lowest signal levels are lost within the noise and so only noise signals will be heard at these levels. The higher signal levels are above the noise floor but the overall sound quality will be rather poor, with lots of background noise. siliconchip.com.au Conversely, Fig.1(b) shows what happens if the average signal level is too high. Here, the upper levels go above the maximum level that the recording device can handle without distortion. For magnetic tape recording, some degree of signal peaking above the maximum level can be tolerated. That’s because magnetic tape com- The unit described here falls into the latter category. It includes stereo (left & right channel) VU and peak level displays and employs an LCD readout (rather than a conventional meter) for a fast response. As shown in the photos, the meter is housed in a small plastic utility case with a clear lid. It includes four RCA sockets (two input and two output) so that you can connect the unit in-line between the signal source and the recorder. Both the SILICON CHIP Stereo VU/ Peak Meter and the recorder must be set up so that the meter indicates the correct levels for recording. In practice, this means that the level control on the recorder is fixed in position. Any level changes are then May 2007  63 Fig.2: the block diagram of the Digital Stereo VU/Peak Meter. The incoming signals are first amplified by IC1a & IC1c and then fed to precision rectifier stages. From there, they go to the peak detector & VU filter (averaging) stages before being fed to microcontroller IC3. IC3 converts the analog peak and VU signal levels to digital values and drives the LCD module. made at the signal source – ie, prior to the VU meter – so that both the VU meter and recorder receive the same signal level. Alternatively, the VU/Peak Meter could be installed within the recorder itself and the signal for it derived after the recorder’s level control. The LCD readout used consists of two 16-block bargraphs (one for each channel). These bargraphs are used here for VU indication and increase in length to the right with increasing signal level. A vertical thin line that travels Main Features • • • • • • • Stereo bargraph with VU and peak displays 15-segment bargraph for each channel Adjustable thresholds for each segment Signal level adjustment for calibration Digital display option Programmable VU and peak display options 9V-12V DC power supply 64  Silicon Chip ahead of each VU bargraph indicates the peak level for that channel. Display options As well as the bargraphs, there are several display options to choose from (ain’t microcontrollers grand?). These display options include choosing between either full 15-block bargraphs or 10-block bargraphs with digital readouts in the first six block positions. In each case, the display indicates the channel, with the top bargraph having an “L” (left) and the lower bargraph an “R” (right). The initial pre-programmed settings are for a traditional VU meter covering the range from -28dB to +3dB as follows: –28dB, -25dB, -22dB, -19dB, -16dB, -13dB, -10dB, -7dB, -5dB, -3dB, -2dB, -1dB, 0dB, +1dB, +2dB and +3dB. These settings are the same for both channels. Note, however, that the -28dB block is not indicated because the “L” and “R” channel designations are shown here instead. In addition, this programmed location is used when the digital format display option is selected. The use of a microcontroller also makes it possible to change the bargraph settings to cover a wider or narrower range. In practice, each block position can be set from between -48dB through to a maximum of +16dB. Note, however, that the overall range should be 48dB. This means that if the uppermost block in the bar is set at +16dB, the lowermost block should be set to a minimum of -32dB. When used with a digital recorder, the uppermost bar should be set at 0dB. This would be the absolute maximum level that the digital recorder can handle before clipping. Mode switch Pressing the Mode switch for the first time changes the display to show the far lefthand block on the top line and the “SET VALUE” (eg, -28dB) on the second line. Basically, the block on the top line shows the bargraph position that has the indicated set value. Pressing the Mode switch again causes the display to show the next block in the bargraph and its value. This step can then be repeated, with each subsequent pressing of the Mode switch showing the next block in the bargraph (and its value). The displayed values can be chang­ ed using the Up and Down switches which are located behind the front panel. Note that it is important that these values are set to increase in value siliconchip.com.au from left to right. So a sequence of -22, -19, -16, etc is correct but -22, -23, -24 is incorrect. Options switch The Options switch invokes the various display selections. These can be toggled using the Up and Down switches to select one of the following display options: (1) Bar, VU On, Peak On (2) Bar, VU Off, Peak On (3) Bar, VU On, Peak Off (4) Digital & Bar, VU On, Peak On (5) Digital & Bar, VU Off, Peak On (6) Digital & Bar, VU On, Peak Off This means that you can select the full 15-block bargraph with both the peak and VU displays shown or you can have either peak of VU only shown. Similarly, you could choose the digital display for the first six blocks (DIGITAL selection) and then choose to show either the VU or peak readings, or both. Note that when the DIGITAL selection is made, the digital reading will show the VU value unless the Peak display only is selected. If Peak only is selected, then the Digital display shows the peak readings. As indicated above, the DIGITAL display uses “L” & “R” designations to indicate the left and right channel bargraphs. The digital values that are displayed will only be in steps of the actual programmed values for each block in the bargraph. The digital display indicates these values (and the “L” & “R” designations) within the first six blocks of the displays (ie, the bargraphs no longer occupy these first six blocks). However, if the signal goes below the minimum block setting, then the digital display will show blanks instead of the numbers. Once the display mode and other settings have been entered, the setup is saved simply by switching the power off and on again. Block diagram Refer now to Fig.2 for a block diagram of the Stereo VU/Peak Meter. As shown, both the “Left In” and “Left Through” sockets are paralleled, as are the “Right In” and “Right Through” sockets. This allows the audio source signals to be fed into the VU meter and also fed straight back out to the recording device. Following the L & R input sockets, siliconchip.com.au Specifications Display Graph: 15-block bargraph or 10-block bargraph with digital display Display Range: 48dB (0 to -48dB) or value variations from +16dB maximum                 to -32dB Signal Levels: requires 440mV RMS to over-range on VU scale Accuracy: within 1dB for signals above -40dB Display Resolution selectable to a minimum of 1dB Input Impedance: 100kW Supply Voltage: 9-15VDC maximum. Supply Current: 108mA with backlit display; 68mA with non-backlit display the audio signal is fed to trimpots VR1 & VR2 which act as level attenuators. The L & R channel signals are then amplified by op amps IC1a and IC1c which operate with gains of 16. From there, the signals are then precision rectified and fed to the peak detector and VU filter stages. The outputs from these stages are fed to the AN1-AN3 inputs of microcontroller IC3. This processes the input signal levels and drives the LCD module according to the settings and values entered using switches S1-S4. In operation, IC3 converts the analog voltages from the peak detector and VU stages to digital values ranging from 1-1024. A value of 1024 represents the maximum analog signal level which is 5V. Normally, the unit is set up so that the far righthand block of the bargraph turns on when signal value goes above 1024. This is set to occur when the righthand block is set at 0dB or higher. However, if the far righthand block is set at a minus dB value, then the signal value is reduced to coincide with that dB setting. The remaining blocks in the bargraph are then calculated to show the lower signal levels. For example, a signal that is at -6dB (or half the 0dB signal level) will have a digital value of 1024/2 or 512 when converted by IC3. Similarly, a -12dB signal will have a digital value of 256. And a signal that is 48dB below the 1024 maximum level will have a digital value of 4 (ie, 251 times less). These values are all calculated using the following equation: Attenuation (dB) = 20log(the signal ratio) For example, if the signal level is half the maximum, then the log of this is -0.3 and 20 times this is -6dB. Note that IC3 only indirectly uses this equation because it uses a lookup table that already has the values programmed into it. Power for the meter comes from an external 9-12V DC supply and this is fed in via reverse polarity protection diode D9. The resulting 9-12V rail, together with a -9V rail generated by the “negative supply” block, is used to power the op amps that form the input amplifiers, precision rectifiers, peak detectors and VU filters. Finally, regulator REG1 produces a +5V rail which is used to power micro­ controller IC3 and the LCD. Circuit details Fig.3 shows the circuit details but note that only the lefthand channel circuitry before IC3 has been depicted for the sake of clarity. The righthand channel is identical, so we’ll describe the lefthand channel operation only. As before, the incoming left-channel audio signal is attenuated via trimpot VR1, which sets the display sensitivity. The signal at the wiper is then applied to op amp IC1a which operates with a gain of 16 (ie, it amplifies the signal by a factor of 16). This is done to boost the signal level to at least 5V peak-to-peak, so that is suitable for the following level display circuitry. IC1a’s output is fed via a 470nF capacitor to the full-wave precision rectifier. For the VU signal path, this stage is based on op amp IC1b, diodes D1 & D2 and op amp IC2a. Similarly, for the peak detector, the precision rectifier uses IC1b, D1 & D2 and op amp IC2b. It operates as follows. When the input signal goes positive, pin 1 of IC1b goes low and forward biases diode D1. The resulting gain of the signal appearing at the anode of D1 May 2007  65 is -1, as set by the 20kW input resistor and 20kW feedback resistor. This inverted signal at D1’s anode is applied to the inverting input (pin 2) of IC2a via 150kW and 100kW resistors. IC2a operates with a gain of -6.66 on this signal, as set by the ratio of the 1MW feedback resistor and the 150kW input resistor (the 100kW resistor in series with the input is inside the feedback loop). As a result, the overall gain for the signal path between pin 2 of IC1b and 66  Silicon Chip pin 1 of IC2a is -1 x -6.66, or +6.66 (ie, IC1b’s gain x IC2a’s gain). At the same time, the positive-going signal from IC1a is applied via a second path to IC2a via a 300kW resistor. In this case, IC2a operates with a gain of -3.33 due to the ratio of the 1MW feedback resistor and the 300kW input resistor. Thus, the overall signal gain at the output of IC2a is 6.66 - 3.33 = 3.33. Now let’s consider what happens when IC1a’s output swings negative. When this occurs, diode D2 is forward biased and so IC1b’s output is clamped at 0.6V above the pin 2 input signal and no signal flows through D1. IC1b is therefore effectively taken out of circuit and IC2a now simply amplifies the signal from IC1a (applied via the 300kW resistor) on its own. As before, it operates with a gain of -3.33 for this signal path. Since the input signal is negative, the output at pin 1 is positive – ie, it inverts and amplifies the negative input signal. siliconchip.com.au Fig.3: the parts shown in this circuit diagram can be directly related to the block diagram shown in Fig.1. Note that only the lefthand channel circuitry before IC3 has been shown for the sake of clarity – the righthand channel is identical. IC1a is the input amplifier, IC1b, D1, D2 & IC2a form the precision rectifier & VU filter stages and IC2b, D3 & D4 function as the peak detector. IC4, transistors Q1 & Q2, diodes D10 & D11 and capacitors C1 & C2 make up a diode charge pump which provides the required -9V rail. The precision rectifier therefore provides a positive output with gain of 3.33 for both positive and negative going inputs. VU response IC2a also provides low-pass filtering of the rectified signal so that its response is relatively slow. This filtering conforms to VU (volume unit) standards so that the output reaches the input level after 300ms and overshoots by about 1.5%. siliconchip.com.au The filtering is carried out using the 100kW and 1MW resistors, the 56nF and 1mF capacitors and the parallel combination of the 300kW and 150kW input resistors. These together provide the 2.1Hz roll-off frequency and a Q (quality factor) of 0.62. Peak level detector IC2b and its associated components comprise the peak level detector. This stage is also fed via two signal paths: (1) directly from the output of IC1a via the 470nF capacitor and a 300kW resistor; and (2) from diode D1 in the precision rectifier circuitry (and a series 150kW resistor). How this works is again best explained in two steps – ie, when the signal from IC1a swings positive and when the signal swings negative. As we know from the precision rectifier explanation, when the input signal goes positive, pin 1 of IC1b swings low and forward biases D1. The resulting gain of the signal at the anode May 2007  67 The main PC board is secured inside the case using four M3 Nylon screws, two tapped Nylon spacers and two Nylon nuts. Two additional tapped Nylon spacers are also fitted to the PC board (centre, right) to support the bottom righthand corner of the LCD module and the righthand end of the switch PC board. Note that the capacitors that go under the LCD module & switch board must be mounted horizontally, to provide the necessary clearance. of D1 is -1, as set by IC1b’s 20kW input and 20kW feedback resistors. This amplified signal is applied to pin 6 of IC2b via the 150kW resistor. As a result, IC2b’s output swings high and forward biases D3. This diode is in series with a 910kW resistor in the feedback loop. The signal at D3’s cathode is thus amplified by -910kW/150kW or -6.066, which means that the output signal is positive and the overall gain from the output of IC1a for this signal path is +6.066 (ie, -1 x -6.066). For the second signal path (ie, via the 300kW resistor), IC2b operates with a gain of -910kW/300kW or -3.033. This means that the overall gain of the signal from IC1a is 6.066 - 3.033, or +3.033. When the signal goes negative, D2 is forward biased and IC1b’s output is clamped as before. IC2b now operates on its own and amplifies the signal applied to it via the 300kW resistor with a gain of -3.033 (ie, -910kW/300kW). As a result, IC2b delivers a positive output signal on both positive and negative output signal swings from IC1a. And in both cases the absolute signal gain is the same at 3.033. Note that a 910kW feedback resistor is used for IC2b instead of a 1MW resistor (as used for IC2a in the VU filter). That’s because the peak value must be 3dB higher than the VU value. This 3dB figure comes about because the peak of a sinewave is 1.414 times the RMS value (ie, 3dB greater). Another way of saying this is that the RMS value of a sinewave is 0.7071 of the peak value. How The Diode Charge Pump Works Fig.4: how the diode charge pump works. Capacitor C1 charges towards the +12V rail when transistor Q1 turns on and then transfers its charge to C2 when Q1 switches off and Q2 turns on. 68  Silicon Chip In our case, the VU signal is the average level of the full-wave rectified signal and this is only 0.637 of the input signal’s peak level. The 910kW resistor is therefore used to provide a peak output that is 0.91 (approximately 0.637/0.7071) of the peak signal, or about 3dB higher than the VU signal. Diode D4 ensures that IC2b’s output does not swing negative by more than about 0.7V, so that its response to signals is not compromised. In normal operation, diode D3 is forward biased and D4 does not conduct. However, when the signal is at 0V, IC2b’s output tends to switch positive and negative to maintain control. That is when D4 comes into operation. The peak signal level at D3’s cathode is filtered using a 2.4kW resistor and 680nF capacitor. This filtering slows the peak signal level response so that it is not instantaneous but instead conforms to an audio standard. This ensures that only peaks that are wide enough to be audible are displayed. The standard we picked is IEC6026810 which has a 1.7ms response time to peak signals. This means that the measured signal level will be 1dB lower than it otherwise would be for a 10ms signal burst and 4dB lower for a 3ms burst (compared to an instantaneous measurement). In practice, the 2.4kW resistor and the 680nF capacitor in the filter circuit set the time constant at 1.63ms. The decay time constant specified siliconchip.com.au in the IEC standard is -20dB in 1.5s (equivalent to a 650ms decay time constant). In this circuit, the 910kW resistor and the 680nF capacitor set the decay rate at 619ms which is near enough. Microcontroller The left-channel VU and peak level signals are respectively applied to analog inputs AN3 & AN1 of microcontroller IC3. Similarly, the rightchannel signals are applied to inputs AN2 & AN0. Note that the VU input signal is fed via a 2.2kW resistor to limit the current flow when IC2a’s output goes above 5V. The 2.4kW resistor in the output filter circuit for IC2b does the same job. IC3 is a PIC16F88 microcontroller. It measures the incoming VU and peak signal levels for the left and right channels and drives the 2-line 16-segment LCD module accordingly. In operation, the signal levels at the AN inputs of the microcontroller are converted to 10-bit digital values using an internal A/D (analog-todigital) converter. Outputs RB0-RB3 then drive the LCD’s D4-D7 data lines, while outputs RA4 & RA6 drive the enable (EN) and register select (RS) lines on the LCD. Switches S1-S4 are used to enter data into the microcontroller. Normally, inputs RB4-RB7 are held high via internal pull-up resistors. Closing a switch pulls the associated input to ground and this is detected and processed by the microcontroller. IC3 operates at a frequency of 8MHz, as set by an internal oscillator. It is powered from a regulated +5V supply rail, with the reset input at pin 4 tied high via a 10kW resistor. The 100nF capacitor and a 100mF filter capacitor provide supply rail decoupling. The LCD module also runs from the +5V supply rail and a 10mF capacitor decouples its supply. The lower four data lines (D0-D3) are tied to ground and the LCD module is driven using the upper four bits (D4-D7). VR3 provides display contrast adjustment. Power supply The +5V supply rail for the circuit is derived from a 9-12V DC plugpack via diode D9 (which provides reverse polarity protection) and 3-terminal regulator REG1. This regulator has its input and output terminals bypassed using 100mF capacitors. Zener diode siliconchip.com.au Parts List 1 PC board, code 01205071, 116 x 65mm 1 PC board, code 01205072, 81 x 19mm 1 LCD module with back lighting (Jaycar QP-5516 or equivalent) 1 120 x 70 x 30mm box with clear lid (Jaycar HB-6082 or equivalent) 4 SPST micro tactile switches (Jaycar SP-0600 or equivalent) (S1-S4) 1 DPDT slider switch (S5) 1 8-pin IC socket cut to 2 x 3-way strips 1 14–pin IC socket cut to 2 x 7-way strips 2 14-pin IC sockets for IC1 & IC2 (optional) 1 18-pin IC socket for IC3 4 PC mount right angle RCA sockets (Jaycar PS-0279 or equivalent) 1 20-way DIL header strip 1 2.5mm DC bulkhead socket 2 100kW horizontal trimpots with 2.5mm pin spacing (VR1, VR2) (Code 104) 1 10kW horizontal trimpot with 2.5mm pin spacing (VR3) (Code 103) 4 M3 x 10mm Nylon screws 2 M3 x 6mm Nylon screws 4 M3 x 6mm screws 1 M3 x 10mm metal screw 4 M3 tapped x 15mm Nylon stand-offs (cut to 11mm) 2 M3 Nylon nuts 1 M3 metal nut 2 M2 x 8mm screws for S5 2 PC stakes ZD1 clamps any transients from the plugpack that go above 15V. The positive supply rail for op amps IC1 and IC2 is derived immediately following D9 (ie, before REG1). This rail is typically 9-12V. By contrast, the negative supply rail for these op amps is generated using a diode charge pump. This comprises a 7555 oscillator (IC4), transistors Q1 & Q2 and diodes D10 & D11. In operation, IC4 oscillates at about 75kHz, with the 10nF capacitor on pin 6 charged and discharged via a 1kW resistor connected to the pin 3 output. 1 100mm length of red hookup wire 1 50mm length of black hookup wire 1 200mm length of 0.7mm tinned copper wire Semiconductors 2 LM324 quad op amps (IC1,IC2) 1 PIC16F88-I/P microcontroller (IC3) programmed with VUPEAK.hex 1 7555 timer (IC4) 1 LM340T5, 7805 5V regulator (REG1) 1 BC337 NPN transistor (Q1) 1 BC327 PNP transistor (Q2) 8 1N4148 diodes (D1-D8) 1 IN4004 diode (D9) 2 1N5819 Schottky diodes (D10,D11) 1 15V, 1W zener diode (ZD1) Capacitors 1 100mF 35V PC electrolytic 5 100mF 16V PC electrolytic 1 10mF 16V PC electrolytic 2 1mF 16V PC electrolytic 2 680nF MKT polyester 2 470n MKT polyester 3 100n MKT polyester 2 56nF MKT polyester 1 10nF MKT polyester 2 330pF ceramic Resistors (0.25W, 1%) 2 1MW 2 15kW 2 910kW 2 2.4kW 4 300kW 2 2.2kW 4 150kW 3 1kW 2 100kW 1 10W 4 20kW Pins 2 & 6 are the lower and upper threshold inputs and these monitor the capacitor voltage. The pin 3 output drives the bases of transistors Q1 & Q2. When pin 3 is high, transistor Q1 switches on and Q2 is off. Conversely, when pin 3 is low, transistor Q2 switches on and Q1 turns off. Basically, the transistors act as current buffers which drive the following voltage converter circuitry without loading IC4’s the pin 3 output. Diodes D10 & D11, along with capacitors C1 & C2 (both 100mF), act as May 2007  69 Fig.5: assemble the two PC boards as shown here. Note that most of the capacitors on the main board must be mounted horizontally, so that they don’t foul the LCD module and switch PC board when these are installed (see photos). a diode charge converter to derive the negative (-9V) supply. Fig.4 shows a more simplified arrangement of how this works. When transistor Q1 switches on, C1 charges towards the 12V supply rail via D10. Subsequently, when Q1 switches off and Q2 turns on, the positive terminal of C1 is connected to ground and the negative side of the capacitor is pulled below ground by an amount equal to the voltage across it. Capacitor C2 now quickly charges towards this negative voltage via diode D11. As a result, it reaches a negative voltage that is close in value to the 12V supply, minus the voltage drops across the diodes and the saturation voltages of transistors Q1 and Q2. The 6-way pin header is mounted on the top side of the switch PC board, while the four switches are mounted on the track side. 70  Silicon Chip 3 x 2 DIL HEADER (MOUNT ON TOP OF BOARD) VU/PEAK LEVEL METER OPTIONS UP (ON DOWN S1–S4 MODE MOUNT UNDERNEATH COPPER SIDE) 01205072 JC S1 In practice, this is about -9V and this rail is bypassed using another 100mF capacitor (to the positive rail) to minimise the supply impedance. Note that the diodes used are Schott­ ky types which have a lower voltage drop than standard diodes. In addition, these diodes are better suited for high-frequency operation and produce less losses at 75kHz. Construction The Stereo VU/Peak Level Meter is built on two PC boards – see Fig.5. The main board is coded 01205071 and carries all the input metering circuitry, the microcontroller and the LCD module which is connected via a pin header. The second, smaller board is coded 01205072 and carries switches S1S4 to allow the display values and options to be changed from the preprogrammed settings. Begin by checking the PC board for any faults. These could include bridges between tracks, breaks in the copper and incorrect hole sizes. In addition, make sure that the various mounting holes are all the correct size, including those for the RCA sockets. Start the assembly by installing PC stakes at the two supply terminals (ie, the bottom right connections to the DC socket and S5), then install the eight S2 S3 S4 wire links. In particular, note the wire link situated between the two central RCA sockets – don’t leave it out. The resistors can go in next. Table 1 shows the resistor colour codes but you should also use a digital multimeter to confirm their values (some colours can be difficult to decipher). Next on the list are the diodes. Note that several different types are used in this circuit so be careful not to mix them up. Once they’re in, transistor Q1 & Q2 can be installed. Note that Q1 is a BC337 (NPN) while Q2 is a BC327 (PNP) – be sure to install them in their correct locations. Note also that the tops of the transistors must be no more than 9mm above the PC board, to allow clearance for switch S5 when the unit is mounted inside its case. Now for regulator REG1. As shown, this is installed flat against the board (just bend its leads down at right angles) and its metal tab secured using an M3 x 10mm metal screw and nut. Be sure to tighten the nut before soldering REG1’s leads. Doing this the other way around could place undue stress on the soldered joints. IC1, IC2 & IC4 can now be installed, taking care to ensure they are all correctly oriented (ie, pin 1 at top, right). Note that IC4 is a CMOS device, so observe the usual static precautions siliconchip.com.au sockets (for the switch board header). In both cases, these socket strips are made by cutting down IC sockets – ie, a 14-pin IC socket and an 8-pin IC socket, respectively. Use side cutters to split the sockets in half and a file to clean up the edges. Once these are in, a matching 14-way pin header (which is cut from a 20-way header) can be soldered to the LCD module. Note that this header must be inserted from the underside of the module’s PC board and its pins soldered on the top side. Switch PC board There’s nothing complicated about this board, since it carries just switches S1-S4 and a 6-way pin header. Note however, that the four switches are mounted on the copper side of the board – see photo. The 6-way header is mounted in the usual manner (ie, it is installed on the non-copper side of the board). This is the view inside the completed prototype. Be sure to wire the DC socket for centre positive. Testing (ie, discharge yourself by touching an earthed metal object, avoid touching its pins and earth the barrel of your soldering iron using a clip lead). An 18-pin socket is used for IC3. Don’t plug IC3 in yet, though – that step comes later. Trimpots VR1, VR2 & VR3 are next on the list. Note that VR3 is 10kW (code 103), while VR1 & VR2 are both 100kW (code 104). Once they’re in, the four RCA sockets can be installed. just below Q2 must be installed horizontally (ie, laid over on their sides). This is necessary to allow clearance for the LCD module and the switch carrier PC board. In practice, its just a matter of bending their leads down at right angles before installing them. Make sure they all go in with the correct polarity. Depending on the brand, it may also be necessary to mount some of the MKT capacitors in this fashion. Installing the capacitors Header sockets Take a careful look at the photos before installing the capacitors. In particular, note that all the electrolytic types except for the two 100mF units The main board assembly can now be completed by installing two 7-way SIL (single-in-line) sockets (for the LCD header) and two 3-way SIL The unit is now ready for testing, before final assembly into its case. This should be done without microcontroller IC3 in place and with the LCD module unplugged. First temporarily wire a DC socket Table 2: Capacitor Codes Value 680nF 470nF 100nF 56nF 10nF 330pF mF Value IEC Code 0.68mF 680n 0.47mF 470n 0.1mF 100n .056mF   56n .01mF   10n   NA 330p EIA Code   684   474   104   563   103   331 Table 1: Resistor Colour Codes o o o o o o o o o o o o siliconchip.com.au No.   2   2   4   4   2   4   2   2   2   3   1 Value 1MW 910kW 300kW 150kW 100kW 20kW 15kW 2.4kW 2.2kW 1kW 10W 4-Band Code (1%) brown black green brown white brown yellow brown orange black yellow brown brown green yellow brown brown black yellow brown red black orange brown brown green orange brown red yellow red brown red red red brown brown black red brown brown black black brown 5-Band Code (1%) brown black black yellow brown white brown black orange brown orange black black orange brown brown green black orange brown brown black black orange brown red black black red brown brown green black red brown red yellow black brown brown red red black brown brown brown black black brown brown brown black black gold brown May 2007  71 Fig.6: here’s how the PC board assembly fits inside the case. Be sure to use tapped Nylon spacers as specified (not metal), to prevent shorts to the PC tracks. The 10mm countersink M3 screws through the base of the case should also be Nylon, again to prevent shorts on the PC board. to the +12V and 0V terminals on the PC board (the +12V lead goes to the centre terminal of the socket). That done, connect a 9-12V DC power supply to the unit and switch on (warning: do not apply more than 15V to the unit, otherwise zener diode ZD1 will DISPLAY MODES Fig.7: just two of the optional display modes that can be selected: top – Digital & Bar, VU On, Peak On; bottom – Bar, VU On, Peak On. MODE SELECTION become hot and may be damaged by excess current). Now measure the voltage between pins 5 & 14 of IC3’s socket. This should be 5V (anywhere between 4.85V and 5.15V is OK). The voltage on pin 11 of both IC1 & IC2 should be anywhere from -7V to -10V, depending on the input voltage. If you don’t get the correct voltages, switch off immediately and check for wiring errors. If you don’t get any voltage at all, check the supply polarity. Assuming everything is OK, switch off and plug IC3 into its socket, making sure it is oriented correctly. That done, plug the LCD module into its header socket and temporarily support it at the other end on Nylon stand-offs. Now apply power again and check that the display shows “L” and “R” to indicate the positions of the bargraphs. If there is no display or the contrast is poor, try adjusting the contrast trimpot (VR3). If there is still no display, check the connections to the module through the header and sockets. Final assembly Fig.8: the display mode is selected by pressing the Options switch & then stepping through the selections using the Up & Down buttons. These two modes correspond to the displays shown in Fig.7. SETTING THE BLOCK VALUES Fig.9: the individual bargraph block values can be altered using the Mode switch & the Up & Down switches. 72  Silicon Chip Once the checkout is complete, the PC boards can be installed in a small plastic case measuring 120 x 70 x 30mm. The specified case comes with clear lid and is available from Jaycar (Cat.HB-6082). If you are building a kit, then the case may be supplied pre-drilled. If not, then four countersunk holes will have to be drilled in the base in line with the corner mounting holes of main the PC board. In addition, you will have drill four holes at one end for the RCA sockets and a hole at the other end for the DC power socket. Be sure to position the latter hole so that the power socket clears the switch board. Finally, you will need to drill two holes for the switch screws and make a square cutout for the switch actuator. The square hole can be made by drilling a series of small holes around the inside perimeter and then knocking out the centre piece and cleaning up with a small file. Fig.6 shows the final assembly details. First, the integral (moulded) spacers on the base should be ground down to a height of 1mm. That done, secure an M3 x 11mm tapped Nylon spacer (cut it down from a 15mm spacer) to the PC board immediately to the left of transistor Q1 (this spacer supports the lower righthand corner of the LCD module). A second similar spacer is also fitted just below this (to the right of the 2.2kW resistor) to support the righthand end of the switch PC board. The main board can now be installed in the case by sitting it on the 1mm moulded spacers. Secure it along the top edge using two M3 x 10mm countersink screws which go into two more M3 x 11mm tapped Nylon spacers. The bottom edge of the board is then secured using M3 x 10mm countersink Nylon screws and nuts. Once the main board is secured, the LCD module can be installed by plugging it into its header socket and securing it to its three matching Nylon spacers using M3 x 6mm screws. Similarly, the switch PC board is plugged into its header socket and securing it to its matching 11mm spacer at the other end. Finally, fit the DC socket and power switch S5 and complete the wiring as shown in Fig.5. The switch is secured using the supplied M2 screws. Calibration Just how you calibrate the meter depends on the application. First, VR1 and VR2 are used to set the signal siliconchip.com.au The LCD module plugs into the 2 x 7-way SIL sockets on the PC board and is secured to three of the Nylon spacers. The switch PC board (not shown here) mounts in similar fashion and is secured to the fourth Nylon spacer. level sensitivity for the left and right channels respectively. In practice, a true VU meter will show +0dBU when the applied signal is +4dBU. Now 0dBU is 1mW into 600W. Thus, when 1mW is multiplied by 600W and the square root taken (V = square root of Power x Resistance), the voltage is 774mV. 4dBU is 1.584 times greater and so the 4dBU signal level is 1.23V. The peak level will be some 3dB higher than this because the peak value of a sinewave is 1.414 times higher than its RMS value. So if you are replacing existing VU meters, this Stereo VU/Peak Meter should be calibrated to show 0VU with a 1.23V sinewave input. For most other applications, the display readings are set according to the level that produces clipping. With digital recorders, these invariably include a clipping indication that shows whenever the signal goes above the maximum level for digital conversion. This means that the meter should be calibrated so that the 0VU peak block is just displayed at this clipping level. The display range may also be altered to suit your application. A digital recorder would normally use a meter display that shows 0VU at the far righthand block. The values below this can then be set according to preference. For example, you could set each block to display in just 1dB steps, or you could use much larger steps or a combination of step sizes. Larger steps are more useful at lower signal levels, while 1dB steps are best as the signal level approaches the upper SC threshold. Call us today for your FREE Catalogue! Quote “Silicon Chip” when calling Design Made Easy Ñ 1 book Ñ 116,000+ products Ñ 130,000+ datasheets online Ñ 400+ pages of indexes, guides and design tips Range Enhanced Ñ 13,000+ new products Stock Availability Ñ 70,000+ products stocked locally Ñ 40,000+ products stock guaranteed Australia www.farnell.com.au 1300 361 005 New Zealand www.farnell.co.nz 0800 90 80 80 …it all adds up to our best catalogue ever! A Premier Farnell Company siliconchip.com.au May 2007  73