Introduction: Digital Control of Your Loudspeakers
If your desktop pc's soundcard is connected to an external amplifier, and you are tired of un/plugging it and switching it on/off, you're going to love this instructable.
Step 1: Mounting Your Amplifier and Loudspeaker
I have a Desktop PC that I salvaged from the junk and on which I replaced the motherboard with one I got from my brother.
It is an AMD 1.2 GHz processor with 256 MB and 8 GB HD. The cabinet is an old Compaq Prolinea 4/25s that had a 486SX on it.
It took some effort to adapt the newer motherboard, but now it works. I recently bought a loudspeaker at a fleamarket for 1 US$.
I did't like the fact that I had to plug/ unplug turn On/Off the thing every time I wanted to watch DVD or videos I dowloaded from Youtube
So I thought of installing the amplifier board and speaker inside the cabinet, but then I had to drill more holes for the On/Off switch.
So why not having a virtual control under XP to turn On/Off the amp, so I could use my headphones at night or my speaker during day?
On most motherboards that have a soundcard in them, there are some where a group of pins or terminals where the audio IN/OUT can be obtain. I just played some music an used the input of the amplifier to detect the pins that had the audio signal on. You may also google the web for your own make and model and download the layout to connect your amplier input to the right pins.
So remove the printed circuit board and the speaker from your amplifier and mountem in your pc's cabinet. Make sure the board makes no contact with the metal of it (use somestuff, like plastic spacers) and bolt it.
Then you'll need this:
-A 12 VDC (coil) relay
-A low power NPN transistor (like 2N2222 or BC548)
-A low power diode (Like 1N4148 or 1N4001)
-A 1kOmh - 4.7kOhm low power resitor.
Step 2: Wiring Everything
First I mounted my speaker and amplifier board inside, used a 12 VDC relay to switch the 110 VAC supply to it.
Next I used a low power NPN transistor (like BC584), a low power diode to catch reverse emf from the relay, and a 1kOhm resistor to bias drive the transitor's base
I used 12 VDC supply from the spare harddisk/floppy connectors.
Step 3: Chose an Output Pin From Your Parallel Port.
I used 12 VDC supply from the spare harddisk/floppy connectors and used pin 9 from the parallel port (bit 7) to drive the transisor.
You have 8 pins to use (2-9) corresponding to the 8 bits of port LPT1. You can use any of these. You can use the rest co control external stuff in the future.
Find the track or pad where the pin you choosed goes to and solder your resistor there (so if you short the cable, nothing gets damaged). Then solder it to the transistor's base. Like in the
Step 4: Make Your Program
Now you want to control the relay from Windows. So you need Visual Basic or other visual programming software like C or Delphi.
I like Visual Basic, So I just downloaded free from the Web the file Inpout32.dll which I need to interface the parallel port. It has to be copied to your Windows/System32 directory and then you just make a module in your VB project for the declaration of the two functions IN/OUT. My program has only one button which you toggle and it sets Bit 7 (pin 9) On/Off thus switching the relay.
If you have any experience in VB, you can fancy it or just copy my listings, mine is very simple as it has only one button to toggle On/Off the pin.
Then you just build the .exe file.
As suggested in the forum, I added a .Zip file with the VB project, the library, and the compiled .Exe file ready to run.
Step 5: Test It.
Once you have tested it, you can generate your executable file. You may also want to put a shortcut on your Startup directory, so it is loaded at start up. This is how mine looks: