A WebSocket ESP32-CAM Streaming Server with BME Sensor Reading and Commands
This repository contains code for controlling an ESP32-CAM using websockets. It utilizes various sensors and functionalities to enable remote control and sensor data monitoring.
- Overview
- Dependencies
- Functionality
- Setup
- Web Interface
- Camera Configuration
- WebSocket Events
- Sensor Data Handling
- Control Functions
The code controls an ESP32-CAM and integrates various libraries for different functionalities:
- Camera control and streaming
- WebSockets for real-time communication
- Sensor readings for BME280 and VL53L1X
The code utilizes several libraries:
- Adafruit BME280 for environmental sensing
- Adafruit VL53L1X for distance measurements
- AsyncTCP and ESPAsyncWebServer for asynchronous handling
- ArduinoJson for JSON handling
- Adafruit SSD1306 and Adafruit GFX for OLED display
The code provides functionalities for:
- Websocket server setup
- Live camera streaming
- Reading sensor data (temperature, pressure, altitude, humidity, distance)
- Controlling the ESP32-CAM remotely via WebSocket commands
- Configure the ESP32-CAM board with specified GPIO pins
- Connect to Wi-Fi network
- Run the server on port 80
- Initialize sensors and camera configuration
- Handle WebSocket events and incoming client commands
The code serves a simple web interface for:
- Displaying sensor readings in real-time
- Providing controls for the ESP32-CAM (light, photo capture, reset)
The configCamera()
function initializes the camera settings required for capturing frames.
webSocketEvent()
handles WebSocket events like client connection, disconnection, and incoming text data.- Processes client commands received via WebSocket, performs actions based on the received commands.
- Reads sensor data at specified intervals and sends it via WebSocket when available.
- Shows sensor data on an OLED display.
- Manages functionalities triggered by client commands (e.g., light control, photo capture, automatic photo mode, reset).
Please refer https://github.com/abish7643/ESP32Cam-I2CSensors to lib errors using esp32cam with adafruit lib
This README provides an overview of the code functionalities and setup process for controlling ESP32-CAM via websockets. Please refer to the code comments and specific functions for detailed implementation.