Giter Club home page Giter Club logo

esp32-cam-webserver's Introduction

ESP32-CAM example revisited.     CI Status    ESP-EYE logo

Taken from the ESP examples, and expanded

This sketch is a extension/expansion/rework of the 'official' ESP32 Camera example sketch from Espressif:

https://github.com/espressif/arduino-esp32/tree/master/libraries/ESP32/examples/Camera/CameraWebServer

But expanded with:

  • More options for default network and camera settings
  • Save and restore settings
  • Control of on-board lamps, rotate the view in the browser
  • Dedicated standalone stream viewer
  • Over The Air firmware updates
  • Lots of minor fixes and tweaks, documentation etc.

And 'reduced' by removing the Face Recognition features

  • If you want to try the Face Recognition features please use the 3.x maintenance branch, which still recieves bugfixes, but is not receiving any further development.
  • They were a demo, only worked in low resolution modes, did not preserve the face database between power cycles, and were of little use in real-world applications.
  • There are other (specialised) sketches for the ESP-CAM that do use face recognitioni more effectively, if this is your thing :-)

The original example is a bit incomprehensible and hard to modify as supplied. It is very focused on showing off the face recognition capabilities, and forgets the 'webcam' part.

  • There are many other variants of a webcam server for these modules online, but most are created for a specific scenario and not good for general, casual, webcam use.

Actually, there are two cats in this image!

Hopefully this expanded example is more useful for those users who wish to set up a simple ESP32 based webcam using the cheap(ish) modules freely available online. Especially the AI-THINKER board:

AI-THINKER ESP32-CAM vs 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.

Troubleshooting:

A lot of common issues with this sketch are discussed and covered in the discussion forums:

https://github.com/easytarget/esp32-cam-webserver/discussions/categories/common-issues

The existing issues list on Github is a good place to start if you have a specific issue not covered above or in the forums.

There is also this excellent guide for help with some common issues seen with the camera modules: https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/

Known Issues

Builds made with PlatformIO are currently (v4.0) broken; the stream will die shortly after starting. See #218 for more info.

The ESP32 itself is susceptible to the usual list of WiFi problems, not helped by having small antennas, older designs, congested airwaves and demanding users. The majority of disconnects, stutters and other comms problems are simply due to 'WiFi issues'. The AI-THINKER camera module & esp32 combination is quite susceptible to power supply problems affecting both WiFi conctivity and Video quality; short cabling and decent power supplies are your friend here; also well cooled cases and, if you have the time, decoupling capacitors on the power lines.

A basic limitation of the sketch is that it can can only support one stream at a time. If you try to connect to a cam that is already streaming (or attempting to stream) you will get no response and, eventually, a timeout. The stream itself is a MJPEG stream, which relies on the client (the web browser) to hold the connection open and request each new frame in turn via javascript. This can cause errors when browsers run into Javascript or caching problem, fail to request new frames or refuse to close the connection.

  • If you cannot start the stream you can check the /dump page of the cam to see if it currently reports the camera as streaming or not.

Note that I do not respond to any Private Messages (via github, hackaday, or wherever) for support.

Setup:

  • For programming you will need a suitable development environment, I use the Arduino IDE, but this code should work in the Espressif development environment too.
  • Make sure you are using the latest version of the IDE and then follow This Guide to set up the Espressif Arduino core for the IDE.
  • I do not recommend or support running with development builds of either the IDE or the ESP arduino core.
  • If you have a development board (anything that can be programmed via a standard USB cable/jack on the board itself) you are in luck. Just plug it in and skip ahead to the config section. Remember to set your board model.
  • The AI-THINKER board requires use of an external 3.3v serial adapter to program; I use a FTDI Friend adapter, for more about this read AdaFruits excellent FTDI Friend guide.
  • Be careful not to use a 5v serial adapter since this will damage the ESP32.

Wiring for AI-THINKER Boards (and similar clone-alikes)

Is pretty simple, You just need jumper wires, no soldering really required, see the diagram below. Hoockup

  • Connect the RX line from the serial adapter to the TX pin on ESP32
  • The adapters TX line goes to the ESP32 RX pin
  • The GPIO0 pin of the ESP32 must be held LOW (to ground) when the unit is powered up to allow it to enter it's programming mode. This can be done with simple jumper cable connected at poweron, fitting a switch for this is useful if you will be reprogramming a lot.
  • You must supply 5v to the ESP32 in order to power it during programming, the FTDI board can supply this.

Download the Sketch, Unpack and Rename

