In this post, we will learn how to build a digital still image camera using the ESP32-CAM board. When the reset button is pressed, the board will take an image, store it to the microSD card and it will then go back to deep sleep. We use the EEPROM to store and obtain the image number.
The video above covers everything you need to know and also explains how the sketch is put together.
Step 1: Gather the Parts
Gather The Parts
The ESP32-CAM board already contains the camera module, reset switch 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 Board
Wiring For Sketch Upload
The 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.
Serial Output When In Download Mode
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 Card
Overview Of The Sketch
Download 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 & Test
Serial Output During Operation
Power 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. Press the reset button and the board will boot, capture and image and go to sleep again.
Step 5: Obtain & Share the Images
Sample Image 1 (Original)
Sample Image 1 (Corrected)
Sample Image 1 (Original)
Sample Image 2 (Corrected)
Once you are done taking images, you can remove the microSD card, and connect it into your computer. All the images should be visible for you to use. This is a simple way by which you can create a digital camera using the ESP32-CAM board. The image quality is not that great but that should change once they release better quality cameras for this board. The images also seem to have a greenish tint to them which can be corrected using image editing software, examples have been included above.