Saturday, September 2, 2017

Create a unique SSID with a ESP32 board.

I recently started to work on a ESP32 project.  And I needed a unique SSID for each access point I was creating.  I didn't want to hard code a different SSID in each device, since that would be time consuming.

I did what most people do and googled what I wanted to do.  And I really didn't find what I was looking for.

The ESP32 doesn't really have a unique ID itself, but it does contain a MAC address that should be different on each device.

I did find a sketch that does give the MAC address:

But I still need a unique SSID - well here's how to do simple as I can make it.

#include <WiFi.h>
         char ssid[15]; //Create a Unique AP from MAC address
void createSSID() {
  uint64_t chipid=ESP.getEfuseMac();//The chip ID is essentially its MAC address(length: 6 bytes).
  uint16_t chip = (uint16_t)(chipid>>32);
void setup() {
   WiFi.softAP(ssid, password);
    IPAddress myIP = WiFi.softAPIP();
    Serial.print("AP IP address: ");
    Serial.print("SSID: ");

That is it, simple.... add the rest of your code and have fun.


  1. I have a problem with your ESP32 project:
    I used ESP32 devkit. After adding wifi credentials I flashed this code with success.
    Unfortunately this device not loging into wifi. I do not know why. What I is wrong?