Download the latest release of the sketch from https://github.com/easytarget/esp32-cam-webserver/releases/latest

  • You can get the latest stable development release by cloning / downloading the master branch of the repo.

This will give you an archive file with the Version number in it, eg.esp32-cam-webserver-4.0.zip. You need to unpack this into your Arduino sketch folder, and then you need to rename the folder you extracted to remove the version number, eg.esp32-cam-webserver-4.0 becomes esp32-cam-webserver.

Once you have done that you can open the sketch in the IDE by going to the esp32-cam-webserver sketch folder and selecting esp32-cam-webserver.ino.

Config

By default the sketch assumes you have an AI-THINKER board, it creates an AccessPoint called ESP32-CAM-CONNECT and with the password InsecurePassword; connect to that and then browse to http://192.168.4.1/. This is nice and easy for testing and demo purposes.

To make a permanent config with your home wifi settings, different defaults or a different board; copy (or rename) the file myconfig.sample.h in the sketch folder to myconfig.h and edit that, all the usable defaults are in that file. Because this is your private copy of the config it will not get overwritten if you update the main sketch!

Programming

Assuming you are using the latest Espressif Arduino core the ESP32 Dev Module board will appear in the ESP32 Arduino section of the boards list. Select this (do not use the AI-THINKER entry listed in the boiards menu, it is not OTA compatible, and will caus the module to crash and reboot rather than updating if you use it. IDE board config

Make sure you select the Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) partition scheme and turn PSRAM on.

The first time you program (or if OTA is failing) you need to compile and upload the code from the IDE, and when the Connecting... appears in the console reboot the ESP32 module while keeping GPIO0 grounded. You can release GPO0 once the sketch is uploading, most boards have a 'boot' button to trigger a reboot.

Once the upload completes (be patient, it can be a bit slow) open the serial monitor in the IDE and reboot the board again without GPIO0 grounded. In the serial monitor you should see the board start, connect to the wifi and then report the IP address it has been assigned.

Once you have the initial upload done and the board is connected to the wifi network you should see it appearing in the network ports list of the IDE, and you can upload wirelessly.

If you have a status LED configured it will give a double flash when it begins attempting to conenct to WiFi, and five short flashes once it has succeeded. It will also flash briefly when you access the camera to change settings.

Go to the URL given in the serial output, the web UI should appear with the settings panel open. Click away!

My Modifications:

The simplified viewer
The new default Simple view, just the basics

The WiFi details can be stored in an (optional) header file to allow easier code development, and a camera name for the UI title can be configured. The lamp and status LED's are optional, and the lamp uses a exponential scale for brightness so that the control has some finess.

All of the face recognition code has been removed as of V4.0; this reduces the code size enough to allow OTA programming while improving compile and programming times.

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.

The streamviewer, lamp control, and all the other new features have been added. I have tried to retain the basic structure of the original example,extending where necessary.

The web UI has had changes to add the lamp control (only when enabled) and make the streamm window rotate and resize appropriately. I also made the 'Start Stream' and 'Snapshot' controls more prominent, and added feedback of the camera name + firmware.

I would also like to shoutout to @jmfloyd; who suggested rotating the image in the browser since the esp32 itself cannot do this.

The stream viewer
Standalone StreamViewer; No decoration or controls, the image is resizable, and you can doubleclick it for fullscreen

The info page
Boring Details, useful when debugging or if you want to check stats

API

The communications between the web browser and the camera module can also be used to send commands directly to the camera (eg to automate it, etc) and form, in effect, an API for the camera.

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.

Cameras and a Programmer

Contributing

Contributions are welcome; please see the Contribution guidelines.

Plans

Time allowing; my Current plan is:

V4

  • Investigate using SD card to capture images
  • Implement a better network stack for remembering multiple AP's, auto-config etc.
    • Advanced (web upload) OTA might be nice to have if possible
  • UI Skinning/Theming
  • OSD
    • Temperature/humidity/pressure sensor support (bme20,dht11) You can check the enhancement list (past and present), and add any thoughts you may have there.

esp32-cam-webserver's People

Contributors

15498th avatar arminjo avatar easytarget avatar ericfont avatar jmfloyd avatar rdragonrydr avatar timgates42 avatar xtrinch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp32-cam-webserver's Issues

Document how to permanently change camera settings

It appears to be relatively easy, though cumbersome, to change default compile-time values for camera controls(gain, white balance, effects, etc) by editing the defaults in the code.
This would be a useful stop-gap measure since a proper save/restore mechanism for the controls is some way off (planned as a v4 milestone)

  • Test
  • Write-Up in the readme, or a separate document

Favicon

Find a graphic, encode it up, send as a response to a /favicon.ico request.
Good online resources for the icon generation.

feature request: implement fallback SSID

Hi all,

how about implementation off a fallback/alternative SSID for WIFI?

ESPeasy and Tasmota are supporting this for ESP8266, so this should be possible with ESP32 s well, right?

Would be a great settings option.

grafik

Suggestion: Add Event Driven Illumination LED Control

Good day. Thank you for your effort in developing this and putting it out there for the masses.

It is proving useful for my employment of the ESP32 CAM as a 3D printer camera and is beneficial in this use case as I can set default resolution and have the Illumination LED on.

It would be useful to be able to have the Illuminator LED off when not streaming but allow a preset illumination level whenever a capture event transpires vs. having it on and generating heat all the time.

Thanks again! Take care.

Bugs and suggestions

As others have stated after some time (minutes to hours) the stream becomes unavailable and in some cases the main page also. (device still responds to pings)

I did find a post that suggests that a lot of the issue occur with chrome browser although I also experienced issues with IE and firefox (mobile and platform) Here is the fix they suggested. https://rntlab.com/question/solved-esp32-web-server-drops-connection-crashes/

Also would be really nice if there was the stream page also able to be changed from myconfig.h and a modified version that removed all the facial recognition. Also debug is seems to be working intermittently.

I had to program my aithinker using the wrover option in board manager, not sure if this means mine was a clone.

Thanks again for the great project.

hostname

I had to add a couple of lines of code to specify the hostname.

WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE);
WiFi.setHostname("my_cam_hostname_goes_here");

