Powerbutton

The code for my remote power/reset button PCB.

Build

make client
make server

Upload

make client-run
make server-run

Console

make client-log
make server-log

Configuration

The following fields in secrets.h have to be configured:

  • CLIENT_MAC
  • SERVER_MAC
  • PMK
  • LMK

You have to configure the real STA MAC address of both the client and server. It might be odd that the AP MAC of the receiver isn't used, but that's how ESP-NOW works. You can find the MAC address with the following code.

#include <esp_wifi.h>

void printMacAddress()
{
	uint8_t mac[6];
	esp_err_t ret = esp_wifi_get_mac(WIFI_IF_STA, mac);
	if (ret == ESP_OK) {
		Serial.printf("{ %#x, %#x, %#x, %#x, %#x, %#x }\n",
		              mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
	}
	else {
		Serial.println("Failed to read MAC address");
	}
}

PMK and LMK have to be 16 characters long and should be the same between the client and server.

S
Description
Remote power/reset button
Readme
439 KiB
Languages
C++ 84.9%
Makefile 8.2%
Python 5.9%
C 1%