Giter VIP home page Giter VIP logo

esp32-cam-linux-motion's Introduction

Camera Webserver ESP32-CAM AI-THINKER Board with LED control Version 2 (The IP WebCam ;)

  • stable IP-WebCam for linux-motion (OV2640 only)
  • ESP-IDF V4.4 project, C code.

modul

Overview

This is a new software for the famous little esp32-cam modul optimized for multible webcams with linux-motion.

  • small network load due to reduced framerate 8fps at 640*480.(typ. 1Mbits/sec per Cam)
  • stable Wifi reconnect
  • Wifi ssid/passwd config via serial interface to store in NVS (eeprom) (max 10)
  • Boot-indication by small red Debug-LED. Is on until succesful connect to Wifi. (visual feedback of connect)

A custom tcpserver interacts directly with lwIP via BSD Socket API. No facedetect!.

++UPDATE++

  • Updated software to IDF version 4.4
  • bugfix: removed wifi retry counter for stable reconnect
  • webpage: status: added UpTime(hrs)(to check for last reset/connection loss) and RSSI signal strength(to monitor wifi quality)
  • Compile: idf.py build, then idf.py flash monitor. Also make and make flash monitor could be used.

Web-Interface

has been updated.

  • Status line: at top of page shows: NetworkFPS(Netw-Throuput), CameraFPS(OV2640FPS), I2sFPS(driver) QUEerrors(driver), JPGerros(I2S), UpTime, RSSI.
    via GET Button
  • nightmode: long exposure times, auto-framerate 3 to 25 fps depending on light. AEC and AGC must be ON!!!
  • streamspeed: change between slow(default)(better exposure in dark) and full(full speed)
  • flashlight: enable highpower LED on still capture
  • streamlight: enable highpower LED during streaming
  • ESP32RESET: down below in ClockSettings. This will Reset the esp32 processor, software reset.

menue

IP interfaces via http://

  • camIP = loads the Webpage as above for interactive camera control
  • camIP:81/stream = streaming interface (optional streamlight)
  • camIP/capture = capture/save still image (optional flashlight)
  • camIP/download = download image directly from camera.(optional flashlight)

The camera may be configured without webpage if appropriate control/json strings are send.
Settings are always feedback via serial interface if connected.

Hardware

This nice little ESP32-CAM board sold everywhere might give you some headaches.
Brownout-resets, wifi-disconnects, boot errors, .... camera has horizontal stripes...

The spec says, supply it with 5V on the 5V-pin.
There is a voltageregulator picking up the 5V and convert it to 3.3V
needed by the board to operate properly.

It seems that this regulator is working just "on the edge" with 5V.
Raising the powersupply voltage to 5.4V (upto 6 or so volts) gives a much more relyable operation, in my experience!.
(my horizontal stripes were gone;)
Ie. some moduls work with 5V, some dont, needing 5.4V+

The USB-A connector (for power supply) into the USB-charger also causes problems. If it gets dirty there is a remarkable resistance which causes voltage-drops on current-spikes!

The HighPower LED gets very hot!!

Arduino

I know many folks are using Arduino IDE.

Including an external esp32 C project in Arduino you need the esp32-cam board files.
(which also includes the ESP-IDF arduino version, plus the camera driver maybe?)
(preferences->additional Boardmanagers Url:)
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
Then Tools->boardmanager:
select "AI-Thinker esp32-cam" as board.

I tried it, using a sketch like this:

extern "C"{
void app_main_camera(void); // main camera function renamed to avoid conflict with arduino app_main()
}

void setup() {
  // put your setup code here, to run once:
app_main_camera(); // this shall never return! cameras main function.
}

void loop() {
  // put your main code here, to run repeatedly: there is nothing todo repeatedly.
}

Added sourcefiles as needed to the sketch(no subdirectorys)...however, didnt compile through (but quite a bit!).
Maybe you have more luck ?!

Binarys

For those who do not want to compile anything, i added the binarys to this repo.
You can flash it with esptool.py. There is also a Windows-exe version. (see "binarys" docu on flashing)
You can add Wifi credentials via serial afterwards!!

Linux Motion