I'm not sure where the best place to put them is but they work here, at the top and bottom of this snippet from the main file:

    WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE);
    if (bestStation == -1) {
        if (!accesspoint) { 
            #if defined(WIFI_AP_ENABLE)
                Serial.println("No known networks found, entering AccessPoint fallback mode");
                accesspoint = true;
            #else
                Serial.println("No known networks found");
            #endif
        } else {
            Serial.println("AccessPoint mode selected in config");
        }
    } else {
        Serial.printf("Connecting to Wifi Network: %s\n", stationList[bestStation].ssid);
        if (stationList[bestStation].dhcp == false) {
            #if defined(ST_IP)
                Serial.println("Applying static IP settings");
                #if !defined (ST_GATEWAY)  || !defined (ST_NETMASK) 
                    #error "You must supply both Gateway and NetMask when specifying a static IP address"
                #endif
                IPAddress staticIP(ST_IP);
                IPAddress gateway(ST_GATEWAY);
                IPAddress subnet(ST_NETMASK);
                #if !defined(ST_DNS1)
                    WiFi.config(staticIP, gateway, subnet);
                #else
                    IPAddress dns1(ST_DNS1);
                #if !defined(ST_DNS2)
                    WiFi.config(staticIP, gateway, subnet, dns1);
                #else
                    IPAddress dns2(ST_DNS2);
                    WiFi.config(staticIP, gateway, subnet, dns1, dns2);
                #endif
                #endif
            #else
                Serial.println("Static IP settings requested but not defined in config, falling back to dhcp");
            #endif
        }
        // Initiate network connection request
        WiFi.setHostname("my_cam_hostname_goes_here");
        WiFi.begin(stationList[bestStation].ssid, stationList[bestStation].password);

The hostname probably needs a myconfig.h setting too.

I think I found the solution here espressif/arduino-esp32#3438

Basic network robustness improvements

There seems to be very little robustness in the code for WiFi disconnects; once you fall off the local network you need a reboot to recover.
This is OK for the example/demo scenarios, but a headache when using these for long-duration use.
Some sort of basic re-try mechanism for client mode is needed,

  • Nothing heavy. Just detect the disconnect and loop, retrying, until reconnected.

stream window mis-placed when image is rotated

Recent changes to CSS dont play well with rotated streams, maybe need to rotate whole container, or swap out the vh/vw size modifiers on the image. Or even do this on the upper container too.. Need to experiment.

Components-Object deprecated and to be removed

I am getting a warning in Firefox developer tools about deprecated Components-Object still used.
It should no longer be used.

'Das Components-Objekt sollte nicht mehr verwendet werden. Es wird bald entfernt.'

grafik

Feature Request: Make vertical flip a rotate function.

Just wondering if its possible to change the "V-Flip" button a rotate function in 90 degree increments. Methinks that would be much more useful. I have looked thru the code and can't find anything I understand to change it. My code skills are pretty much non-existent anyway.

This would make for many more mounting options for the camera.

Stream viewer

Very basic viewer with just enough code to grab the rotation setting and camera name for display,
Serve directly on the stream port at /view to complement the miniviewer on the http port
Provide a very stripped-down status query/response on stream port for this.
Start/Stop when image clicked, resize image without breaking ratio.
Maybe show resolution in tooltip.

Export/Import preferences and FaceDB via browser

Once these features are working for SPIFFS based storage it will be possible to provide handlers for up/downloading them.

Up/Down loading files/data via browsers is a common goal, so plenty of good examples can be found.

It is, however, still quite a bit of work to get the UI working well, plus the relevant http handlers for file up/download, so this is on the back-burner.

V.3 announcement: is it faster?

hi, today i tried your code,
now i just got the v3. announcment a minute ago.

my impression was before, your code is a bit slower than the general cam-example-code.

i did not find any hints, that there had been speed improvements in V3...
Or was my impression wrong?

thx.

Save stream and UI default preferences between sessions/reboots

Use LittleFS (nee SPIFFS) to save/restore settings to both the stream/camera and the UI in a persistent manner

Hopefully there is a library I can leverage for this, YAML based for preference.
Needs some thought and effort; there are a lot of settings to cover if all the discreet camera settings are included.
Addresses #7

bug: stream freezes

Hi all,

stream freezes regulary.
grafik

Powered via USB power bank 5,17 V.

Webserver keeps up and does not reboot.

Please check

Combine CSS into a separate file

Currently each html doc (now three) has a huge CSS payload, it would make sense to serve this as a seperate CSS file to make the HTML and JS files smaller and easier to work with.
Bonus: makes theming easier since changes apply to all pages automagically.

Configurable URI path prefix for http and stream

Add ability to extend the path for the HTTP handlers; allowing easier embedding and providing a basic secrecy hurdle against casual viewers.

ie: define HTTP_PREFIX (eg mysecret/) and embed in all the URI's like this http://<IP>/$HTTP_PREIX<target>

Needs SSL support ( #54 ) to become a real privacy / eavesdropper protection, totally vulnerable to network sniffing without this.
May be very useful if you want to embed within another site.

Document the HTTP API

Since the camera module can be fully controlled via HTTP requests; lets document this as a basic API.

V3 prerelease2: boot error

i had this before on the usb-port of my PC,
not enough current...

but with same module and pre-release2 (beta3) version,
it does not recover. even on a stronger USB-port.

something i can do about?

===
esp32-cam-webserver: ESP32 camera server
Code Built: Oct  6 2020 @ 14:25:17
Camera init succeeded
OV2640 camera module detected
Internal filesystem contents
Listing SPIFFS directory: /
Preference file /esp32cam-preferences.json not found; using system defaults.
Lamp: 0%, pwm = 0
Starting WiFi
Known external SSIDs: None
MAC address: CC:50:E3:95:12:24
Scanning local Wifi Networks

Brownout detector was triggered

ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:9720
ho 0 tail 12 room 4
load:0x40080400,len:6352
entry 0x400806b8

====
esp32-cam-webserver: ESP32 camera server
Code Built: Oct  6 2020 @ 14:25:17
[E][camera.c:205] skip_frame(): Timeout waiting for VSYNC
[E][camera.c:1270] esp_camera_init(): Camera init failed with error 0x20003
Halted: Camera sensor failed to initialise
Will reboot to try again in 10s

ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:9720
ho 0 tail 12 room 4
load:0x40080400,len:6352
entry 0x400806b8

====
esp32-cam-webserver: ESP32 camera server
Code Built: Oct  6 2020 @ 14:25:17
[E][camera.c:205] skip_frame(): Timeout waiting for VSYNC
[E][camera.c:1270] esp_camera_init(): Camera init failed with error 0x20003
Halted: Camera sensor failed to initialise
Will reboot to try again in 10s


face recognition at startup

Hi there,
I liked your improvements. I'm actually looking for a startup configuration with face recognition. I mean when cam powered on automatically face recognition must be selected. Would you add this in your improvement list?

Allow wifi AP setup for standalone use.

I have made some changes that allow an AP to be set up using a macro variable WIFI_AP that is declared in myconfig.h. Also added a wifichan definition in the myconfig to help wireless congestion. Changes are in esp32-cam-webserver.ino

First change

#ifdef WIFI_AP
  Serial.println("Setting up AP");
  WiFi.softAP(ssid, password, wifichan);
#else
  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(250);  // Wait for Wifi to connect. If this fails wifi the code basically hangs here.
                 // - It would be good to do something else here as a future enhancement.
                 //   (eg: go to a captive AP config portal to configure the wifi)
  }
#endif

2nd change

#ifdef WIFI_AP
  Serial.print(WiFi.softAPIP());
#else
  Serial.print(WiFi.localIP());
#endif
  Serial.println("' to connect");
}

