Skip to content

Lars-Jacobs/esp32_remote_wake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP32 Wake-on-LAN with MQTT Control

ESP32-based Wake-on-LAN controller with MQTT integration and LED strip control. This project allows you to remotely wake your PC and control an LED strip via MQTT messages over a secure HiveMQ Cloud connection.

Features

  • 🔌 Wake-on-LAN: Send magic packets to wake your PC remotely
  • 💡 LED Strip Control: Control WS2812/SK6812 addressable LED strips via MQTT
  • 🔐 Secure MQTT: TLS/SSL encrypted connection to HiveMQ Cloud
  • NTP Time Sync: Automatic time synchronization for SSL certificate validation
  • 📡 Wi-Fi Connectivity: Automatic reconnection on network loss

Setup Instructions

1. Configure Credentials

Copy the credentials template file and fill in your information:

cp main/credentials_template.h main/credentials.h

Edit main/credentials.h with your actual credentials:

// Wi-Fi credentials
#define WIFI_SSID "your_wifi_ssid"
#define WIFI_PASSWORD "your_wifi_password"

// MQTT broker settings
#define MQTT_BROKER_URI "mqtts://your_broker_address:8883"
#define MQTT_USERNAME "your_mqtt_username"
#define MQTT_PASSWORD "your_mqtt_password"

// Wake-on-LAN target MAC address (your PC's MAC)
#define TARGET_MAC_BYTE_0 0xAA
#define TARGET_MAC_BYTE_1 0xBB
// ... etc

2. Configure LED Strip

In main/main.c, adjust these settings for your LED strip:

#define LED_STRIP_GPIO 38              // GPIO pin connected to LED strip
#define LED_STRIP_LED_COUNT 1          // Number of LEDs in your strip

3. Build and Flash

idf.py build
idf.py -p COMX flash monitor

Replace COMX with your actual COM port.

MQTT Topics

Subscribe Topics (ESP32 listens to):

  • pc/wake - Wakes up the target PC (any message triggers)
  • mcu/led - Controls LED strip (send "ON" or "OFF")

Example MQTT Messages

Wake your PC:

mosquitto_pub -h your_broker -t "pc/wake" -m "1" -u username -P password

Turn LED ON:

mosquitto_pub -h your_broker -t "mcu/led" -m "ON" -u username -P password

Turn LED OFF:

mosquitto_pub -h your_broker -t "mcu/led" -m "OFF" -u username -P password

Project Structure

├── CMakeLists.txt
├── main/
│   ├── CMakeLists.txt
│   ├── main.c                      # Main application code
│   ├── credentials.h               # Your credentials (gitignored)
│   ├── credentials_template.h      # Template for credentials
│   └── hivemq_ca_cert.pem         # HiveMQ CA certificate
├── .gitignore
└── README.md

Security Notes

⚠️ Important: The credentials.h file is excluded from git to protect your sensitive information:

  • Wi-Fi password
  • MQTT username and password
  • MQTT broker address
  • Target PC's MAC address

Always use the credentials_template.h as a reference and never commit your actual credentials.h file.

Hardware Requirements

  • ESP32-S3 (or compatible ESP32 board)
  • WS2812 or SK6812 addressable LED strip (optional)
  • Power supply for LED strip if using multiple LEDs

Dependencies

  • ESP-IDF v5.0 or later
  • led_strip component (included in ESP-IDF)
  • HiveMQ Cloud account (or other MQTT broker)

About

Remote boot using an esp32 microcontroller on the pc LAN using MQTT and a magic packet.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published