I have several cameras connected to Linux-Motion, running very stable.
Due to the low Framerate networkload is not a problem.
About 1Mbits/s per cam.
I added some sample configfiles for LinuxMotion in docu.

Wifi credentials

Editing Wifi credentials via serial Port:

You obviouly need to be connected with a terminal (putty?) to the serial port at 8N1, 115200.
After reset the bootup will stop for 2 seconds at message "+++LoginEdit+++".
If you hit the SPACE key at this point you will enter an interactive dialog to enter/edit Wifi credentials which are saved in NVS (eeprom).
There are 10 entrys you can edit.

Edit options are:

  • list = list all 10 entrys (empty ones are just blank)
  • edit = enter new ssid/passwd
  • delete = delete entry
  • save = save change to NVS (dont forget this)
  • Quit = exit the dialog and continue bootup with current credentials.

Have fun ;) xenpac

esp32-cam-linux-motion's People

Contributors

xenpac 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp32-cam-linux-motion's Issues

Cannot edit wifi credentials - no serial connection possible.

Hi,

I was able to upload the code like this on Winodws 10:

C:\Users\User\Downloads\ESP32-CAM-Linux-Motion-main\binarys>python tools/esptool.py --chip esp32 --port "COM5" --baud 921600 --before "default_reset" --after "hard_reset" write_flash -z --flash_mode "dio" --flash_freq "80m" --flash_size detect 0x1000 bootloader.bin 0x10000 espcam.bin 0x8000 partitions.bin
esptool.py v2.8
Serial port COM5
Connecting....
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 3c:61:05:17:51:e0
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 24496 bytes to 15356...
Wrote 24496 bytes (15356 compressed) at 0x00001000 in 0.2 seconds (effective 1020.4 kbit/s)...
Hash of data verified.
Compressed 649456 bytes to 411123...
Wrote 649456 bytes (411123 compressed) at 0x00010000 in 6.0 seconds (effective 866.3 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 87...
Wrote 3072 bytes (87 compressed) at 0x00008000 in 0.0 seconds (effective 1468.0 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

So far, so good. but when I config putty (Port "COM5", 1115200 baud, Data bits 8, stopits 1, Parity None, Flow control None), and I open the session, I see nothing. After hitting the reset-button on my ESP32-Cam I get this:

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))
waiting for download

When I do the same with the serial monitor of the Arduino-IDE, I get the same result.

What am I doing wrong?

Wifi password longer 32 char

Hi,
first of all, thank you for your repo!

Sadly I'm using a 63 char. Wifi password, which is cropped after char. 32.
Can you help me solving this?

Many thanks!

Commandline parameter?

In the original esp32cam webcam I can change the parameters directly in the browser in the format http://ip-adress/control?var=&val=. Is there a variable for the LED?

I found this variables in the web:
Description Variblenname Values
Resolution framesize 10 UXGA(1600×1200)
9 SXGA(1280×1024)
8 XGA(1024×768)
7 SVGA(800×600)
6 VGA(640×480)
5 CIF(400×296)
4 QVGA(320×240)
3 HQVGA(240×176)
0 QQVGA(160×120)
4 Preset
Picture quality 10 good to
63 poor
10 Preset
Brightness brightness -2 to 2
0 Preset
Contrast contrast -2 to 2
0 Preset
Saturation saturation -2 to 2
0 Preset
Special effects special_effect 0 No effect
1 Negative image
2 Black/white
3 Red complexion
4 Green complexion
5 Blue complexion
6 Sepia
0 Preset
Turn white balance on/off awb 0 Off
1 On
1 Preset
Use special functions for
Use white balance.
On/Off awb_gain 0 Off
1 On
1 Preset
White balance
Functions wb_mode 0 Auto
1 Sunny
2 Cloudy
3 Office
4 Home
0 Preset
AEC SENSOR aec 0 Off
1 On
1 Preset
AEC DSP aec2 0 Off
1 On
1 Preset
AE Level? ae_level -2 to 2 0
Exposure?
(not visible for me) aec_value 0 - 1200 204
Switches between the
following functions
agc_gain and gainceilling agc 0 Gain
1 Gain-Ceilling
1 Preset
agc_gain-group? agc_gain 0 single
30 31 fold
5
gainceiling-group? gainceiling 0 two fold To
6 128 fold
0
BPC? bpc 0 Off
1 On
0 Preset
WPC ? wpc 0 Off
1 On
1 Preset
Raw GMA ? raw_gma 0 Off
1 On
1 Preset
Lens Correction? lenc 0 Off
1 On
1 Preset
Horizontal reflection
(If the cam is on the side
side = vertical) hmirror 0 Off
1 On
1 Preset
Vertical mirroring
(When the cam is on the side
side = horizontal) vflip 0 Off
1 On
1 Preset
DCW (Downsize EN) ?
Downsizes the image dcw 0 Off
1 On
1 Preset
Displays color bars on
on the screen colorbar 0 Off
1 On
0 Preset
Enable face search face_detect 0 Off
1 On
0 Preset
Enable face recognition face_recognize 0 Off
1 On
0 Preset

Is there a variable for the LED?

Error when trying to make.

I get this error when trying to build.
D:/esp_projects/ESP32-CAM-Linux-Motion-main/main/tcpserver.c:27:10: fatal error: esp_wifi.h: No such file or directory
27 | #include "esp_wifi.h"
| ^~~~~~~~~~~~

Having troubles compiling

Hello,

Good job with this really great project.
I'm facing troubles compiling your project.
Using the pre-built binaries does not fit my needs because I would like to change the param "max retry wifi reconnect" which is set by default to 5, in order to be able to handle long-loss connection issue (due to router shutdown for instance or electricity outage (>1day))

Would it be possible for you to share the way you build your project in order to get these binaries please ?

Thank you,

PS : I am not confortable at all with building C project
PS2 : I just realized you reset the board (I think) after 5 fails

esp_restart(); // we just reset the board as the TCPserver will likely hang. also we can connect to different AP then.

Error Putty

I can’t connect via putty, the terminal freezes and nothing happens. Is it possible to upload this firmware via arduino somehow?

serial error in red

E (979732) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (979732) task_wdt: - IDLE (CPU 0)
E (979732) task_wdt: Tasks currently running:
E (979732) task_wdt: CPU 0: main
E (979732) task_wdt: CPU 1: IDLE
E (979732) task_wdt: Print CPU 0 (current core) backtrace

Backtrace:0x400EDBEF:0x3FFB0C700x40083E89:0x3FFB0C90 0x4008D615:0x3FFBA0A0 0x4000BE96:0x3FFBA0C0 0x4000177B:0x3FFBA0E0 0x400D92F8:0x3FFBA100 0x400D9397:0x412D6E65 |<-CORRUPTED

E (979732) task_wdt: Print CPU 1 backtrace

Backtrace:0x40085C4D:0x3FFB12700x40083E89:0x3FFB1290 0x4000BFED:0x3FFBB770 0x4008EFA5:0x3FFBB780 0x400EDE8F:0x3FFBB7A0 0x400EDE9B:0x3FFBB7C0 0x400D2702:0x3FFBB7E0 0x4008CFFC:0x3FFBB800

Errors while compiling the project

Hello,
I'm using this project for a while now, but I would like to change the default resolution to 720p/HD, but I can't compile the project.

