ESP32-CAM, the poor man's wireless CCTV

michalrz

2[H]4U
Joined
Jun 4, 2012
Messages
3,690
I noticed this section of the forum is a bit dead, and I got into embedded stuff the last few months. So why not give something back.

I'd like to show you guys and gals a pretty clever and dirt cheap wireless CCTV solution. It was also my first foray into ESP32, which is a tiny WiFI/BT-enabled development board.
It works with the Arduino IDE, many Arduino-specific libraries have been ported.

The thing I'm showing here is the ESP32-CAM.
There is no one specific manufacturer, as there are 'brand' versions by Ai-Thinker, and there are Asian knock-offs.
The System of Chip is the same though, as is the OV2640 camera which comes with it.
I myself got two different versions when ordering the second time a few months later. The newer version has, among other differences, a vertical CCD sensor orientation of the OV2640 camera.

ESP32-CAM also has a microSD connector, but you still need the card.

The example which is provided by default in Arduino is a simple web server, that lets you take stills and stream video. There are sliders and switches to set stuff (brightness, gain...).
You can access the stream without the UI by appending :81/stream to its url.

However, what I'm rocking is the SD storage/FTP upload version available on Github, called ESP32-CAM_MJPEG2SD.
It lets you set a motion detection rule (minimum seconds of detected movement and sensitivity) and it'll record a MJPEG file on the microSD card (not included).
You can access the camera through your browser and view the recorded footage from it, or download it onto another computer. I did not use the FTP feature.
By default it'll pick up an IP from DHCP, but you can hard-code your own settings and it's trivial.

The prices are all over the place, depending on where you order from. I don't deal with Alibaba and similar, preferring local re-sellers instead, but the Chinese seem to have the lowest prices. YMMV.

Some observations I made over the 8 months I've been using it 24/7 as CCTV are:
- current draw is around 200-500 mA at 5V, but you can't go cheap with the power supply. It will work on a phone charger, but you might get sporadic reboots or camera artifacting (image goes pink)
- the onboard LED is as bright as the sun, you can toggle it in the web interface
- Wifi works decently. In my case, I took another ESP32 board, loaded a simple NAT router onto it and it acts as a WiFI range extender for the cameras. Works fine.
- by default, both OV2640 variants I have filter infra-red quite heavily. If you want a semblance of night vision, you can carefully disassemble the tiny camera and remove the IR filter (it has a reddish hue on one side, greenish on the other. It'll probably shatter once you start prying it off. For usable IR night vision you need an additional source of infra led light, and it's very hard to illuminate a larger area such as your back yard with IR diodes. Also, the colors will be all over the place once you remove the IR filter.

Caveats:
- it's clunky. No, really, it is what it is - a $10 SoC wireless CCTV device. Sometimes it'll fail to detect motion, cut a recording short, whatever. SOMETIMES.
- the clunkiness really shows when you try to view the recorded files on the device, especially when it is recording a stream at the same time. Sometimes it will simply show you the current sensor data instead of the recorded flick and you need to re-select it.
- the image quality is very good, the maximum resolution is UXGA (1600 x 1200, see attachment), but you won't be able to get away with a stable CCTV recording with it. The WiFI and CPU horsepower is just not there. 800x600 is what I use, but 1280x1024 is also doable.
- power is key. If you want to use a 5V power supply, you will need to snip the connector part and solder on pin connectors. And you have to use a good cable for both the USB part, and for the extensions which plug into the ESP32 itself. You want a quality power supply with a minimum rating of 1.5 A, and I don't mean the 'marketing' values.
- you need a FTDI usb-uart bridge to program it, as it does not have its own USB port. These are peanuts, though.
- the GPIO pins which are onboard are, sadly, internally wired for other purposes and IIRC only one or two pins can be used in your custom code (for stuff like a temperature sensor, or controlling an external illuminator)

Anyway that's all the important stuff I can recall right now. If you'd like to set up your own, I can offer some help here, but I'm a beginner myself.
 

Attachments

  • esp32cammjpeg settings.jpg
    esp32cammjpeg settings.jpg
    48.4 KB · Views: 0
  • uxga sample.jpg
    uxga sample.jpg
    150.5 KB · Views: 0

michalrz

2[H]4U
Joined
Jun 4, 2012
Messages
3,690
Addendum: picture of the service end of the device, FTDI programmer is on the left.
 

Attachments

  • WP_20210415_12_13_07_Pro.jpg
    WP_20210415_12_13_07_Pro.jpg
    252.2 KB · Views: 0
Top