Timezone: Europe/London

.

AboutContactMicropythonESP32Links
Moonlight Systems

Finding the MAC address of your board

Updated Sep 24

If you have several ESPs in different locations running programmes that upload data to a central database it makes sense to identify each one so that the data from different units can be identified and separated. The most convenient way to do this is to find the MAC address of each individual ESP. MAC addresses are unique to each board and can be found easily from code.

First you need to import the library "ubinascii" and "network" which are both native to uPython
ubinascii.hexlify(data,separator) converts the data returned from "network.WLAN().config('mac')" to hexadecimal format.
The data is returned as a byte string. Providing the optional separator ":" ensures the values are separated by colons.
The decode() function converts the byte string to ascii.

The try/except block ensures no error halts the program should something go wrong and ensures the variable "mac" is at least set to something before we try to print it.

Links

IDE editors for programming ESP boards.
Micropython editors

Micropython functionality and libraries.
Micropython.org

Find the uPython firmware for your board.
uPython firmware for development boards.

ESP32 uPython modules and function examples.
Quick reference for the ESP32

Finding the MAC address

Scanning and connecting to multiple SSIDs

Using an SD card reader breakout board

ESP32 Real Time Clock

The Deepsleep function

Storing variables in the RTC

RTC Tuning

OTA Updating running software without interuption

Future articles

Communication between ESPs

Using an Adafruit GPS module

Hassle free web communication with urequests.py.