PC Smart Power Controller

by InterlinkKnight in Circuits > Arduino

193 Views, 4 Favorites, 0 Comments

PC Smart Power Controller

Thumbnail.jpeg
PCB fill.jpeg
PC Smart Power Controller (by voice)

I created a device that allows turning any desktop computer ON and OFF using any smart plug through an Arduino nano and some electronics. PCB sponsored by PCBWay - Full feature custom PCB prototype service: https://www.pcbway.com/

Think of it as the PC being controlled like a standard smart plug but doing it in the correct way, pressing the power button to bootup and shutdown as computers normally do.

It has an optional IR receiver so it can power the computer ON/OFF using any standard IR remote control. Hold the LEARN button while pressing the remote control button and it will store it to power toggle the computer.

Description of behavior:

  • When the PC is OFF and the Plug is OFF:
  • If the PC is turned ON, the Plug is going to turn ON.
  • If the Plug is turned ON, the PC is going to turn ON.
  • When the PC is the booting process (the first few seconds), the Plug is also ON:
  • If the Plug is turned OFF, the device is going to turn the Plug ON again.
  • After the booting process period is finished, now the Plug is allowed to turn the PC OFF normally.
  • When the PC is ON and Plug is ON:
  • If the PC is turned OFF, the Plug is going to turn OFF.
  • If the Plug is turned OFF, the PC is going to turn OFF.
  • When the PC is in the shutting down process because the Plug turned OFF:
  • If the Plug is turned ON while the shutting down process, it will stay ON but it’s not going to have any effect on the PC. When the PC finishes shutting down, the plug is going to turn OFF.
  • If too much time passes and the PC does not finish shutting down, the device is going to turn the Plug ON, or is going to remain ON if it was ON.
  • When the device gets power
  • If the PC was already ON
  • If the Plug was ON, the device is not going to do anything, but it will enter into a period where the plug can’t turn the PC until that period finishes. It is only a few seconds, the same as the booting process.
  • If the Plug was OFF, the device is going to turn the Plug ON and it’s going to wait for the booting process to finish until the Plug can turn the PC OFF.
  • If the PC was already OFF
  • If the Plug was ON, the device is going to turn the Plug OFF.
  • If the Plug was OFF, the device is not going to do anything.

Supplies

PCB empty.jpeg

Materials:

  1. Arduino nano: https://amzn.to/3iru0op
  2. Custom PCB: order from PCBWay.com using these gerber files.
  3. Smart plug. Any should work but I used this one: https://amzn.to/3xlgQD3
  4. PC817 Optocoupler: https://amzn.to/3J1XdSP
  5. Resistors 330, 1K, 10K: https://amzn.to/3TLQD7Q
  6. 3mm LED: https://amzn.to/3VLUq7U
  7. Push Button 6x6x12mm: https://amzn.to/3VpJGJr
  8. 3-Pin 5.08mm Pitch PCB Screw Terminal Block: https://amzn.to/4cAHZSx
  9. 4-Pin 5.08mm Pitch PCB Screw Terminal Block: https://amzn.to/49C8nsB
  10. IR receiver like TSOP4838 or similar: https://amzn.to/3U1X8VH
  11. M3x12mm Self-Tapping Screws: https://amzn.to/3VGwX52
  12. Label stickers


Recommended Tools:

  1. Loctite Liquid Professional Super Glue https://amzn.to/2N7d1He
  2. SpeedEII Electric Screwdriver: https://amzn.to/3VzTkcD
  3. Multimeter (Fluke 17B+): https://amzn.to/2L3PNQk


Note: As an Amazon Associate I earn from qualifying purchases.


Files:

  1. Download Arduino Sketch
  2. 3D printed parts (I recommend PETG material).
  3. Custom PCB - you can order from PCBWay.com using these gerber files.

Prepare Smart Plug

Smart Plug.jpeg
Smart Plug button.jpeg
Smart Plug LED.jpeg
  1. Setup the smart plug with your home and make sure it works correctly. The process depends on the brand and protocol, but usually it connects to your WiFi through an app. Then the account is linked with Google Home, Alexa, or whatever voice assistant you want.
  2. Open the case of the smart plug. You might need to break the plastic to be able to open it. You later are going to need to glue it back together so try to not destroy the case.
  3. Solder two wires to the push button pins. I recommend using wires of different colors taking note of where they are connected.
  4. Solder two wires to the LED pins. Make sure you are soldering into the actual power indicator LED, because there might be a bi-color or even RGB LED that has more than two pins so you need to check with a multimeter which one indicates the power state of the plug. I recommend using wires of different colors and take note of the polarity.
  5. Check the wires connected to the power LED send voltage (should be around 3 V) when the plug is ON and 0V when the plug is OFF, and when you short the button wires it should toggle the plug ON/OFF.
  6. Make a hole on the case to pass the wires and glue everything back. I used Loctite Liquid Professional Super Glue https://amzn.to/2N7d1He

Prepare PC

PC connection.jpg
  1. Open your computer case and identify the two wires that go to the power button and the two wires that go to the power LED. They all go from the case to the motherboard.
  2. We need to get those 4 wires out of the PC case so you can either solder wires directly or create an adapter that splits the wires in a way that goes in between the original connectors and the motherboard. I recommend using wires of different colors taking note of where they are connected.
  3. Test shorting the wires for the power button to make sure it actually turns the PC ON/OFF, and check that we get voltage in the power LED wires when the PC is ON, that should be around 3 V.

PCB

Diagram.JPG
Schematic_PC-Smart-Power-Controller_2024-04-02 (1).png
  1. Upload my arduino sketch to the arduino nano you are going to use. It’s a little hard to test that it’s working since we don’t have anything connected yet, but you should see in the serial monitor a constant information about the state of the board so that’s one way we can see if it’s working correctly.
  2. Either solder the components to the PCB, or connect everything in a breadboard as shown in the diagram. Before soldering the LEDs, make sure to add the LED spacer 3D print so it has the correct separation to the PCB.
  3. Connect the wires coming from the computer to our device. Make sure the LED in the PCB indicates the state of the computer.
  4. Connect the wires coming from the smart plug to our device. Make sure the LED indicates the state of the smart plug, and see if everything is working. The button LEDs should indicate when the device is pressing those buttons.
  5. If you want to add the IR receiver, test that. Remember to press the LEARN button while pressing the remote control of your choice.

Final Details

Device closeup.jpeg
  1. Install the PCB in the 3D printed case.
  2. Add the stickers to the case.