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.
-Some wires
-Solder
-Paste
-Soldering iron


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:

Comments

author
Hycro (author)2009-01-12

This is one of the more interesting Instructables I've found on here, now I could turn my sub amp on/off with software on my computer, instead of just hooking a relay to one of the many +12V lines from my power supply in my computer.

author
Padlock (author)2008-08-06

Hello, I have a question: Is there a way to create two seperate files, where if you run file1 it sets pinx high, and if you run file2, it sets pinx low? I have no knowledge of vbs, at all. I appreciate the help. I am trying to make a device so that when my computer turns on, it triggers a relay and turns on my external speakers, but when my computer goes off, it turns off the relay and there for turns off my external speakers. So if possible I would need a continuous high, although I could (rather not though) implement it for a momentary high.

author

You can as well not use VB at all. Just connect the 12Vdc supply to a relay directly and use that relay to switch the amplifier. So when the powersupply goes on, the amp goes on. When the ps goes off, so does the amp.

author

*its supposed to be "via" where it says "veiw".

author

You can make a program that sets HIGH pin X. By placing it in the Startup Folder. Then you can make a batch file that runs another program that sets it LOW. and after the program runs, insert this call: c:\windows\system32\shutdown -s -f -t 00 and make a shortcut on your desktop and use it to shutoff your PC instead of the usall Start->Shut down.

author

I just don't know the VB. Which is why I came here.

author

I know batch quite well, I just need to figure out the VB for it. And thats what I was planning to do from the start, too.

author

When I shutdown my computer, Power is still supplied to my ports, veiw the standby line on my powersupply. So even when my computer is shutdown, the is still power, unless I turn it completely off, which I do not want to do.

author
Gjdj3 (author)2008-07-22

Nice job. That looks cool and functional (those two things don't go together that often). One suggestion though. Upload the program you wrote so that people who don't program in VB can get it. Other than that though, cool Instructable.

author
unknownpocketnerd (author)Gjdj32008-07-25

Thanks! It's done. You can download the .Zip file with everything you need, although the .Exe file is compiled to use pin 9 of the LPT1, if you want to use another pin, then change and rebuild the file.

author
Gjdj3 (author)unknownpocketnerd2008-07-25

Thanks. I'm surprised this instructable didn't get more attention.

About This Instructable

4,128views

10favorites

License:

More by unknownpocketnerd:Resurrect a burnt cordless drillCheap solar heaterSimple & Cheap Analog to Digital converter
Add instructable to: