Finding the MAC Address of the Arduino UNO R4

Hello There! I'm trying to connect my Arduino UNO R4 to the University WiFi. For this, the University needs the MAC address of the Arduino to be registered. However, I am not able to find the MAC address. I tried WiFi.macaddress() from the WiFis3.h library, but that didn't work either. What am I supposed to do here? How do I get the MAC Address for my Arduino?

I'll take a guess and say that if it's not programmable, the information should be included in the documentation that came with the R4 or on a sticker attached to it.

Since WiFi.macAddress(mac); worked just just fine for me just now using the ScanNetworks example sketch, you're going to have to offer up more details than "I tried WiFi.macaddress() from the WiFis3.h library, but that didn't work either." if you expect anyone to be able to offer any help. A minimal reproducible sketch illustrating it not working for you would go a long way towards that end.

Setup up your smartphone as a Access Point and connect to it with this sketch

#include <SPI.h>
#include <WiFi.h>

char ssid[] = "........";  // the name of your network
char password[] = "........";

int status = WL_IDLE_STATUS;  // the Wifi radio's status

byte mac[6];  // the MAC address of your Wifi shield

void setup()
{
    Serial.begin(115200);

    status = WiFi.begin(ssid, password);

    if (status != WL_CONNECTED)
    {
        Serial.println("Couldn't get a wifi connection");
        while (true)
            ;
    }
    // if you are connected, print your MAC address:
    else
    {
        WiFi.macAddress(mac);
        Serial.print("MAC: ");
        Serial.print(mac[5], HEX);
        Serial.print(":");
        Serial.print(mac[4], HEX);
        Serial.print(":");
        Serial.print(mac[3], HEX);
        Serial.print(":");
        Serial.print(mac[2], HEX);
        Serial.print(":");
        Serial.print(mac[1], HEX);
        Serial.print(":");
        Serial.println(mac[0], HEX);
    }
}

void loop() {}
1 Like

If I use my phone as a WiFi hotspot, I can see the MAC addresses of all the devices connected to it in 'settings'.

1 Like
#include <WiFiS3.h>

void setup() {

  Serial.begin(115200);
  while (!Serial) ;
  Serial.println("START");

  WiFi.begin("dummy");

  uint8_t mac[6];
  WiFi.macAddress(mac);
  Serial.print("Station MAC: ");
  printMacAddress(mac);
}

void loop() {
}

void printMacAddress(byte mac[]) {
  for (int i = 0; i < 6; i++) {
    if (i > 0) {
      Serial.print(":");
    }
    if (mac[i] < 16) {
      Serial.print("0");
    }
    Serial.print(mac[i], HEX);
  }
  Serial.println();
}
3 Likes

This worked. Thank you. I'm sorry, I have no idea why it didn't work with the other program I wrote. Maybe I was testing it wrong?

How are you able to see your connected users? I couldn't find it under Wi-Fi Hotspot

Sorry for that. I didn't want to share my entire code, but in retrospect, I really should have for a better solution.

Shrug. No one can fix code you won't show.

Write a piece of code that is just the problem part. As long as it is complete and shows the problem. How to create a Minimal, Reproducible Example - Help Center - Stack Overflow