Simple inclusions.

Cheers John

Save images to SD card

V4 extended..
Allow images to be (timestamped and) saved to a folder on an attached SD card (AI-THINKER has a SD card slot)

  • Trigger button in UI
  • Timelapse?
  • Face recognition triggers?
    • Named faces
    • Unknown faces

Allow images to be browsed, deleted and downloaded via the WebUI. ?

  • maybe some libraries/examples already exist for this
  • Download all images as a bundle? might be easier for UI to do, and may also have some examples/libaries already available or adaptable.

Alternatively find a library (?) that allows ftp/smd or some other file transfer/browse standard to access the filestore.

Face recognition Database

Can this be saved/restored?

  • Need to check; it appears to just be a indexed array/structure in memory, so I assume the answer is yes.

If so:

  1. Save/Restore to LittleFS
  2. Rename/Delete entries
  3. Upload/Download from the clients browser

The first is probably the easiest, json makes sense for the format rather than binary. The first step is to read the IDE build settings (to check that space is reserved for the filesystem) and, if so, run an example on the ESP-CAM board to demo saving/restoring a filestructure to that.
Adding buttons to the UI and a new action handler to process that should be relatively easy.

The second involves setting up a handler that can return the name list, a dialog to obtain that and offer rename/delete on entries, then a receiver to import the update and modify the in-ram Db. The dialog involves extending the javascript somewhat.

The third involves another handler/reciever pair to provide the current db from ram as a Json file, and a reciever to import that. The JS for this is also a bit complex, the upload needs a progress bar and fail/success notification etc.

video stream using tinyCam PRO is not working

Hi,

when I used the original demo version available in Arduino IDE I was able to get the video stream on my mobile using tinyCam PRO Android app.

Settings:
Vendor: Generic
Camera model: Generic URL
URL: http://IP:81/stream
Protocol: snapshot (JPEG)

