Main Menu

search

You are here

ESP Wifi Projects

[last updated: 2021-09-28]
ESP32 & ESP8266 home page
-----

  • Source Material:
    Most of what's here came from:
    https://randomnerdtutorials.com (RNT)
    Great resources. Huge amount of excellent material to wade through.
    Troubleshooting somewhat lacking as such resources are.

  • Initial project is to get two ESP8266's to communicate with each other via wifi but without connecting to a router.
    ----------------------------------------------------------------------

  • First task is to find the mfr-assigned MAC address of my boards.
    • MAC = Media Access Control
      Every device has a unique MAC Address.
      The address is of the form:
          C4:5B:BE:55:36:CE
          That is, 6 groups of 2 hex digits, separated by colons
      For two devices to talk to each other, they must know each others' MAC address

    • RNT has an Arduino sketch to find it:
      • https://randomnerdtutorials.com/get-change-esp32-esp8266-mac-address-ard...
        • #include "ESP8266WiFi.h"
          void setup(){
          Serial.begin(115200);
          Serial.println();
          Serial.print("ESP Board MAC Address: ");
          Serial.println(WiFi.macAddress());
          } // -------------- END setup --------------

      • Library Problems:
        • The RNT sketch needs WiFi.h or ESP8266.h, neither of which were in my system.
          • per RNT (https://randomnerdtutorials.com/esp32-useful-wi-fi-functions-arduino/):
            "This library is automatically “installed” when you install the ESP32 add-on in your Arduino IDE.
            If you don’t have the ESP32 installed, you can follow the next tutorial:...
            Installing the ESP32 Board in Arduino IDE (Windows, Mac OS X, Linux)"
            Add to File-Preferences:
            https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/packa...
              However: could not get this to work. May require fresh install of the IDE since I've been doing so much juggling with the library folder.

          • Searched Google for "WiFi.h Arduino library"
            Found on github: https://github.com/arduino-libraries/WiFi
            Code - Code - Download Zip
              Would not compile:
              WiFi.mode command not defined
              WiFi.macAddress not defined

          • Found another WiFi.h from github/espressif/arduino-esp32. Manually copied into my libraries folder.
            • While the WiFi errors from above were cleared,
              it still did not compile:
              IPv6Address.h not found
              • Found same in arduino-esp and copied into my libraries folder:
              • Would not compile: needs esp_wifi_types.h
                • copied arduino-esp32/tools/sdk/esp32/include/esp_wifi
                • Would not compile: needs esp_event_base.h
            • A diversion:
              Since all these libraries that I need are part of arduino-esp32, I tried
              copying the entire arduino-esp32 folder into my libraries folder, then #include "arduino-esp32"
              but it would not compile, "no such file of directory" ???

        • Installed these from the board manager:
          ESP8266 from ESP8266Community
          and ESP32 from Espressif
        • Added these to File - Preferences:
          http://arduino.esp8266.com/stable/package_esp8266com_index.json,
          https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/packa...

    ----------------------------------------------------------------------

  • wifi mode:
    • The ESP can be used in 3 modes:
      • AP mode
      • Station mode
            WiFi.mode(WIFI_STA);
      • Both

.


.


.

eof