Menu
Cart 0

Updates on the Wildlife Camera project

Posted by Matthew Little on

A few years back I worked on an idea I had for a Wildlife Camera. Originally started in 2020 I'm reviewing the project and seeing if anything can be updated or see if it is even relevant! The original idea was to create a wildlife camera-trap to be able to take photos if interesting animals that trigger the sensor. There are a few battery powered camera traps available which have better resolution cameras, so I'm also looking at other applications for this design.

Issues with the design

Here are the issues I have highlighted with the design at present:

Camera resolution

The ESP32-CAM units I have been using have the OV2640 camera which has a resolution of 2 Megapixels (maximum UXGA resolution of 1600 × 1200 pixels). This is fine for a doorbell camera, but is not great for detailed images or zooming in. So maybe a wildlife camera is not the best application for these units.

Camera night-vision

Adding infra-red night vision to these cameras is difficult (needs the physical IR filter to be removed). I did try using a powered IR filter shutter, but it adds quite a lot of complexity to the project. Again - night vision would be great for a wildlife camera but not possible within the potential project budget and amount of added complexity.

Camera image issues

I have been having issues with artifacts within the images, such as lines across the image or with green or black saturated images. This was due to fact that I took data from the camera as soon as it woke up. To solve this I added as section to take 5 images to settle the auto exposure and white balance before taking the main image. The code I added is here:

  // Discard the first few frames so Auto Exposure (AEC) and White Balance (AWB) can settle
  for (int i = 0; i < 6; i++) {
    camera_fb_t *fb = esp_camera_fb_get();
    if (fb) {
      esp_camera_fb_return(fb);
    }
    delay(150);
  }

I also wanted to adjust the image to improve the brightness and various gain balances. There are loads of parameters you can set and the exact setting depend upon the installation, but this code seemed to work well for me:

  sensor_t *s = esp_camera_sensor_get();
  if (s != NULL) {
    s->set_quality(s, settings_config.IMAGE_QUALITY);

    // Enable Auto Exposure, Auto Gain, and Auto White Balance
    s->set_gain_ctrl(s, 1);                   // 1 = enable AGC
    s->set_exposure_ctrl(s, 1);               // 1 = enable AEC
    s->set_awb_gain(s, 1);                    // 1 = enable AWB gain
    s->set_aec2(s, 1);                        // 1 = enable night/low-light AEC DSP
    s->set_ae_level(s, 2);                    // Auto exposure bias: -2 to 2 (try 1 or 2 for brighter images)
    s->set_brightness(s, 1);                  // increase overall brightness
    s->set_gainceiling(s, (gainceiling_t)6);  // Max gain ceiling (0 to 6; 6 = 128x gain for dark scenes)
  }

I also added code to switch on the flash LEDs (if enabled) before the auto levelling (rather then auto levelling when its dark!).

The improvement in images is shown here (left is before improvements, right is after):

 

This updated code (along with a few other cleaned up routines) has been added to the GitHub repository for this project here:

https://github.com/curiouselectric/Lapse-O-Matic

Uploading/transferring photos

I have got the unit to send the images to an email. This works OK, but not sure people want an email each time a photo is taken. Ideally some kind of server could be used to store the images and then they can be viewed when required. The photos are stored on the SD card and, once I had the images being correctly saved with proper colour balance, I think sending emails if WiFi is in range is a reasonable solution for now. 

Power supply design

Getting the ESP32-CAM into ultra-low power modes is quite a bit of work. The on-board 3.3V regulator is very inefficient. I have replaced this with a PCB mounted low quiescent current 3.3V voltage regulator, but it means we do have to remove the on-board regulator. This also means the unit will not run unless powered by the external PCB.

Also on my original PCB the FTDI (USB to Serial) cable I was using for programming did not power the unit. I added a couple of diode so that either the FTDI or an attached lithium ion battery could power the unit, but will not back feed into each other.

Problem saving to SD card

I was having issues with a 2GB SD card to save the photos. This took a while to figure out but in the end AI saved the day. The reason was my 2GB SanDisk card is an older SDSC (Standard Capacity) card that uses a legacy controller that pulls GPIO 2 (DATA0) HIGH on power-up (causing boot:0x1b error) and fails to respond to 1-bit SD_MMC initialization. I changed to a 8GB Kingston is an SDHC (High Capacity) card, which handles 1-bit SD_MMC mode cleanly and this worked straight away. Meh!

Photos of the prototype unit

Who would want to build one?

I suppose the question here (from an electronics kit company perspective) is: who would want to buy one?

There are trail cameras available at reasonable prices. I think it's use as a wildlife camera is not so good, especially as there are Raspberry Pi based camera options readily available.

I think it's real use would be as a low cost time-lapse camera for long term projects, such as construction or garden monitoring. This unit is low power and can be run from my solar powered battery bank unit. So a very low cost unit (in the region of £40) could be installed cheaply. 

It could also be used as a simple and cheap 'photo booth' which takes photos when a button is pressed. But it needs a better way of showing the photos (rather than an email/SD card save). I might look at doing a thermal printer output for it...

One other aspect could be to perform some kind of AI image recognition algorithm. Maybe it could detect when a car or a person has gone past? Or when a particular type of animal has been detected. This would need quite a bit more work.

I have made some prototype PCBs (without the back-feed diodes mentioned above) and done some design files for hardware (but it's still quite fiddly to build). Should I take it forwards and create a kit?....


Share this post



← Older Post


Leave a comment

Please note, comments must be approved before they are published.