ESP32-CAM Review

By Ben Everard. Posted

A cheap, hackable, WiFi-enabled camera is a holy grail for makers. When we first heard about the ESP32-CAM from AI-Thinker, we had to find out if we had such a product for our maker toolbox. We ordered one for £6.66 (including delivery to the UK) from YX Electronic Components on AliExpress.

It came in two parts. The main board (which is an ESP32 module mounted on a larger board) and a separate camera module. The flex cable from the camera slots into the main board. Although there’s no specific mounting for the camera, it sits nicely on top of the memory card slot, so with a drop of glue or tape, you can secure it easily.

The board is based on an ESP32 module, which is a programmable microcontroller with built-in WiFi and Bluetooth, with an additional 4MB of external RAM. Also on the board is a memory card slot and a camera connector that can take an OV2640 or OV7670 camera module (the former was included in the price of our board). In principle, this is a pretty beefy unit. The ESP32 has plenty of processing power, with two 120MHz 32-bit processing cores.

The memory card slot is listed as ‘TF’ (which stands for TransFlash) on every spec sheet we’ve seen. This is a little odd as this is the original name for what has now become microSD. We’re not sure why they’re listed using this name and not the current microSD, but you can use microSD cards in this port (though you will have to add support to them in your software).

Let’s take a look at what it takes to get the board up and running. There are a few ways of programming the ESP32-CAM, but we’re most familiar with
the Arduino IDE, so we tried this. To install the ESP32 boards, go to File > Preferences and add ‘https://dl.espressif.com/dl/package_esp32_index.json’ to the Additional Board Manager URLs box – this is a comma-separated list, so add a comma before it if you already have any URLs in the box.

In the Tools > Boards section, you should now have an ESP32 Arduino section. In that section, you should see an entry for AI Thinker ” ESP32-CAM. However, we weren’t able to program the board using this. Instead, we used the definition for another, similar board: the ESP32 Wrover Module.

Once you’ve selected this, you should find the web server example sketch, which is a great test to make sure everything’s connected properly. This is in Files > Examples > ESP32 > Camera > CameraWebServer.

You’ll need to make a few changes to this sketch. First, add ‘//’ to the start of the following line to comment it out.

#define CAMERAMODELWROVER_KIT

Then delete the // at the start of this line to enable it.

//#define CAMERAMODELAI_THINKER

Finally, you’ll need to enter your WiFi details in the following lines:

const char* ssid = “”;
const char* password = “”;

You’ll also need to set the Partition Scheme to Huge App and the Upload Speed to 115200 (these are in the Tools menu). That’s the software side of things set up for this board, so let’s now take a look at the hardware.

You may notice that there’s no USB port on this board, so you’ll need a USB to serial adapter to program it. Any USB to UART adapter should work, and they are available for a few pounds. We used a Particle Debugger because we happened to have one with us, but this is overkill for this project.

You’ll need four connections between the UART adapter and the ESP32 Camera: 5 V (this may be labelled VUSB) to 5 V, GND to GND, TX on the USB adapter to U0R on the ESP32-CAM, and RX on the adapter to U0T on the ESP32-CAM. Also, you’ll need to connect IO0 on the ESP32-CAM and GND – this puts the board into flashing mode, and we’ll remove this once we’ve programmed the board.

With that setup,you can plug your USB to UART adapter into your computer’s USB port, and now you should be able to select a Port from the Tools menu in the Arduino IDE. Press the upload button (the arrow icon) and – after a short wait – your code should be on your board. There’ll be a message in the black box at the bottom of the screen saying that the upload was successful (or not).

You can now unplug the IO0 to GND connection but leave everything else connected for now. Open the serial monitor in the Arduino IDE, set the baud rate to 115200 (bottom-right corner), and press the reset button on the ESP32-CAM.
In the serial monitor, you’ll see a bit of debug code followed by something like:

Camera Ready! Use ‘http://x.x.x.x’ to connect

If you point a web browser to that URL, you’ll see the camera control page. Press ‘Start stream’ to see the output of the camera.

For a cheap IP webcam, this works well if you’re happy using the Arduino IDE to upload credentials. You can get streaming output at up to 1284×1024 pixels (we got a frame rate of about 6 fps at this size, and faster at smaller sizes). The fact that it outputs data in a standard format, and so works well with open-source IoT hubs, is a bonus. There’s also some rudimentary face recognition, but we found this to be quite unreliable.

The cooling on the board does struggle if you’re streaming continuously. The board gets very warm, and some users report it stopping working. We’d expect this to be a bigger problem if the unit is enclosed, so if you plan to use a case of some sort, you may need to take this into account with a heat sink or even a fan.

UNDER THE HOOD

Getting to this point has been a little fiddly, but not too complex for anyone familiar with microcontrollers; however, going further can be a bit more complex.

In principle, you should be able to integrate this camera with your projects in all sorts of ways.

There is a library for basic image gathering available at hsmag.cc/ulc0JF, and an image recognition framework at hsmag.cc/uHtRDf.

Both of these are designed to work with the ESP Integrated Development Framework (IDF), but can be got to work with Arduino if you would rather program in that way. You will need to be fairly comfortable in C programming to have a reasonable chance of success in developing with these. Hobbyists used to dealing with user-friendly wrapper libraries may struggle.

One thing that has made the ESP8266 and ESP32 products easy to use is a community that’s built firmware to make it easy to flash new features onto your device. Just take a look at the range of community options for the Sonoff smart relays for examples.

We’ve come across a couple of other firmwares for
the ESP32-CAM:
• ESPHome, which helps you set up a smart home system using ESP devices (see esphome.io for more details).
• AutoCamera, which creates a wireless network on the device and when you connect to this network, your browser will automatically show the video stream. This uses the same method that some WiFi networks use to force you to a login screen as soon as you connect. See hsmag.cc/VAFmHQ for details.

The ESP32-CAM is fairly new – it came out in early 2019 – and it’s quite possible that more firmware will be available in the future. We’ll be keeping an eye on this, as there’s lots of potential for a device that can do more than a standard streaming camera.

The AI-Thinker ESP32-CAM comes in at a fantastic price, and if you’re looking for a WiFi webcam that you can link in with your smart home system, then this is a great option.

You’ll need to do a little work to program it and create a mount, but this is all fairly straightforward. The soldered headers and lack of mounting holes make this a slightly more complex task than it might otherwise be, but it’s nothing a bit of hot glue can’t fix. The external antenna port on the board is a great addition if you’re looking to place this at the far reaches of your WiFi network.

If you want to go deeper and integrate a camera into your projects, you can do quite a bit with the ESP32-CAM, provided you’ve got the programming skills to make it work.

Casual users who want features beyond basic streaming webcams may wish to check what additional code is available for them to build off before making a purchase, but for under £7 you may prefer to take the plunge and see how you get on.


https://hsmag.cc

From HackSpace magazine store

Subscribe

Subscribe to our newsletter