Now with your project the above settings (but URL http://IP:81/view) does not show the stream.

Also changing the protocol to 'Server push (MJPEG)' does not work.

grafik
grafik

Any ideas?

Thx

are LED settings by http request supported?

Hi all,

I understand that in the original demo version some http requests are supported to set parameters.

Is setting the light by http request supported in this version?

I would like to do the following from my FHEM home automation.

  • if door bell pressed
  • http request to turn on LED (if night)
  • get still picture
  • send still picture via Telegram
  • http request to turn off LED

thx for your support

SSL support and access controls

The ESP32 is capable of secure (SSL) http communications; so enable it.
Lots of issues getting working certificates and keys, both generating them, and encoding them into the sketch. But a good example with documentation would be a good start,

  • This is another quite well known ESP32 thing to do; so I can probably leverage solutions from other projects, or at least get a good hint.

Adding a HTTP basic auth system makes sense as part of this; #80 has a good example.

V3 ++ Versioning?

i try V3beta3, and before the github version.
How do i differentiate the code-base/versions?
maybe even if it is flashed in different versions on different boards?

when the board dont get a webgui ready,
it would be great to see the version on the serial-monitor..

v3.0-RC2: issue with switching APs

Hi,

I installed v3.0-RC2 on two of my cams, one with external antenna.

I have 2 AccessPoints with the same SSID. Usually my devices connect to the AP with the strongest signal
but the two cams are only connecting to the AP which they connected to at first connect.

Does the cam store information of the AP somehow?
I once had this with another IP cam, where the cam refused to connect to another AP with the same SSID.

thx

Serial monitor errors

I have had many problems with my esp32 cam and have solved them but there is one I cant figure out. I have used the FTDI USB to TTL converter and two Arduino uno's and nothing is working. After running the camera web server script and removing the jumper from the esp32 cam I would open the serial monitor and click the RST button on the back of the cam to get the ip adress of the cam. But instead of the ip adress this error would pop up:

[E][sccb.c:154] SCCB_Write(): SCCB_Write Failed addr:0x70, reg:0x12, data:0x80, ret:-1
[E][sccb.c:154] SCCB_Write(): SCCB_Write Failed addr:0x70, reg:0xff, data:0x00, ret:-1
[E][sccb.c:154] SCCB_Write(): SCCB_Write Failed addr:0x70, reg:0x05, data:0x01, ret:-1
[E][camera.c:1215] camera_init(): Failed to set frame size
[E][camera.c:1270] esp_camera_init(): Camera init failed with error 0x20002

If anybody could help me that would be greatly appreciated.

Upload HTML index pages

It would be an idea to store the web assets: html indexes, icons, etc. on LittleFS, if available.

  • Separate CSS and Javascript files would be nice.
  • Either provide a default in the sketch, Or have a default landing page prompting for a web asset upload. grbl-esp32 does this and it works well.
  • Could enable a 'proper' toolchain for the Web UI, building and delivering the UI as a gzippped package
    This would allow easy updating and testing, skinning etc

Button actions via config mechanism not URI

Currently I (lazily) used simple calls to URI's to handle button actions (spiffs branch)
This causes URI handler 'bloat' and unwanted windows opening with responses. The 'Enrol' Button does it differently; leveraging the existing settings mechanism/uri. This would be a better way to handle this.

NTP client sync for RTC

Enable the RTC in the esp32 so that we can use the system time effectively.
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system_time.html

And select a time source: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system_time.html#rtc-clock-source
(the 8.5MHz option makes sense, we dont need to save power in deep sleep modes for this project)

  • Useful in V4 for saving files to disk, putting a timestamp on logging, etc.
  • Basis for an OSD overlay function
  • Provide a global flag that can be set to say 'NTP synced', and chose file names sensibly depending on that.
  • This looks like a good candidate: https://github.com/arduino-libraries/NTPClient
  • Config: activate by defining a ntp pool server in myconfig.h

This issue only covers adding NTP time syncing, future enhancements will actually use this info.

OTA required

Add OTA support. Is not posible to program a module that is in production. For example in a box in a corner in the ceiling of the room.

Small fix in storage.cpp

Hi there!
Thanks for a great project focusing on important things for many of us.

I will not make a pull request for that, but I do think that in file storage.cpp in line 2
https://github.com/easytarget/esp32-cam-webserver/blob/master/storage.cpp#L2

it should be:

#include "esp_camera.h"
#include "jsonlib/jsonlib.h"
#include "storage.h"

instead of:

#include "esp_camera.h"
#include "jsonlib/jsonlib.cpp"
#include "storage.h"

(I'm using platformio on VSCode and it throws error when the linker is started at the end of compilation)

MiniViewer

Similar to adding favicon responses, it should be relatively easy to make a standalone miniviewer page for the stream.

  • No Controls, except maybe a close button
  • Respect the current browser rotation setting when opened
  • Scale the stream to fill window (with borders to preserve ratio)

Proposal: script converting and compressing HTML pages automatically

Hi, thank you very much for providing this example code. Being actually a web-developer I was struggling with finding a way to be able to edit the HTML/styling more conveniently with some automatic conversion into the byte-arrays as in the original example.

I found some inspiration here and after some tweaking I made a script utilizing the bin2c tool to produce almost identical output as in the original example.

#!/bin/bash

OUTPUT_FILE=camera_index.h

convert_to_byte_array() {
    echo "Converting $@ to byte arrays"
    ./bin2c -m -o $OUTPUT_FILE $@
}

for file in `ls *.html`; do
    echo "Compressing: $file"
    cp "$file" "copy_$file" && \
    gzip -f "$file" && \
    mv "copy_$file" "$file"
    compressed_files=( "${compressed_files[@]}" $file".gz")
done
if test -f "./bin2c"; then
    convert_to_byte_array ${compressed_files[@]}
elif test -f "./bin2c.c"; then
    echo "Compiling bin2c from the source"
    gcc -o bin2c bin2c.c
    convert_to_byte_array ${compressed_files[@]}
else
    echo "Conversion of ${compressed_files[@]} to byte arrays not possilbe, missing bin2c.
Download bin2c source (bin2c.c) fom https://sourceforge.net/projects/bin2c/ and put it in this folder."
fi

I would like to replace the bash altogether with plain C code, but I wasn't able yet to figure out how to do the compression (some example is here)

So, maybe you could be interested to use my bash script or help me with extending the bin2c to something like html2c (There was something 20 years ago 😄 )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.