ESP32-S3 CCTV Camera — IoT Surveillance Camera Firmware with W5500 Ethernet Support
An ESP32-S3 CCTV/IoT firmware combining W5500 Ethernet, motion detection, SD recording, MQTT, and a web UI for wired LAN camera nodes.
Recommended Components
- WIZnet W5500
- ESP32-S3-WROOM-1U-N16R8
- OV3660 Camera
- MicroSD / TF Card
- DHT11
- PIR Sensor
- MQTT / ThingsBoard
- Arduino ESP32 Core
- Web UI / HTTP Server
PROJECT DESCRIPTION
📌 Overview
This project is firmware that turns an ESP32-S3 camera board into a compact CCTV / IoT surveillance device. It is not just a simple camera streaming example. It combines W5500 Ethernet, Wi-Fi configuration, SD card recording, motion detection, MQTT telemetry, a web-based control UI, and time synchronization. The v3 release notes list MQTT on/off control, camera motion detection, LAN/time sync, recording, storage management, and alert-level improvements as major updates.
In simple terms, this project is a useful reference for anyone who wants to build a low-cost network monitoring camera node with an ESP32-S3 camera. Users can open the device in a web browser, view the camera stream, detect motion, record to an SD card, and optionally send device status to an IoT platform such as ThingsBoard. The MQTT code publishes JSON telemetry to the ThingsBoard telemetry topic v1/devices/me/telemetry.
The target board appears to be based on the ESP32-S3-WROOM-1U-N16R8 module, and the flashing guide emphasizes that 16MB Flash and 8MB OPI PSRAM configuration are important. The guide specifically instructs users to build with PSRAM=opi, and warns that incorrect PSRAM settings can increase memory pressure and lead to more Ethernet/W5500 errors.
📌 Project Background
Based on public information, the author’s official company, school, or job title is not clearly confirmed. However, other repositories under the same account suggest that the author works not only on ESP32-S3 firmware, but also on ThingsBoard, MQTT, and lab inventory portal infrastructure.
For that reason, this project is best understood not as an official company product, but as an IoT CCTV firmware project developed by an individual maker or someone working close to an education/lab environment. The project planning document also discusses ThingsBoard MQTT integration, Web UI, sensors, OLED, and telemetry fields, which makes it closer to a real operating device than a simple camera test.
📌 What This Project Does
This firmware makes an ESP32-S3 camera board behave like a network CCTV device. Users can access the web UI to view the camera, check device status, and change Wi-Fi or Ethernet settings.
It can also save images or AVI recordings to a MicroSD card, and recorded files can include a timestamp OSD. In v3, recording was improved so that it waits for a valid wall clock before starting, and timestamp overlay behavior was made more consistent.
The motion detection part is especially interesting. This project does not rely only on a PIR sensor. It can compare camera frames directly to detect motion. The code samples bytes from JPEG frames, compares them with the previous frame, and uses motion score, smoothing, adaptive threshold, and noise floor logic to determine whether motion is occurring.
MQTT is used when the device needs to connect to an IoT dashboard such as ThingsBoard. When motion status changes, telemetry can be published immediately, and the firmware can also send temperature, device status, network status, and other telemetry periodically.
📌 Features
- Camera-based CCTV firmware
The project targets an OV3660 camera and ESP32-S3 N16R8 board, with configurable JPEG quality, frame buffer count, recording FPS, and OSD quality. - W5500 Ethernet support
W5500 Ethernet is enabled by default, with SPI pins, interrupt pin, reset pin, PHY address, SPI clock, DHCP wait time, and static IP defaults all defined in configuration. - Camera frame-based motion detection
The project can detect movement without relying only on PIR. It compares sampled bytes from JPEG frames, calculates a motion score, and uses thresholds and noise-floor tracking to reduce false triggers. - MQTT / ThingsBoard integration
The firmware publishes JSON telemetry to the ThingsBoard telemetry topic. It sends data immediately when a motion event changes and also publishes periodically based on the configured interval. - SD recording and timestamp OSD
The device can store captured images and AVI recordings on MicroSD, and timestamp OSD can be applied to evidence files. - LAN and time sync improvements
The v3 notes explain that time sync is triggered after successful Ethernet DHCP, and DNS fallback is applied to improve hostname resolution in some LAN environments.
📌 System Architecture
This project can be understood in five main parts: Camera, Network, Web UI, Storage, and MQTT Telemetry.
On the camera side, the ESP32 camera driver captures frames. Those frames are used for web streaming, image capture, recording, and motion detection. The motion detection task periodically samples frames and compares them with previous frames.
On the network side, the firmware considers both Wi-Fi and W5500 Ethernet. If Ethernet link is up and a valid IP address is available, the firmware prioritizes the Ethernet IP. If not, it falls back to Wi-Fi IP. In other words, when wired LAN is available, the device is designed to use the wired path first.
The Web UI and control layer allow users to view the device, configure Wi-Fi, set Ethernet DHCP/static IP, check device status, and reboot the device. cctv_web_control.cpp includes command flows such as wifiscan, wifistatus, ethdhcp, ethstatic, and devstatus.
The telemetry layer is handled by the MQTT client. When MQTT is enabled and network access is available, the device connects to a ThingsBoard server and publishes telemetry JSON based on motion events or periodic intervals.
📌 Role and Application of the WIZnet Chip
WIZnet chip used: W5500
In this project, the W5500 adds a wired Ethernet connection to the ESP32-S3 camera device. Camera devices often need to stay online continuously and handle video streaming, recording, and MQTT transmission. In many fixed-installation environments, wired LAN can be more reliable than Wi-Fi.
The W5500 configuration is clearly defined in board_config.h. The comments explain that W5500 uses a 10/100 Mbps Ethernet PHY, and that real throughput depends more on SPI bus speed and ESP32 CPU load than on cable category. The default SPI clock is set conservatively at 14 MHz to improve wiring stability.
The initialization code starts W5500 with ETH.begin(ETH_PHY_W5500, ...). It also includes SPI diagnostic logic that reads the W5500 VERSIONR register, helping users check wiring or SPI mode problems. The code even tries different SPI modes and pin-swap combinations, which is useful when bringing up real hardware.
From a network-stack point of view, this project does not directly use the W5500 TOE / hardwired socket API. Instead, W5500 is attached as an Ethernet interface through the ESP32 Arduino ETH, esp_netif, and lwIP path. Higher-level TCP/IP handling is done by the ESP32-side software stack.
📌 Verified Implementation Highlights
The details in this curation are based on the repository’s release notes and actual source code.
board_config.h defines W5500 enablement, SPI pins, interrupt pin, reset pin, PHY address, SPI clock, DHCP wait time, and static IP defaults. So W5500 Ethernet support is not just an idea in the documentation; it is part of the actual firmware configuration.
cctv_net.cpp implements W5500 initialization, SPI pre-flight probing, Ethernet DHCP/static IP handling, Ethernet link/IP checks, DNS fallback, and Ethernet diagnostics. It also shows that cctv_primary_local_ip() and cctv_has_ip_for_internet() check Ethernet first, then Wi-Fi.
cctv_cam_motion.cpp implements camera-frame-based motion detection by comparing JPEG frame samples. This means motion detection is not only based on PIR input, but also on changes in the camera image itself.
cctv_mqtt.cpp implements the ThingsBoard MQTT telemetry flow. It publishes immediately when motion state changes and also sends periodic telemetry JSON based on the configured interval.
In short, this is not just a concept-level CCTV idea. It is firmware where camera, Ethernet, storage, motion detection, and MQTT are actually connected in code.
📌 Why This Project Is Useful
This project is useful for makers and developers who want to turn an ESP32-S3 camera into a field-style IoT monitoring node, not just a basic streaming board.
Possible applications include:
- Workshop or storage-room monitoring
- Farm or greenhouse monitoring
- Equipment-room video plus temperature/humidity checking
- Motion-triggered event recording
- Low-cost CCTV over wired LAN
- ThingsBoard-based remote telemetry dashboard
- Learning ESP32-S3 + W5500 hardware bring-up
The W5500 Ethernet addition is especially meaningful. Camera devices continuously send data, so network stability matters. In places where Wi-Fi is unreliable, wired LAN can provide a more predictable connection.
📌 Additional Insight for W5500 Makers
In this project, the W5500 is not just a part used to check whether “Ethernet works.” It is used to add wired networking to a relatively heavy ESP32-S3 application where camera streaming, SD recording, MQTT, and a web UI operate together.
Camera streaming and recording use PSRAM, SD_MMC, CPU, and network resources at the same time, so this is more demanding than a simple sensor node. The flashing guide also warns that incorrect PSRAM settings can increase memory pressure and Ethernet/W5500 errors.
One particularly useful point for W5500 makers is the bring-up diagnostic code. cctv_net.cpp performs an SPI pre-flight probe by reading the W5500 VERSIONR register, and it tests multiple SPI modes and pin-swap combinations. It also includes bit-banged SPI tracing and Ethernet boot logs, which can help diagnose wiring problems, SPI mode issues, swapped MISO/MOSI lines, and reset problems. This is a very practical approach for makers who wire W5500 modules manually.
Another useful point is the design choice to prioritize Ethernet as the main network path. The code checks Ethernet link and IP first, then falls back to Wi-Fi if Ethernet is unavailable. This shows a practical design direction: for fixed CCTV devices, wired LAN is often the more natural primary network path.
This project does not directly use the W5500 hardwired TCP/IP socket engine. Instead, it uses W5500 through the ESP32 Arduino ETH / esp_netif / lwIP Ethernet-interface path. That can be a realistic choice for ESP32-S3 camera applications, because it allows existing Wi-Fi-based web server, MQTT client, and time-sync code to be extended to wired LAN without major changes.
Overall, this project shows that W5500 can be used not only for low-power sensor nodes, but also as a wired network option for complex IoT devices that include camera streaming, SD recording, MQTT telemetry, and web-based control.
📌 Things to Know Before Building
Because this project includes many functions, it is not a simple “upload and done” example. ESP32-S3 camera, PSRAM, SD_MMC, W5500 SPI, and MQTT settings all need to be correct for stable operation.
Before building, it is worth checking:
- Whether the board is an ESP32-S3 N16R8-type board
- Whether OPI PSRAM is enabled correctly
- Whether the W5500 SPI pins match the actual wiring
- Whether the SD card pin settings match the board
- Whether the MQTT token and ThingsBoard server settings are correct
- Whether Ethernet DHCP or static IP is working properly
The flashing guide provides the exact FQBN, compile command, upload command, and post-flash validation steps, so it is a good idea to read it before building.
📌 Summary
karpus2807/esp32-s3 is firmware that turns an ESP32-S3 N16R8 camera board into a CCTV/IoT monitoring node. It combines camera streaming, frame-diff motion detection, SD recording, timestamp OSD, MQTT telemetry, web control UI, Wi-Fi configuration, and W5500 Ethernet.
Based on public information, the author’s official affiliation is not confirmed. However, related repositories suggest that the author is likely an individual IoT/embedded maker or a developer working close to an education/lab environment.
In this project, W5500 adds wired LAN support to the ESP32-S3 camera device. It does not directly use the TOE socket engine; instead, it works as an Ethernet interface through the ESP32 Arduino ETH / esp_netif / lwIP path.
📌 FAQ
Q1. What is this project?
It is firmware that turns an ESP32-S3 camera board into a CCTV/IoT monitoring node. It includes a web UI, motion detection, SD recording, MQTT, and W5500 Ethernet.
Q2. Which WIZnet chip is used?
The project uses the WIZnet W5500. The configuration file enables W5500 Ethernet by default and defines SPI pins and network settings.
Q3. Does W5500 operate through the TOE/socket engine here?
No. This project uses the ESP32 lwIP network-interface path with ETH.begin(ETH_PHY_W5500, ...) and esp_netif.
Q4. Does it support both Wi-Fi and Ethernet?
Yes. If Ethernet link and IP are valid, Ethernet is used first. Otherwise, the firmware can use Wi-Fi IP.
Q5. How does motion detection work?
It samples bytes from camera JPEG frames and compares them with the previous frame to calculate a motion score. Smoothing and adaptive thresholding are then used to decide whether motion is present.
Q6. What is MQTT used for?
MQTT is used to send telemetry to ThingsBoard. Motion events and periodic status data are published as JSON.
Q7. What is the most important build requirement?
For the ESP32-S3-WROOM-1U-N16R8 target, 16MB Flash and 8MB OPI PSRAM configuration are important. The project should be built with an FQBN that includes PSRAM=opi.
