Note line 1413 -- this current version uses the WiFiManager for all WiFi setup. Change this line if you want to use the previous version of hardcoded ssid and password.
Just the same as Verion 98, but you can configure the ssid and password using WiFiManager.
Use the normal WiFiManager procedure to set up ssid with 192.168.4.1 etc https://github.com/tzapu/WiFiManager
The only difference is that you have to reboot the esp32 after you have set the ssid/pass for it to work correctly.
Read more about it here https://github.com/tzapu/WiFiManager/issues/1184
And you must use the latest WiFiManager code which supports the ESP32 - currently 2.0.3-alpha which can be installed from Arduino IDE - Manage Libraries.
The WiFiManager could be enhanced to set parameters that cannot be set from hhtp, such as Telegram name and password, but haven't done that yet.
Added a feature to automatically delete your oldest day of videos when the SD reaches 90% full.
There are also some compile directives in the settings.h file to cut out entire sections of code like the ftp or telegram, if you need resouces to add your own stuff.
Check out a much simpler, somewhat faster version ESP32-CAM-Video_Recorder-junior.
It gets rid of wifi, http, time, ftp, telegram, pir, touch, .... and just records very fast -- pretty much at the full speed of the camera -- with a decent SD card and reasonable quality parameters.
The latest version of junior v07 adds back the streaming video, and series of photos over wifi, and will record at 6 fps UXGA and 24 fps SVGA, but otherwise remains quite uncomplicated.
## Update Aug 29, 2020 Version 94 - live stream and filter bad jpegs
A couple new things.
I added some code to filter out bad jpegs. This happens when you have high quality jpeg settings, and then take a movie in bright light, and some of the jpegs exceed the memory allocated, and you get a partial jpeg, which will screw up the index, and break an entire avi. So there is now code to find those bad jpegs, and get a new frame that is good. Read more about this here if interested.
This means it is safe to increase the jpeg quality to 7 (maybe 6?) from the standard setting of 10, or 12 in bright sun. Lower number is higher quality. Higher quality will mean more bytes, bigger files, and slower to write. It is debatable if you want very high quality jpegs if they are flashing along at 24 frames per second.
Another new feature is a streaming video. There is the single frame on the main status screen so you code see what your camera sees, but the streaming has been much requested to get a better look through the viewfinder, and maybe save the stream.
You set a parameter in settings.h of milli-seconds between updates, and then click on the /stream link on the main web page and it will stream to a new browser window. Hit "back" to get back to the main page.
To save the video coming to the browser, do the following -- I tried to figure this out before but could not find it on google.
1. Click on the /stream on the web page, and you will see the moving picture.
2. Right-click and select "save image as ...", type a name, and it will start saving the series of jpegs to a file.
3. You have to stop the save, which as far as I can figure out, you have to select cancel from the menu of the ever increasing file. But that will delete the file that you have been saving. So the kludge is to "show in folder" to find the file, then copy the file, then do the cancel. Then you have to rename that file to x.mjpeg, and then you can play it. Most programs that play .avi files will not play the .mjpeg, but some will. See VLC below. Very inelegant.
Another method is to use the VLC media player program.
1. Media - Open Network Stream - paste in the url such as http://192.168.1.90/stream
2. Then in the Play menu, switch it to Convert, click on "Dump Raw Input" and type filename ending in .mjpeg, and click Start. When you are down saving, click the square stop button. You will get a .mjpeg file which can be played in VLC and some other video or picture players. An mjpeg does not understand time, so it will play the picture as quick as it can, and you have have to enter new information about the time between frames to get it to play as you want.
VLC seems to have controls there to convert the file to various formats like h264, wmv, etc. but I could not get that to work.
If anyone has better ways to capture the live stream, or capture and covert it, please let us know in the comments.
I have not really studied how the streaming interacts with the recording. But 3 fps streaming seems to work fine with 8 fps svga recording. More work to be done there. I reduced the http task priorty to below the picture-taking and avi-writing tasks, so the the streaming should slow down before the recording. It seems the esp32 http server can only handle one client at a time, so you cannot stream to one browser and check the status on another browser.
Another small feature is that you can now tell the recorder to /stop, and then /start with no parameters, and it will restart according to the original start parameters. Not only the framesize and interval, but if you set it to record 100 videos, and it has 5 left, after a /stop and /start it will restart at 100 videos.
Also if you have some parameters in EPROM, and your are doing a new compile with changes and you do not want to use those EPROM parameters, there is a setting called MagicNumber in the settings.h. Just change the MagicNumber, and the program will skip the EPROM settings and write your new settings from settings.h
I changed to default startup settings to VGA 10 frames per second, play at realtime, with no PIR or BOT.
- added some code to save the configuration in eprom, so your device will always reboot to the state set in your most recent /start command. The previous system just had a hardcoded configuration, and let you /stop and /start in a new configuration, but after a series of squirrel attacks, I moved to the eprom solution. It always starts where it was, although a movie in progress during the squirrel attack will be lost. You can enable or disable the telegram bot or PIR sensor with a web-page click, and that too will be added to the eprom, so it reboots with or without bot updates or PIR control. On reboot, it will check your eprom to see if there are parameters, and if so it will use them, or else use the hardcoded parameters from settings.h, and then write those paramters into eprom for next boot. Change the eprom parameters with the /start command below.
- changed the movie start procedure a little. It now takes a snapshot at beginning of movie, saves it as a .jpg, and if Telegram bot is enabled sends that same picture to your telegram so you can monitor the activity on your phone, or use that jpg if you want. It does take several seconds to send the picture to telegram. And only after that does it start recording the movie. I attempted to do the telegram send after the movie started recording, but the telegram uses SSL security which needs 50k or more of heap, which would sometimes leave too little heap to work the SD card. Also the reboot from deepsleep takes a couple seconds, then starting internet takes a couple seconds, then telegram bot takes a couple seconds, and then the movie starts. So if you want fast-start, then don't use deepsleep, turn off internet, and obviously turn off telegram.
- changed reprogramming the camera a little. It used to re-set frame-size, quality with every movie, but now it is just when you make changes and at reboot.
- I have switched to quality = 12 which is better for sunny days, and does noticably increase frame-rate. I can usually get SVGA working at 10 frames per second, which is decent realtime video.
- http://desklens.local/bot_enable
- http://desklens.local/bot_disable
- http://desklens.local/pir_enable
- http://desklens.local/pir_disable
- http://desklens.local/ ... look through viewfinder and see status
- http://desklens.local/stop
- http://desklens.local/start ... with existing or default parameters
- added a sd card snapshot jpg at beginning of every movie
- added a telegram.org message with opening picture and info about diskspace and rssi to follow camera activity on your computer or phone
- added deepsleep feature to wake on PIR, and then deepsleep after movie is recorded
- added touch sensor on pin12 to enable/disable the pir sensor
- added more careful setup of difficult pins 12, 13, and 4 - used for SD and re-used for PIR, Touch, and Blinding Disk-Active Light
- added brownout handler to close files on brownout, which didn't work, but at least I can deepsleep to prevent multiple brownout reboots. (Inside a brownout handler, you have only 300ms and you cannot access wifi, sd, or flash, ... so cannot close files, or send message.)
- re-used pin 4 Blinding Disk-Active Light to blink gently at beginning of movie, and at a Touch - ironically, also turns on during Brownout ;-)
- added several functions to enable / disable pir or bot using internet
- http://desklens.local/bot_enable
- http://desklens.local/bot_disable
- http://desklens.local/pir_enable
- http://desklens.local/pir_disable
- http://desklens.local/ ... look through viewfinder and see status
- http://desklens.local/stop
- http://desklens.local/start ... with existing or default parameters
- moved many settings to a separate file "settings.h" so you edit that, rather than digging through the main file to set your wifi password, startup defaults, and enable/disable internet, pir, telegram, etc
- not super-elegant code ... still haven't written the avi writer into a nice library
- read comment on rtc_cntl.h below which may or may not be updated in the esp32 board library - links and info below
- This includes a v1.2 (slight mods) of https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot for the Telegram stuff, plus the ftp and ArduCam mentioned below (major rewrite on ArduCam)
- to use PIR function, put an active high PIR or microwave on pin 13 with a 10k resistor (brown,black,orange) between pin 13 and PIR output to avoid antagonizing sd card
- to use Touch function, put a wire (with optional metal touch point) on pin 12 and touch it to enable/disable pir
## Update Feb 29, 2020 Sample Hardware for Microwave Camera
This is a bit of hardware to set up a camera recording to SD Card whenever something moves, as seen through a microwave device, and adds a led so you can see when the camera sees you!
- if you want no internet, just leave the fake ssid and password, and it will date your PIR recordings as 1970, but keep all your PIR clips timed and dated after 1970, which is better than just numbering them
- default startup is VGA, 10 fps, quailty 10, 30 minutes long, playback realtime, repeat 100 times, and it starts automatically after a reboot -- this is actually a little aggressive for my LEXAR 300x 32GB microSDHC UHS-I, which will usually keep up with 10 fps, but will sometimes start skipping
- BlinkWithWrite #define of 1 will blink the little red led with every frame, or #define 0 will just blink SOS if the camera or sd card are broken, or if you are skipping frames because sd cannot keep up
- also implemented dates and times in ftp which had been mysteriously missing. The "Date Modified" on Windows should now be the correct time the file was completed on the ESP32. The "Date Created" will be the time you ftp'ed it. And the time in the file name is the time the file was started recording on the ESP32.
- also note that the file names of the PIR files are all just "L15" (the original creation of the file), but the files themselves will be as long as the PIR had activity. I haven't updated the filename for the eventual length.
- you just need the 3 files from the /v60 folder
- I'll rewrite this intro with v60 instructions ... at some point
- put a capacitor between the +5 and Ground to prevent the frequent "brownout" problems. I saw 220 microFarad recommended somewhere, and it works good.
- keep the antenna part of the chip - the part with the squiggly line - above and away from your circuit board or any wires. The internet speed will improve dramatically with just 1 or 2 mm of extra space.
Also, other SD chips will be faster or slower. I was using a SanDisk 16GB microSDHC "Up to 653X" - which was slower and more unpredictable than the LEXAR ???
Picture below shows my solution to the "Flash" led, aka "the Blinding Disk-Active light". The led turns on whenever you are are writing data to the SD chip, which is normally after you have taken the picture, so you don't need the flash on any more!
Quick de-solder of the collector on the top of the J3Y transistor just above the led, then put in some tape to keep it clear -- you can solder it back later if you want to use it.