View ESP32 camera outside local network

In today's world of smart technology, keeping an eye on your surroundings has never been easier—or more essential. Whether you want to check on your home while you're away, monitor your pet, or simply explore the possibilities of DIY home security, the ESP32 camera module is a fantastic tool. This compact, affordable device delivers impressive video quality and is perfect for a variety of applications. However, there's one major hurdle: how do you access the video feed from your ESP32 camera when you're not on the same local network?

Typically, viewing your ESP32 camera outside your local network involves complicated network configurations and a static IP address. But let's face it, not everyone is a network engineer. Many of us just want a straightforward, hassle-free way to access our camera feed without diving into the depths of IP addresses, port forwarding, and dynamic DNS services. That's where my method comes in. This guide will walk you through the process of accessing your ESP32 camera from anywhere in the world with zero configuration. Yes, you read that right—zero configuration!

How it works

The magic lies in the way we configure the ESP32 camera to communicate with a remote server (managed by me, so no commitment on your side), which then makes the video feed available over the internet. This method ensures that you can view your camera feed securely from any device, anywhere. The best part? You won't need to install any special software or deal with complex configuration files. Everything is handled in the background, so you can focus on what matters most—enjoying the benefits of your ESP32 camera.

#1 Install the EloquentEsp32Cam library 2.7.12

Install EloquentEsp32Cam library

Don't mind the image: you need version 2.7.12 or later!

https://github.com/eloquentarduino/EloquentEsp32cam

#2 Get the sketch

The following sketch has been autogenerated to contain a unique CLIENT_ID that identifies your ESP32. It leverages the EloquentEsp32Cam library that provides a fluent interface to configure and access the ESP32 camera. If you've never used it, I strongly suggest you read the getting started tutorial to get a quick overview of what it can do and how cleaner it makes your code.

Be sure to replace the camera.pinout.* line with your model and the WiFi credentials of your own WiFi network.

Filename: Esp32CamStream.ino

/**
 * Access ESP32 camera stream from anywhere
 */
#define WIFI_SSID "SSID"
#define WIFI_PASS "PASSWORD"
#define CLIENT_ID "01JA9B3SZCQB17QFYQYKEGQ797"

#include <eloquent_esp32cam.h>
#include <eloquent_esp32cam/extra/esp32/wifi.h>
#include <eloquent_esp32cam/remote-stream.h>

using eloq::camera;
using eloq::wifi;
using eloq::remoteStream;


/**
 *
 */
void setup() {
  delay(3000);
  Serial.begin(115200);
  Serial.println("Remote Camera Stream");

  // replace with correct pinout
  camera.pinout.freenove_s3();
  camera.brownout.disable();
  camera.resolution.qvga();
  camera.quality.high();

  // don't saturate the network with too many frames
  remoteStream.throttle(500);

  // init camera
  while (!camera.begin().isOk())
    Serial.println(camera.exception.toString());

  // connect to WiFi
  while (!wifi.connect().isOk())
      Serial.println(wifi.exception.toString());

  while (!remoteStream.begin(CLIENT_ID).isOk())
    Serial.println(remoteStream.exception.toString());

  Serial.println("RemoteStream connected!");
  Serial.print("View at ");
  Serial.println(remoteStream.address());
}


/**
 *
 */
void loop() {
  if (!camera.capture().isOk()) {
    Serial.println(camera.exception.toString());
    return;
  }

  if (!remoteStream.send(camera.frame).isOk()) {
    Serial.println(remoteStream.exception.toString());
    return;
  }

  ESP_LOGI("App", "Ok");
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67

#3 Watch the live stream

After you flashed the sketch above, open the Serial Monitor and confirm that everything is ok. Then, click on the button below to see the magic happen!

Open camera stream

Limitations

Go Pro

If you want to remove the limit of 1 hour, drop me an email at

Subscribe to my newsletter

Join 1169 businesses and hobbysts skyrocketing their Arduino + ESP32 skills twice a month