Рет қаралды 4,235
Here's a quick tutorial on how to save a series of still images from the ESP32 CAM microcontroller module onto an SD card, sleeping the device between shots and remembering the frame number.
Code download here: www.brettb.com/coding-tutorial...
Here's my beginner's guide to saving timelapse images onto a micro SD card using the ESP32: • ESP32 CAM How to Save ...
This video is especially useful if you want to make long duration timelapse movies. The easiest method of achieving this is by using the board's electrically erasable programmable read-only memory (EEPROM) capability. The EEPROM memory is retained by the ESP32 after sleeping and even after restarts. The downside to using this technique is that the EEPROM has a limited lifespan of around 100,000 write operations.
00:00 - Introduction
01:00 - Storing Frame Number in EEPROM
02:56 - ESP32 Preferences Library
03:40 - Sleeping the ESP32 CAM
05:20 - Taking Photos
05:48 - Avoiding Green Tinted Images
07:05 - Timelapse Results
07:46 - Exposure Issues
09:10 - Adjusting Image Parameters
I should just mention that the ESP32 EEPROM library has been deprecated. We should really be using the Preferences library with the ESP32 and ESP32 CAM. However, I just could not get the Preferences library to work on either of the ESP32 CAM modules I used.
You could also save the frame number to a text file on the board's SD card, but I tried doing this and quickly found out it's not as straightforward as I thought it would be.
Just bear in mind the code I've written will save a maximum of 255 images then the file numbering will reset back to 0. The solution to this would be either to save the image number as a 16 bit value, or to use the Preferences library I mentioned earlier.
As far as sleeping the ESP32 board goes, you need to call esp_sleep_enable_timer_wakeup passing in the number of microseconds to sleep for (there are one million microseconds in a second). Remember to call esp_deep_sleep_start after this, otherwise the ESP32 board won't actually go to sleep!
If you wanted to make a home surveillance IoT device then you can also use external peripherals to wake the device up again.
Credits:
Video by Pixabay: www.pexels.com/video/flora-bl...