I'm using esp-idf for the first time and set it up according to your description in issue #1 (installing and setting compiler path via menuconfig).
I now have esp-idf v4.4 with xtensa-esp32-gcc8_4_0-esp-2021r2-patch4 compiler (from here https://github.com/espressif/crosstool-NG ) installed.
I'm using up-to-date amd64 Manjaro-Linux.

When i run make, the following errors are occurring:

In file included from ~/esp4.4/esp-idf/components/perfmon/xtensa_perfmon_access.c:16:
~/esp4.4/esp-idf/components/perfmon/xtensa_perfmon_access.c: In function 'xtensa_perfmon_init':
~/esp4.4/esp-idf/components/xtensa/include/xtensa-debug-module.h:80:29: error: 'XCHAL_NUM_PERF_COUNTERS' undeclared (first use in this function)
 #define ERI_PERFMON_MAX     XCHAL_NUM_PERF_COUNTERS
                             ^~~~~~~~~~~~~~~~~~~~~~~

~/esp4.4/esp-idf/components/perfmon/xtensa_perfmon_access.c:22:15: note: in expansion of macro 'ERI_PERFMON_MAX'
     if (id >= ERI_PERFMON_MAX) {
               ^~~~~~~~~~~~~~~
~/esp4.4/esp-idf/components/xtensa/include/xtensa-debug-module.h:80:29: note: each undeclared identifier is reported only once for each function it appears in
 #define ERI_PERFMON_MAX     XCHAL_NUM_PERF_COUNTERS
                             ^~~~~~~~~~~~~~~~~~~~~~~
~/esp4.4/esp-idf/components/perfmon/xtensa_perfmon_access.c:22:15: note: in expansion of macro 'ERI_PERFMON_MAX'
     if (id >= ERI_PERFMON_MAX) {
               ^~~~~~~~~~~~~~~
~/esp4.4/esp-idf/components/perfmon/xtensa_perfmon_access.c: In function 'xtensa_perfmon_dump':
~/esp4.4/esp-idf/components/xtensa/include/xtensa-debug-module.h:80:29: error: 'XCHAL_NUM_PERF_COUNTERS' undeclared (first use in this function)
 #define ERI_PERFMON_MAX     XCHAL_NUM_PERF_COUNTERS
                             ^~~~~~~~~~~~~~~~~~~~~~~
~/esp4.4/esp-idf/components/perfmon/xtensa_perfmon_access.c:42:26: note: in expansion of macro 'ERI_PERFMON_MAX'
     for (int i = 0 ; i < ERI_PERFMON_MAX ; i++) {
                          ^~~~~~~~~~~~~~~
~/esp4.4/esp-idf/components/perfmon/xtensa_perfmon_access.c: In function 'xtensa_perfmon_reset':
~/esp4.4/esp-idf/components/xtensa/include/xtensa-debug-module.h:80:29: error: 'XCHAL_NUM_PERF_COUNTERS' undeclared (first use in this function)
 #define ERI_PERFMON_MAX     XCHAL_NUM_PERF_COUNTERS
                             ^~~~~~~~~~~~~~~~~~~~~~~
~/esp4.4/esp-idf/components/perfmon/xtensa_perfmon_access.c:52:15: note: in expansion of macro 'ERI_PERFMON_MAX'
     if (id >= ERI_PERFMON_MAX) {
               ^~~~~~~~~~~~~~~
~/esp4.4/esp-idf/components/perfmon/xtensa_perfmon_access.c: In function 'xtensa_perfmon_value':
~/esp4.4/esp-idf/components/xtensa/include/xtensa-debug-module.h:80:29: error: 'XCHAL_NUM_PERF_COUNTERS' undeclared (first use in this function)
 #define ERI_PERFMON_MAX     XCHAL_NUM_PERF_COUNTERS
                             ^~~~~~~~~~~~~~~~~~~~~~~
~/esp4.4/esp-idf/components/perfmon/xtensa_perfmon_access.c:71:15: note: in expansion of macro 'ERI_PERFMON_MAX'
     if (id >= ERI_PERFMON_MAX) {
               ^~~~~~~~~~~~~~~
~/esp4.4/esp-idf/components/perfmon/xtensa_perfmon_access.c: In function 'xtensa_perfmon_overflow':
~/esp4.4/esp-idf/components/xtensa/include/xtensa-debug-module.h:80:29: error: 'XCHAL_NUM_PERF_COUNTERS' undeclared (first use in this function)
 #define ERI_PERFMON_MAX     XCHAL_NUM_PERF_COUNTERS
                             ^~~~~~~~~~~~~~~~~~~~~~~
~/esp4.4/esp-idf/components/perfmon/xtensa_perfmon_access.c:80:15: note: in expansion of macro 'ERI_PERFMON_MAX'
     if (id >= ERI_PERFMON_MAX) {
               ^~~~~~~~~~~~~~~
make[1]: *** [~/esp4.4/esp-idf/make/component_wrapper.mk:298: xtensa_perfmon_access.o] Error 1
make: *** [~/esp4.4/esp-idf/make/project.mk:649: component-perfmon-build] Error 2

It would be nice, if you could help me to resolve this issue or if you could provide a binary with 720p default resolution (or maybe store it on the board, like the wifi credentials).

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.