2017/10/07

ESP8266 - Getting Chip ID and MAC Address

The code below reads and displays info. such as WiFi MAC Address, Chip ID, Flash Chip ID, Flash Chip Size, etc. about the NodeMCU v1.0 board that I use for making this post.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//reference: 
// http://esp8266.github.io/Arduino/versions/2.1.0/doc/libraries.html
// http://arduino-er.blogspot.tw/2016/04/nodemcuesp8266-get-esp-chip-and-flash.html
// https://techtutorialsx.com/2017/04/09/esp8266-get-mac-address/

#include <ESP8266WiFi.h>

void setup() {
    Serial.begin(115200);
    delay(500);
    
    Serial.println();
    Serial.println("ESP8266 Info.");
    Serial.println("****************************************");
  
    Serial.print("WiFi MAC: ");
    Serial.println(WiFi.macAddress());
  
    Serial.printf("Chip ID as a 32-bit integer:\t%08X\n", ESP.getChipId());
  
    Serial.printf("Flash chip ID as a 32-bit integer:\t\t%08X\n", ESP.getFlashChipId());
  
    Serial.printf("Flash chip frequency:\t\t\t\t%d (Hz)\n", ESP.getFlashChipSpeed());

    // ESP.getFlashChipSize() returns the flash chip size, in bytes as seen by the SDK (may be less than actual size).
  
    Serial.printf("Flash chip size:\t\t\t\t%d (bytes)\n", ESP.getFlashChipSize());
    Serial.printf("Free heap size:\t\t\t\t\t%d (bytes)\n", ESP.getFreeHeap());
}

void loop() {
}

The result


References:

NodeMCU/ESP8266: get ESP chip and flash info
http://arduino-er.blogspot.tw/2016/04/nodemcuesp8266-get-esp-chip-and-flash.html

ESP8266: Get MAC address
https://techtutorialsx.com/2017/04/09/esp8266-get-mac-address/

Is there a serial number or unique ID in the chip
http://bbs.espressif.com/viewtopic.php?t=1303

No comments:

Post a Comment