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.
- 🔌 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
Copy the credentials template file and fill in your information:
cp main/credentials_template.h main/credentials.hEdit 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
// ... etcIn 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 stripidf.py build
idf.py -p COMX flash monitorReplace COMX with your actual COM port.
pc/wake- Wakes up the target PC (any message triggers)mcu/led- Controls LED strip (send "ON" or "OFF")
Wake your PC:
mosquitto_pub -h your_broker -t "pc/wake" -m "1" -u username -P passwordTurn LED ON:
mosquitto_pub -h your_broker -t "mcu/led" -m "ON" -u username -P passwordTurn LED OFF:
mosquitto_pub -h your_broker -t "mcu/led" -m "OFF" -u username -P password├── 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
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.
- ESP32-S3 (or compatible ESP32 board)
- WS2812 or SK6812 addressable LED strip (optional)
- Power supply for LED strip if using multiple LEDs
- ESP-IDF v5.0 or later
led_stripcomponent (included in ESP-IDF)- HiveMQ Cloud account (or other MQTT broker)