The goal of this project is to create a functional webcam firmware for ESP32 based camera boards with OV2640 modules using the ESP-IDF framework. Such modules often come with optional components like high power LED "flash", an OLED display, or a motion detector. This project will incorporate compile time support for optional libraries to support these components.
This project was originally forked from one of the example programs for the ESP-WHO face recognition framework by Espressif. The face detection and recognition code has been removed to provide more resources for other features and to eliminate a dependency on external SPI RAM. In its place I have added:
The resources available on the ESP32 to support cameras are very limited and users should not expect to see anything like the full resolutions and frame rates the OV2640 is capable of.
I am no longer actively maintaining this project but continue to process pull requests. If anyone is enthusiastic about taking over this project then please contact me at me@bondkeevil.ca
Espressif originally released their source code under the MIT license. I will release my contributions to this source code under the same license:
ESPRESSIF MIT License
Copyright (c) 2018 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in which case, it is free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The source code requires the installation of the ESP-IDF toolchain and development framework
The source code works with the release/v4.0 branch.
Once that is done, create a folder for your projects and set the path and environment variables of your shell:
cd /home/username/esp/esp-idf
. ./export.sh
cd ..
mkdir myprojects
cd myprojects
clone the repository using the recursive option:
git clone --recursive https://github.com/bkeevil/esp32-cam.git
cd esp32-cam
Compress the stylesheet, html and javascript pages in main/www
cd main/www
./compress_pages.sh
cd ../..
To configure the source code you first need to run idf.py menuconfig
from the root of the source tree. This will bring up an ncurses based repository editor.
Important settings are:
When your settings are complete, save them and exit.
If needed, clean your build directory with idf.py fullclean
Compile the source code by executing idf.py build
Flash the binary file to your ESP32 module using idf.py flash
Monitor the debug serial output by running idf.py monitor
I moved the offset of the partition table in flash from 8000 to 18000. If you get the error message "Detected overlap at address: 0x8000 for file: partition_table/partition-table.bin" then check the following line in sdkconfig
and sdkconfig.defaults
CONFIG_PARTITION_TABLE_OFFSET=0x18000
Instead of using make xxxx commands, you have to use idf.py xxxx commands. For example:
idf.py build
idf.py menuconfig
idf.py app
idf.py -p Portname app-flash
Start ESP-IDF Command Prompt from Windows Start Menu to have idf.py available automatically.
To further simplify the build process, create a build-windows-defaultcomport file (without any extension) with your devices COM port, e.g. COM15, then from within the ESP-IFD prompt run the build script.
echo COM15 > build-windows-defaultcomport
powershell.exe .\build-windows.ps1
When the firmware first starts up, it will try to establish a wifi connection in the following order:
make menuconfig
To connect to the access point, point a browser to 192.168.4.1. There is no username or password.
From the web interface, select a Wifi SSID and password and optionally specify a static IP address and other network settings. Reboot the device for the settings to take effect.
Picture: http://IP/capture
Stream: http://IP:81/stream
Control LED: http://IP/control?var=led_intensity&val=[0...255]
Developer contributions that further the goals of this project are most welcome.