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
Step 2: The Software Description
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)
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)
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
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.