It wasn't long ago that digital pictures were in their infancy. And even now, investing in an industrial vision system will set you back thousands of dollars. But you don't have to pay hundreds or thousands of dollars for a camera, processor, and Wi-Fi capabilities. You can obtain a basic vision system for under ten dollars in the form of an ESP32 camera: the ESP32-CAM.
Make no mistake; this device can't compete with a top-of-the-line Hasselblad camera or a hardened Cognex industrial vision system. However, the ESP32-CAM boasts the following impressive features:
- Included Wi-Fi
- Processor with speeds up to 240MHz
- 2.0MP OV2640 image sensor
The system can stream images or video over Wi-Fi as well as perform face detection and face ID, all via a demo program included with the drivers.
So, what's the catch? Why isn't the ESP32-CAM everywhere? Well, the system is quite new and—perhaps owing in part to its newness—the initial setup can be tricky. Notably, the ESP32-CAM doesn't have a USB port, so you'll need to be able to program it with an FTDI cable. In my case, loading a program onto the device took a fair amount of hacking and research. I'll walk you through the process, which will hopefully help you avoid frustration and progress to processing video faster.
Initial Software Setup: ESP32 Cam Arduino IDE
Follow these steps to set up the software:
-
1. If you have the Arduino IDE setup, you'll need to install the ESP32 add-on package using these steps:
- Navigate to File - Preferences
- Enter https://dl.espressif.com/dl/package_esp32_index.json in the "Additional Boards Manager URLs" field, using a comma to separate the URL from any other text in the field.
2. Select OK, then navigate to Tools - Board – Boards Manager and search for ESP32.
3. Select ESP32 and select "Install".
4. Navigate to File – Examples – ESP32 – Camera – CameraWebServer to bring up the ESP32 web server example.
5. Plug in your FTDI device (more information below).
6. Select the appropriate port under Tools.
7. Select the board as ESP32 Wrover Module, and set the partition scheme as Huge APP (3mb No OTA/1MB SPIFFS).
8. In the example sketch, comment out the line: #define CAMERA_MODEL_WROVER_KIT by putting a pair of forward slashes before it.
9. Uncomment the last camera line to: #define CAMERA_MODEL_AI_THINKER to select the camera setup you'll be using.
10. Below that text, input your Wi-Fi SSID and password in place of the existing asterisks (*), then save your customized file under a different name.