Skip to content

Repository files navigation

RemoteSpark

RemoteSpark is a small, secure remote power-button controller for a desktop PC.

It provides a budget-friendly way to power on your PC remotely using an ESP32, a small relay or optocoupler, and a few simple connections.

This is a personal hobby project for experimenting with ESP32 firmware, Tailscale-compatible networking, and remote hardware control. It is not an official Tailscale product, and it is not intended to be safety-critical or production-grade. Review the wiring and firmware for your own hardware before connecting it to a live computer.

Device

  • Controller: Freenove ESP32 board using an ESP32-WROVER-E module
  • Wireless connection: Wi-Fi
  • VPN: Tailscale-compatible connectivity through the community MicroLink ESP32 client
  • Output: Relay or optocoupler connected to the PC motherboard's power-switch header
  • Target motherboard: MSI B450M-A PRO MAX, system ID MS-7C52

Required hardware

Typical budget: approximately $10–25 USD, depending on the board and what you already have available.

  • ESP32-WROVER-E development board: approximately $6–15
  • 5V-compatible relay module or optocoupler: approximately $1–5
  • Jumper wires or suitable connectors: approximately $1–3
  • USB cable and always-on USB power supply: approximately $2–7
  • Optional: small enclosure and mounting hardware

The WROVER-E module includes external PSRAM, which makes it a suitable ESP32 target for MicroLink. This project uses a 4 MB flash device with external PSRAM.

What it does

RemoteSpark powers on the PC from an authorized device on the Tailscale network, while keeping the controller available when the PC is shut down.

The controller exposes a small authenticated HTTP endpoint over its Tailscale address. A request pulses the power-control output for 700 ms, equivalent to pressing the PC case power button.

Hardware setup

Wiring diagram

The diagram below assumes a relay module with VCC, GND, IN, COM, NO, and NC terminals. The relay contact side is isolated from the ESP32 input side.

flowchart LR
  subgraph ESP32["ESP32 WROVER-E"]
    V5["5V / VIN"]
    GND["GND"]
    GPIO["GPIO 2"]
  end

  subgraph RELAY["Isolated relay module"]
    RVCC["VCC"]
    RGND["GND"]
    RIN["IN"]
    COM["COM"]
    NO["NO"]
    NC["NC - unused"]
  end

  subgraph MB["MSI B450M-A PRO MAX - MS-7C52"]
    P6["JFP1 pin 6 - Power Switch"]
    P8["JFP1 pin 8 - Power Switch"]
  end

  V5 --> RVCC
  GND --> RGND
  GPIO --> RIN
  COM --> P6
  NO --> P8

Loading

Use only the relay's COM and NO contacts on JFP1 pins 6 and 8; polarity does not matter for the motherboard power-switch circuit. Do not connect ESP32 GPIO, 5V, or GND to either JFP1 pin. Verify that the chosen relay module accepts a 3.3V GPIO trigger and that its coil supply matches the available 5V supply.

This project was developed and tested against the exact motherboard model MSI B450M-A PRO MAX (MS-7C52). Other motherboard revisions or models may use different headers or pin assignments. The MSI motherboard uses the JFP1 front-panel header. Its power-switch contacts are:

  • JFP1 pin 6: Power Switch
  • JFP1 pin 8: Power Switch

Connect the relay's normally-open contacts, or the isolated output of an optocoupler, across pins 6 and 8. The controller must only close this circuit momentarily.

Recommended arrangement:

ESP32 GPIO -> relay/optocoupler input
relay COM + NO -> motherboard JFP1 pins 6 and 8

Do not connect an ESP32 GPIO directly to the motherboard header. Power the ESP32 from an independent, always-on USB supply; motherboard USB power may not remain available while the PC is off.

Avoid ESP32 pins reserved for flash or PSRAM, especially GPIO 6–11 and typically GPIO 16–17. Select a free GPIO after checking the specific Freenove board schematic.

Remote access flow

Phone/laptop on Tailscale
        |
        v
ESP32 WROVER-E on Tailscale
        |
        v
Relay/optocoupler -> JFP1 pins 6 and 8 -> PC powers on

After the PC boots, its own Tailscale client can be used for normal remote access.

Current firmware

For bench testing, the output is configured by default as GPIO 2, which is the built-in LED on many classic ESP32 boards. A successful POST /power request flashes that LED for 700 ms. Confirm the exact LED GPIO and whether it is active-high on the specific Freenove board before connecting a relay; the GPIO must never be connected directly to the motherboard header.

  1. Build and flash MicroLink using ESP-IDF.
  2. Register the ESP32 with a restricted Tailscale authentication key.
  3. Run a minimal HTTP or similar control service on the ESP32.
  4. Require an application token in addition to Tailscale network access.
  5. Configure the power endpoint as a momentary pulse, not a latched output.
  6. Add rate limiting and a clear status response to prevent accidental repeated presses.

MicroLink is a community implementation rather than an official Tailscale ESP32 client, so firmware updates and reliability should be tested before relying on it remotely.

Build, flash, and monitor

ESP-IDF is expected in the local .esp-idf/ directory and Python 3.12 is managed automatically through uv. After connecting the board, the normal workflow is one command:

make flash

The default serial port is /dev/ttyUSB0. Use another port with:

PORT=/dev/ttyACM0 make flash

Other useful commands are make build and make monitor.

Web control page

Once the monitor reports the device's Tailscale address, open:

http://100.x.x.x/

The page displays controller status and has a confirmation-protected button that sends POST /power. The JSON status endpoint is:

curl http://100.x.x.x/status

The power endpoint can also be called from a terminal:

curl -X POST -H 'X-API-Token: replace-with-your-token' http://100.x.x.x/power

The power pulse is limited to one request every 10 seconds. The service is protected by the configured CONFIG_REMOTESPARK_API_TOKEN in the X-API-Token header. Keep the token in local sdkconfig only and never put it in a public commit. The dashboard asks for the token once and stores it in the browser's local storage for subsequent requests. The service uses plain HTTP and must remain tailnet-only.

Tailscale connectivity

The MicroLink client has been tested with the Tailscale control plane, DERP relay connectivity, STUN endpoint discovery, and direct WireGuard peer paths. DERP remains available as a fallback when a direct path cannot be established.

Known limitations

  • MicroLink is an independent community implementation, not an official Tailscale ESP32 client.
  • Testing targets an ESP32-WROVER-E and the MSI B450M-A PRO MAX (MS-7C52).
  • The HTTP service has no TLS and must not be exposed to the public internet.
  • Relay wiring and the power GPIO must be validated manually for each board.
  • Firmware updates and remote power control remain experimental.

Safety notes

  • Keep the PC power supply connected to mains and switched on; software power-on cannot work if mains power is physically removed.
  • Use an isolated relay or optocoupler where possible.
  • Test the relay locally before enabling remote access.
  • Keep the ESP32 control service tailnet-only; do not expose it through public port forwarding.
  • Store Wi-Fi credentials, Tailscale keys, and API tokens outside committed source files.

About

ESP32 remote PC power controller over Tailscale

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages