Home › Forums › Mayfly Data Logger › need to find WiFi Bee ESP8266 MAC address
- This topic has 8 replies, 2 voices, and was last updated 2020-12-17 at 10:12 AM by Wayne.
-
AuthorPosts
-
-
2020-12-11 at 4:09 PM #14899
The university network needs the WiFi Bee ESP8266 MAC address in order to register the device. Registration of the device is required before network access is allowed. Any code pointers for a sketch to obtain the MAC address?
Thanks in advance
-
2020-12-11 at 4:11 PM #14900
I didn’t read through this in its entirety, but here’s something to start: https://randomnerdtutorials.com/get-change-esp32-esp8266-mac-address-arduino/
-
2020-12-11 at 4:12 PM #14901
Also, if the university requires any sort of two-set log in to the network (like, on a phone where you need to click ok on an “accept the terms” page) you won’t be able to do it.
-
2020-12-14 at 12:21 PM #14911Hi Sara,Thank you for the quick response. I already tried the site listed and obtained the attached pile of error messages.Stay safe,W
Attachments:
-
2020-12-14 at 12:54 PM #14914
I’m sorry, I should have read that more carefully. That program is meant to be written to an ESP, not to a Mayfly.
Anyway, you should be able to do something like this:
Arduino123456789101112131415161718192021222324252627282930313233#include <Arduino.h>setup(){Serial.begin(115200);Serial1.begin(115200);delay(200);Serial.println("Changing ESP8266 baud, if necessary");Serial.println("This response may not be read-able");Serial1.println("AT+UART_CUR=9600,8,1,0,0");// Wait for and print the response, if it's intelligibledelay(100);while (Serial1.available()){Serial.write(Serial1.read());}Serial.println();Serial1.end();Serial1.begin(9600);Serial.println("Asking the ESP for its default station mac address");Serial1.println("AT+CIPSTAMAC_DEF?");Serial.println("Response:");delay(100);while (Serial1.available()){Serial.write(Serial1.read());}Serial.println();Serial.println("Asking the ESP for its current station mac address");Serial1.println("AT+CIPSTAMAC_CUR?");Serial.println("Response:");delay(100);while (Serial1.available()){Serial.write(Serial1.read());}Serial.println();}loop(){} // do no more -
2020-12-15 at 10:52 AM #14922
Hi Sara,
Thank you for another iteration. The verify attempt resulted in the attached list activity and errors. I highlighted the most apparent error messages, so that may be the next things to address.
This is clearly exposing my bleeding edge of knowledge concerning Arduino programming.
Your suggestions are appreciated. Stay safe,
W
Attachments:
-
2020-12-15 at 3:29 PM #14924
Hi again,
Another effort used the correct void statements to get past compile, see copy of sketch used.
However, even though no red error message posted on upload, two lines were presented:
Invalid library found in C:\Users\wchudyk\Documents\Arduino\libraries\EnviroDIY_Workshops_Online-main: no headers files (.h) found in C:\Users\wchudyk\Documents\Arduino\libraries\EnviroDIY_Workshops_Online-main
Invalid library found in C:\Users\wchudyk\Documents\Arduino\libraries\libraries: no headers files (.h) found in C:\Users\wchudyk\Documents\Arduino\libraries\libraries
and the serial output was as shown in the attached screenshot.
Your suggestions are welcome,
W
-
2020-12-16 at 2:58 PM #14936
Doh! I’m sorry about the missing void statements. That’s what happens when I write code on a discussion forum. Good job fixing it!
The invalid library statements are probably because you put something that wasn’t a library into the library folder, even if it was just an empty folder. The Arduino IDE thinks everything in that C:\Users\wchudyk\Documents\Arduino\libraries folder must be a library and gets confused otherwise.
Ok, so on to the errors on the ESP8266. The board is responding to you, at least to tell you there’s been an error, so that’s a good thing. My first guess would be that your ESP8266 has an older version of the AT firmware, and is expecting a different command. Here’s a new version with some of the older commands, and a check for the modules firmware version. Depending on which version you have, these may still not get you the MAC address, but hopefully they’ll at least get us the version to track down the command that will.
Arduino12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061#include <Arduino.h>void setup(){Serial.begin(115200);Serial1.begin(115200);delay(200);Serial.println("Changing ESP8266 baud, if necessary");Serial.println("This response may not be read-able");Serial1.println("AT+UART_CUR=9600,8,1,0,0");// Wait for and print the response, if it's intelligibledelay(100);while (Serial1.available()){Serial.write(Serial1.read());}Serial.println();Serial1.end();Serial1.begin(9600);Serial.println("Asking the ESP for it firmware version");Serial1.println("AT+GMR");Serial.println("Response:");delay(100);while (Serial1.available()){Serial.write(Serial1.read());}Serial.println();Serial.println("Making sure the ESP is in station mode");Serial1.println("AT+CWMODE_CUR=1");Serial.println("Response:");delay(100);while (Serial1.available()){Serial.write(Serial1.read());}Serial.println();Serial.println("A second attempt to set the ESP mode, using the older command");Serial1.println("AT+CWMODE=1");Serial.println("Response:");delay(100);while (Serial1.available()){Serial.write(Serial1.read());}Serial.println();Serial.println("Asking the ESP for its default station mac address");Serial1.println("AT+CIPSTAMAC_DEF?");Serial.println("Response:");delay(100);while (Serial1.available()){Serial.write(Serial1.read());}Serial.println();Serial.println("Asking the ESP for its current station mac address");Serial1.println("AT+CIPSTAMAC_CUR?");Serial.println("Response:");delay(100);while (Serial1.available()){Serial.write(Serial1.read());}Serial.println();Serial.println("A third attempt to get the mac address, with older command");Serial1.println("AT+CIPSTAMAC?");Serial.println("Response:");delay(100);while (Serial1.available()){Serial.write(Serial1.read());}Serial.println();}void loop(){} // do no more -
2020-12-17 at 10:12 AM #14940
Hi Sara,
Thank you, thank you, thank you!
It worked once I cleaned up the libraries file and appears to have needed the older set of commands. The serial output is attached.
Now back to shoveling out our nor’easter foot+ of snow.
Have a great holiday season and best wishes for the new year,
W
Attachments:
-
-
AuthorPosts
- You must be logged in to reply to this topic.