AI-THINKER ESP32-CAM and Other Modules:
I have four AI-THINKER ESP32-CAM boards, so the descriptions below are for that board. But I took care to leave the default definitions and controls for other boards in the example intact. You may need to adjust the programming method to suit the your board, look for examples online.
- For some other good examples and information on ESP32 based webcams I also recommend the sketches here: https://github.com/raphaelbs/esp32-cam-ai-thinker
- The AI thinker wiki can be quite informative, when run through an online translator and read sensibly: https://wiki.ai-thinker.com/esp32-cam
My Modifications:
Find my version of the code online at Github:
https://github.com/easytarget/esp32-cam-webserver
The original example has been extended to allow control of a high power LED FlashLamp, which is present on my modules. It can also blink a status LED to show when it connects to WiFi.
The Board model and WiFi details can be stored in a private config header file to allow easier updates, and some other defaults can be set there too. The lamp and status LED's are optional, and the lamp uses a exponential scale for brightness so that the control has some finess.
The compressed and binary encoded HTML used in the example has been unpacked to raw text, this makes it much easier to access and modify the Javascript and UI elements. Given the relatively small size of the index page there is very little benefit from compressing it.
I have left all the Face Recognition code untouched, it works, and with good lighting and camera position it can work quite well. But you can only use it in low-resolution modes, and it is not something I will be using.
The web UI has had minor changes to add the lamp control (only when enabled), I also made the 'Start Stream' and 'Snapshot' controls more prominent, and added feedback of the camera name + firmware.
Notes:
- I only have AI-THINKER modules with OV2640 camera installed; so I have only been able to test with this combination. I have attempted to preserve all the code for other boards and the OV3660 module, and I have merged all changes for the WebUI etc, but I cannot guarantee operation for these.
- I created a small board with a handy switch for power, a pushbutton for the GPIO0 programming switch, and a socket for the AI-THINKER board. This proved very useful for development work and programming multiple devices.
- I found some excellent cases on Thingieverse.
Plans
- Improve Wifi, add a captive portal for setup and fallback, better disconnect/reconnect behaviour.
- The module has a SD/TF card slot; this is currently unused, but I would like to add the ability to store snapshots; recording Video at low resolution may be possible, but the card interface is too slow for HD video as far as I know.
- Remove face rcognition to save a Mb+ of code space and then implement over the air updates.
- Combine current split html pages (one per camera type) into one which adapts as needed.
Hey Owen, thanks for the really nice and well dokumented code! It works really well.
I got it working in no time and I'm really just a beginner at this.
Chris
PS I'm using the current 4.0 beta