Volume Units (VU) meters have always been the most fun and simplistic projects for electronic lovers and hobbyists. VU meters are those little gizmos on your stereo or other audio electronics that show how strong or loud the audio signal is. There are literally dozens of different audio metering systems in common used around the world and they often appear to read completely differently when supposedly displaying the same audio signal such as we could have a full fledge audio spectrum analyzer that can display the intensity of different frequency signals within the same audio signal but they are moreover used in the professional audio analysis only and are not suitable for everyone’s purpose. For basic purpose, simple VU meters are more than enough to have a literal idea about the loudness of your audio signal and are amongst the simplest of meter designs, and they have been used since the very beginning of the audio broadcasting and recording industry. There are two basic kinds of VU meter: An “analog” meter, which looks like a dial with a moving needle; and a “digital” meter, which uses some sort of level comparison to trigger ON lights (e.g. LED bar-graph),the more lights are ON, the louder the sound. VU meters are inherently cheap, though, whether in the form of a moving-coil meter or as a bar-graph of LEDs. This is principally because there is no complex peak-sensing driver circuitry involved and as a consequence, VU meters tend to be used in order to cut costs where the meter needs only to provide an indication that the sound is reaching a particular level or not.
Presented here is a very simple PC parallel port drivenVU meter that displays the audio intensity of your sound signal that is being played on your computer system. Although in nearly most of the VU meter designs, the capturing and processing of audio signal is handled by a specific circuitry that adds cost to the project apart from the display circuitry. Here in our project the capturing and processing of audio signal is handled by the computer itself running a simple visual basic application and the display circuitry is driven by the computer’s parallel port. Now as the processing of audio signal is done in the computer itself, it inherently simplifies the circuit complexity of the project and reduces the cost. Thus only display part is needed to be designed. Two hardware circuits are presented here that can be connected to the computer’s parallel port to display the VU levels. One circuit is designed to drive a simple array of LEDs while the other to drive mains 220v AC powered lamps displaying the volume level of the audio signal.
Step 1: Block Diagram Description
The project uses the very simple audio capturing technique from computer system. A visual basic application is designed which uses the windows multimedia library that is used by the windows operating system to play and capture audio signals through the audio device available on your system. With the help of this library the software samples the audio played through the sound channel and decision making is done to drive the LEDs/lights connected to the parallel port of the computer. The “inpout32” library is used to access the parallel port of the computer. Thus the application drives the LEDs/lights connected to the parallel port after processing the audio signal samples. Due to the limitation of the input/output pins available on the parallel port, only eight LEDs/lights can be driven to display the volume intensity. The software section is thus responsible only for generating logic signals through the parallel port to drive the eight outputs. The status of lights and full VU display for left and right audio channels is displayed on the software interface. The next section is the display section. The logic signals on the parallel port are used to drive the LEDs and opto-couplers section which then will be used to drive the TRIACs and thus driving the mains 220V AC powered lamps. Thus in a nutshell, the logic signal generated by the software according to the audio level on the parallel port will drive the corresponding LED and opto-coupler. The opto-coupler then switches ON/OFF the TRIAC associated with it and lights the lamp. There are two versions of hardware associated with the project for the display section. One uses simple LED array, while the other can be used to drive mains 220V AC lamps.
Step 2: The Software Description
The software for the project has been designed in Visual Basic 6.0 which is a rapid application development tool from Microsoft used for synthesizing application for the windows operating system. The audio capturing and processing section for the software is built around the Windows Multimedia (winmm) library. “winmm” is a module for the Windows Multimedia API, which contains low-level audio functions which can be used to access the real-time audio data streamed through the computer’s audio driver. To access the functions of the “winmm” library, a visual basic module “WaveAudio.bas” is written which declares all the variables and functions that will be used to process the real time data.
The next section within the software is the main form module itself which holds all the code required to handle the user interface of the software. To access the printer port of the computer, a function “Out” has been declared which is called from the input-output library (inpout32.dll). We use this function to output any data to the parallel port. However functions for reading the parallel port are also available within the same library, but we do not have such requirements in our project. The “Out” function is fairly simple to deploy and uses only two arguments to work. One is the parallel port’s physical address itself that is usually 378(hexadecimal) on most of the computers, and other is the 8-bit data itself which is needed to be sent.
On the top-right of the application, a settings frame has been drawn which holds the audio device selection combobox, parallel port selection combobox and the left or right channel selection option buttons. The audio device selection combobox can be used to select one of the audio hardware drivers available on your computer which you want to sample the audio signal from. The parallel port selection combobox can be used to select the parallel port physical address on your computer. And as the 8 LEDs/lights on the parallel port can only display one of the left or right channels only, so the sample channel option buttons enables you to choose from either the left or right channel of your audio signal to sample from.
On the mid-left of the GUI, two LED meter components have been drawn which are used to display the sampled audio intensity from the left and right channels of the audio signal. This led-meter component is derived from the “LedMeter.ocx” activex object. On the mid-right of the GUI, eight circular shapes have been drawn which imitates the status of the eight LEDs/lights connected to the parallel port. On the very bottom of the GUI, four buttons named “START”, “STOP”, “RESET” and “EXIT” will let you start/stop the VU meter, reset the outputs and exit the application.
Other important functions used in the main module are “EnumDevices” and “Capture”. “EnumDevices” functions is called in the load event of the form module. It is basically used to get the list of physical audio hardware devices available on the computer system from which the user can select one as the default channel for sampling. The function generates the list and updates it onto the audio devices selection combobox on the settings frame. “Capture” is the function where all sampling and decision making takes place. Here a 512 byte buffer is dimensioned which will hold the samples for the left and right channels at even and odd places respectively. “waveInPrepareHeader” and “waveInAddBuffer” are then called to start the capturing process from “winmm.dll” and asks the sound driver to fill the buffer with the audio samples. When the buffer is full, the process is stopped. The default sampling settings in the software is set to “WAVE_FORMAT_PCM” format, 2 channels, 8-bit sampling at 22.05 KHz, which the user can change according to his needs. Now the reading of the buffer starts for right and left channel accordingly and for each sample, it gives you a number between 0 to 255 to give the intensity of the audio signal for the particular channel. It is to be noticed that the sample value returned is 127 when nothing is played back and it goes to 0 max for negatively going signal transitions and to 255 max for positively going signal transitions. So when nothing is being played, a value 127 or near is returned and the LedMeter component on the software will be right in the middle. However in the project we used the scale between 127 to 255 to turn on the lights by first converting it to a scale of 0 to 100 and then dividing it into 8 equal parts for level triggering each of the eight bits on the parallel port. Thus the 8 shapes on the software GUI are updated accordingly and “Out” function is the used to switch ON corresponding LEDs/lights connected to the parallel port. The user can select to sample either the left or right channel as per his need during the runtime as this is checked every time after the capturing has taken place.
Step 3: Circuit Description(LED Based)
As capturing and level comparison of the audio data has already been taken place on the computer side, only display hardware is now required to display the volume levels. Two circuits have been designed here for the purpose. The first is very simple one that uses an array of eight LEDs connected directly to the parallel port data outputs. This circuit has both its advantages and disadvantages: It is easy to build, does not use mains voltage, and it does not endanger your parallel port in any way. However, the LEDs are not as bright as normal mains powered lights, so you probably can't use them at a party. Also you can't use super bright or high current LEDs as those LEDs draw too much current, and the port will not be able to power them. This circuit for this LED based display section is shown in the above figure.
The 8-bit data outputs are taken from the parallel port via the pins D0, D1, D2……D7 those are physically located on pin number 2, 3, 4, 5…...9 on the DB25 parallel port as shown in the circuit. Pin number 18 to 25 are the ground pins connecting to the common cathodes of the LEDs series. Two LEDs in series along with a current limiting resistor are connected to each bit output on the parallel port from D0 to D7. Hence for each level incremented in the audio intensity, two LEDs will glow. It is up to the choice of user only, he can use only one LED for each channel instead of the two or moreover can also increase the number by using a current driver circuit like ULN2003, etc or transistor based drivers. It is important to note that each pin on the parallel port can not source more than 20mA of current so if you use more LEDs, you have to add a driver circuit for the same.
Step 4: Circuit Description(AC Lamp Based)
The second circuit is the one which can be used to drive higher loads like mains 220V AC lamps up to 100watts on each of the eight output channels. This circuit too has both its advantages and disadvantages: It is fairly complex to build, does use mains voltage, and as it does connects to your parallel port and directly to 220V AC mains, so a little bit of precautionary measure is required to use this circuit. However, the 220V, 100watt AC lamps are bright enough, so you use them at a party. The circuit for the AC lamps based display section is shown in above figure.
Again, the 8-bit data outputs are taken from the parallel port via the pins D0, D1, D2……D7 those are physically located on pin number 2, 3, 4, 5…….9 on the DB25 parallel port as shown in the circuit. Pin number 18 to 25 are the ground pins. Now, to drive the mains rated AC lamps, we use the TRIAC here as a switch. To drive the TRIACs and to isolate our +5 volt parallel port logic circuitry, we use the opto-coupler MOC3041. An opto-coupler is a device which is used to keep low-voltage circuits such as the very delicate parallel port and high-voltage (mains) circuits apart. They generally consist of 1 or more Infrared LED's pointing at a detector. The detector is used to trigger the TRIAC. Sometimes, as is the case with the MOC3041, there is a Zero-crossing detector also incorporated into the same package. Pin number 1 and 2 of the MOC3041 opto-coupler has the LED which acts as a signal transmitter inside the opto-coupler. We connect an external LED in series with this opto-coupler LED along with a current limiting resistor directly to the data lines of the parallel port for each of the eight output channels. The ground lines are shared by all the cathodes of opto-coupler LEDs and connected to pin 18 to 25 of the parallel port. The other side that is the detector side of the opto-coupler at pin number 4 and 6 is connected to the TRIAC pins via 470 and 330ohm resistors as shown in the circuit. The traditional way of proportionally controlling mains electricity is by using a TRIAC. These 3-terminal devices can be triggered to act as an on-off mains switch. Once they are turned on, they stay on until the voltage across them is reversed. This will happen every half of an AC cycle. To accurately control the power you need to know where you are in the mains cycle, so you can turn the TRIAC on in the appropriate place. However the purpose of ours is just to ON/OFF the load, and the zero crossing detector built already onto the MOC 3041 opto-coupler serves the purpose for us by switching the TRIAC on every reverse cycles of mains AC according to the control signal input. BT136 or any general purpose TRIAC with rating more than 4A, 400V can be used here. A combination of 39 ohm resistance and 0.01uF, 400v mains rated capacitor is used as a protection for the TRIAC, however they are optional but are recommended to be on the safe side. The correct pins of the BT136 TRIAC are shown in the second figure.
To be on the safe side, it is recommended to use 0.5 watts resistor for the 470 ohm and 330 ohm value ones that connect the MOC3041 opto-coupler and the BT136 TRIAC, however 0.25 watts will also work fine. The mains 220V live input is fed to the MT2 pins of all TRIACS in series with an 8A fuse as shown in the circuit, while the MT1 pin goes to one of the terminal of the lamp and other terminal of the lamp goes to the mains neutral wire.
Step 5: Test and Setup
Install the visual basic application on your computer system. After you have constructed either the LED based or AC lamp based display circuit as per your choice, connect it to the parallel port of your computer system. Open your “Volume control” settings either from the control panel or from the bottom-right of the taskbar of your computer as shown in figure 1.
Then go to the “Options” menu in the menu bar of the volume control window and choose “Properties”. The following screen will appear as shown in figure 2.
In the “Properties” window, click the “Recording” option button and then from the list below, check mark on “Record Mixer” and click on OK. Now the following screen will appear as shown in figure 3.
Now mark the “Select” check button of the Record Mixer section and set volume to maximum as shown in the screenshot. Run the VU Meter application. In the application, on the top-right settings frame, select the default audio driver hardware of your computer. Then select the physical address of your parallel port on the computer(default 378). Select either the left or right channel to sample, you can change this afterwards also. Now click on “START” button. You will observe that the green level in the LedMeter on the software will be right in the middle. Now play any song or anything on your computer, you will notice the LedMeter bars and Lights status LEDs on the software will follow the beats of your audio being played and the same sequence the display section consisting of the LEDs/AC lamps will follow.
Step 6: Precautions
The LED based display circuit is not only simple in construction but also safe to implement. It will not do any harm to your computer’s parallel port. While implementing the AC lamp based circuit for display section, some precautions must be kept in mind before powering the circuit for the first time which are described herein. It is recommended that if you design your own PCB for the AC lamp based circuit, the traces of the PCB especially which carry the mains AC power must be thick enough to handle higher currents. A 220V, 100 watt lamp for example consumed about 0.45 A of current, so traces must be so designed that they can handle more than 0.45A current. For example for a trace of length 10mm with 35um of copper thickness, to carry 1A current at ambient 25’C temperature its width required is about 300um(11.8 mil). It is good to give a fair distance between the traces of the parallel port circuit connections to the opto-coupler and the mains 220V AC carrying traces to the TRIACs, etc. Next consideration is to house your circuit in a plastic or non-conducting enclosure only because the circuit runs on mains 220V. Before soldering your TRIAC it is good to recheck for the correct pins otherwise it can harm the TRIAC or to the circuit. Do not skip the 8A fuse, otherwise you may damage your mains wiring if something wrong happens. Also the wire used to carry 220V from mains wall socket to the circuit must be capable of carrying more that 5 A of current or equivalent. At last always recheck for the connections and wiring before you plug it for the first time.