This project builds upon the previous digital image camera project and we build a time-lapse camera using the ESP32-CAM board. All the images are saved to the microSD card in sequence and the board goes to sleep after taking an image to help save power. This is handy if you power it using a battery.
The video above covers everything you need to know and also explains how the sketch is put together.
Step 1: Gather the PartsThe ESP32-CAM board already contains the camera module, and microSD card slot that we need for this sketch. In addition to this, you will need a microSD card, a 5V power source and also a USB to serial converter to upload the sketch.
Step 2: Wire Up the BoardThe ESP32-CAM board does not have an onboard USB connector so you need to use an external USB to serial converter to upload the sketch. You can use the wiring connections shown above but make sure that the USB to serial converter is connected in the 3.3V mode.
It is recommended to use an external 5V supply to power the board, particularly if you are using an FTDI breakout board. For the external 5V supply, a simple USB breakout board will do just fine. There has been some success in powering the board directly from the CP2102 breakout board so you can try that first. The board also has a 3.3V power pin if needed.
The jumper is needed to put the board in the download mode. Once you have everything connected, power up the board, open a serial terminal (Tools->Serial Monitor) with a baud rate of 115, 200 and press the reset button. You should obtain an output as shown in the image and this will indicate that everything is working as expected.
Step 3: Download the Sketch & Format SD CardDownload the sketch using the link at the end of this post and open it using the Arduino IDE.
The sketch requires that the microSD card be formatted in the FAT32 file format which is usually the default file system. In windows, you can do this by right-clicking the microSD card, selecting format, then the correct settings and hitting start. Once this is done, insert the microSD card into the ESP32-CAM board.
Step 4: Upload & TestPower up the board in the sketch upload mode and hit the upload button. Wait for it to complete. Once done, remove the boot jumper and press the reset button. The board will take an image, save it to the microSD card and go to sleep. The serial terminal will give you the board status along with any errors or warnings. Wait for sufficient time to lapse and the board will wake up again to repeat the cycle.
The second last line in the setup() function specifies the time-lapse and you can update this by changing the pre-processor directive located at the top of the sketch. The images will be stored in the microSD card and can be used as needed.
Step 5: Print the EnclosureAn enclosure greatly helps in taking steady images and I found a nice little enclosure the works great for this build.
Link to 3D model: https://www.thingiverse.com/thing:3652452
You can add a microUSB breakout board to power the ESP32-CAM board but since I only had one board with me, I decided to solder wires to the 5V and ground pin and use an external breakout board. The back cover was flipped to support this. The 3D model also contains several stands that allow for versatile mounting.
It's amazing what this little board can do and the images produce some interesting results once color corrected. Do check out the video for a sample clip.
Here are some relevant links in case you would like to learn more about us. Thank you for your support!
- YouTube: https://www.youtube.com/channel/UCbWiK1A5RqAugSquBHuyBdA
- BnBe Website: https://www.bitsnblobs.com/
- Instagram: https://www.instagram.com/bnbe.club/
- Facebook: https://www.facebook.com/BnBe.club
- Twitter: https://twitter.com/bnbe_club
Comments