I used this for my own very specific problem but it could be used for anything really.
Most speakers are not smart, and so you have to turn them off manually, especially studio monitor type speakers. Because of this when left on (if you fall asleep or just forget switch them off), they waste a fair bit of power.
In my bedroom setup for gaming, movies, music production etc. I have a pair of Studio monitors and a sub that are all fairly power hungry even when not really making any sound, so I made a little gizmo that controls them based on when my PC is on, since that’s when I want the sound. One of my monitors also does not sleep properly when it has no signal, leaving quite a lot of light in the room.
Using the pin on the motherboard for the power LED on my PC, the Arduino board can detect if my PC is in a state where it is being used, as well as when that LED is off to indicate that the PC is sleeping or off. I have the Arduino linked up to a wireless remote for a mains plug and the program just presses the on and off buttons for me when the power indicator LED comes on or off.
Don’t freak out though, there’s only one wire going from the motherboard to the Arduino and it’s super simple and beginner friendly 🙂
Having experimented a lot with different projects to try and solve this problem, I can safely say that this is better than more complex ways of trying to do something like this. Feel free to skip this but If you’re interested, here are the previous over-the-top systems I had to control this:
Remote controlled Mains plugs. My remote was similar to this but different plugs. It shouldn’t matter really as long as it has buttons.Ebay remotes
Opto Isolators. This is what allows the Arduino to press the buttons on the remote without being electronically connected to it. It uses light rather than electricity to close the switch so it doesn’t matter what voltage the remote is on. I got mine from maplin. You need as many channels as buttons you want to be able to press from the Arduino (in my case 2).Opto Isolator
Perfboard. Good for making a more robust prototype but you could use a breadboard instead.
470 Ohm resistors x2. The Opto-Isolators use LEDs inside so we need a resistor to get the voltage right on the LED from the Arduino’s 5v
Some wires with female ends. These help to make the motherboard connection neat. Some other short wires are needed too.
Open up the remote and identify the switches that you want to take control of. Solder to the sides of these as shown in the picture. It doesn’t matter if you pick the pair of legs I did or the other two, they’re connected in this switch type. When you’ve soldered these, connect the battery and then try touching the pair of wires together to test that it flips the switch. If not then you might have connected the wrong pads or not soldered it solidly.
Line up the IC on the perfboard and then trim it to size. When it’s in the right place, solder the legs to the underside of the perfboard. Start with one leg to get it in place.
My opto isolator has 4 channels because that’s what maplin had at the time but I’m only going to use 2. It confused me at first that the adjacent LEDs inside are opposite ways round to each other so be careful about that part. Add the resistors in line with pins 1 and 4.
Use a knife or a loose drill bit to cut the connections between the resistor legs since you want it in series.
The way this thing works is that it’s an LED inside a tiny box with a phototransistor so when the led is turned on, the phototransistor goes conductive, which is basically the same as pushing that switch you soldered to. This allows the Arduino to control whatever buttons you want without being electrically connected, so it can work with any circuit!
Add in the wires from the other end of the resistor. I used wires with pins on the end just because they’re easy to insert and reinsert into the Arduino pins.
Solder pins 2 and 3 together then put a ground cable in line.
Add the pairs of wires for the button switches up to the pairs of phototransistors. These are in pin pairs as 13 & 14, 15 & 16. The polarity needs to be right on this but it won’t break anything if it’s wrong, it just won’t do anything. There’s no solid way of knowing which way around it should be without really knowing the PCB design so you’ll just have to see if it works later and if not then swap the wires around. For me one worked straight away, the other didn’t so I flipped it and it worked.
The Arduino is powered over USB and this is also how we will program it. I used a wire threaded through a slot at the back to a USB port at the rear of the PC. One more wire and then it’s ready to program.
Disconnect the positive power LED connector pin and replace it with your own female ended wire that is stripped at the other end. I spliced in a second wire (single core) to reconnect with the actual power indicator LED because you do still want that to work 😉 Connect the stripped end to the A0 pin on the Arduino board and then we’re ready to program.
Upload the following code: (make adjustments for the pins you are using)
Give it a go. Try putting your computer to sleep and waking it again.
So something’s probably not going to work immediately, but that’s ok. We can work through it. Assuming you’ve got your code uploaded here’s the order I would go through things in to find out what’s not working:
Now you can link up whatever you want to control on those mains plugs and they’ll turn on and off with your PC. I have my Studio Monitors, Subwoofer and one of my screens linked to it because those devices don’t sleep properly with my computer but now I can make them!
Try adding more channels to control more stuff and you can add more inputs like an infrared sensor to detect when you’re in the room and turn a lamp on or something. You can do a lot more with this and it’s really just repeating these steps with more channels. I’m sure if you just have a glance around the room you can think of a few cool projects.
Original post by randomthumper
In this project by AlexGyver over at instructables we learn how to…
If there’s one thing that’s the same about everyone’s broadband…
Got yourself a shiny new Raspberry Pi or you may…