This project is a relay controlled speaker that turns on/off automatically by a Windows PC. It is, sort of, made out of stuff I had laying around. The parts cost sum up to approximately 2$.
The concept here is that the speakers turn on only when there is sound playing and turn off after a short period without sound. I'm not sure that it's a real power saver but its cool to see it automatically power on/off and now I can stick the speaker in an "uncomfortable to reach place" (no pun intended) and enjoy the "hands free" experience.
Extreme caution should be taken when working directly with the mains voltage. The speakers must be unplugged when you are in contact with any part of the electronic circuit. Furthermore, EVEN IF YOU ARE UNPLUGGED, a large enough charged capacitor might still give you quite a shock. So... if you are not sure about what you are doing, don't come close to this project.
Special thanks to the guys at the support forum of "AutoIt" that helped me with the software part of the project.
I take no responsibility for damage to your health or equipment. All damages incurred are the sole responsibility of the end user.
Parts and equipment:
- Soldering iron.
- A long pair of wires.
- A USB to TTL Converter (this is what I had laying around - came with an Arduino mini).http://www.aliexpress.com/item/USB2-0-To-TTL-6Pin-...
- A 3V relay. http://www.aliexpress.com/item/2-x-JRC-21F-3V-3-V-...
Step 1: Connecting the Relay
Connect the pair of wires to the relay coil terminals. Take one wire that leads to the transformer input, cut it, and connect each end to the "normally closed" pair of relay pins. This relay is intended to be soldered on to a PCB but I didn't have one at my disposal and was trying to save space. In case you are not using a PCB as I did, it's considered good practice to use "shrinking wire wrap".
Step 2: Connecting the USB Converter
Connect the pair of wires that lead from the relay coil terminals to the FTD and Vc pins of the USB converter. Plug the converter to a USB port and let Windows install the drivers. The device will make a new virtual serial COM port on your PC. You can view it in the device manager under Ports (COM & LPT).
Step 3: Run the Exe
Run the executable (if you dare) and add it to the "Start up" folder to make sure it runs every time you turn on your PC. You can contact me for the source code (I used a scripting language called AutoIT - use it, it's awesome). I used the windows "EndpointVolume API" to query the "peak meters", you can read more about it here: https://msdn.microsoft.com/en-us/library/windows/desktop/dd316561(v=vs.85).aspx
Step 4: Remarks and Explanation
I read online about the need for something called a "flyback diode" to protect yourself from reverse current damaging your equipment. Found no need for it yet. I'll update this post if something burns down or blows up.
I chose this specific relay because its cheap and to reduce the number of parts (space constraint) and the number of wires going to the PC. The DTR pin produces a relatively low current so the potential difference (with Vc) "buckles down" to about 1.8V, which is "under spec" but barley enough to reliably switch this relay. If you consider using a different relay, make sure that it is compatible with your mains voltage. You can choose a relay with a higher swithcing voltage rating but then you'll have to use a transistor to amplify the current. I tried a 12V rated relay and it was compatible with the USB's 5V. You can also use a complete "USB Relay Module" like:
but I found it to be less compact and a bit pricier.