ESP32 Tips

Wifi Configuration

Connect ESP32 to Wifi(with SSL)

WifiClient Secure(for ESP32) works when you connect to Wifi with SSL.

  #include <WiFiClientSecure.h>
  // please set ssid and password of your wifi environment (2.4GHz)
  char *ssid = "xxxx"; 
  char *password = "xxxx";

  // you need to add following charactors
  const char* rootCA = "-----BEGIN CERTIFICATE-----\n" \
  "......" \
  "-----END CERTIFICATE-----\n";
    
  const char* certificate = "-----BEGIN CERTIFICATE-----\n" \
  "......" \
  "-----END CERTIFICATE-----\n";
    
  const char* privateKey = "-----BEGIN RSA PRIVATE KEY-----\n" \
  "......" \
  "-----END RSA PRIVATE KEY-----\n";
    
  WiFiClientSecure httpsClient;

  void setup() {
    WiFi.begin(ssid, password);
 
    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
    }
    Serial.println("\nWifi Connected.");
 
    // Configure MQTT Client
    httpsClient.setCACert(rootCA);
    httpsClient.setCertificate(certificate);
    httpsClient.setPrivateKey(privateKey);
  }


Connect ESP32-Cam to Wifi

For connecting ESP32-cam to Wifi, check notes of week9(individual assignment) confirming ESP32-cam.

Wifi band and router configuration

Note that I could connect to Wifi only by tithering network of android smartphone (with 2.4GHz, WPA2 PSK)of my android smartphone at week9. ESP32 only connects to 2.4GHz Wifi band and that the band range needs to match with your Wifi environment (I guess my home have both 2.4Ghz and 5GHz, but something wrong with 2.4Ghz at that point).

Reference