0

I am making a self-contained stills camera and the ESP32-based modules seem well-suited to my project due to the easy incorporation of a TFT viewfinder screen and TF card slot in one package. I am not interested in saving video or web streaming. I have worked with the TTGO ESP32 camera that uses the OV2640 2MP sensor and can save full 2MP UXGA (1600x1200) resolution stills (albeit with mandatory JPEG compression turned on - I have only managed to get 1.3 MP images without compression).

I see now there is a version of ESP32 camera that uses the OV3660 3MP sensor (called 'M5Stack Timer Camera'). However, the specs for that camera https://docs.m5stack.com/#/en/unit/timercam say it can save upto a maximum of UXGA - i.e. 2MP images.

So what is the advantage of having a 3MP sensor chip if you can only save 2 MP images? Or is there a way of saving the full 3MP sensor resolution (i.e. 2048 x 1536) stills from this camera?

Thanks

1

The limit isn't the camera - it's the memory.

At 3 megapixels you have 3145728 pixels. At 3 bytes per pixel (8 bits each of red green and blue) it requires 9437184 bytes to store the image. That's more than can fit into the 8MB PSRAM.

1600x1200 will probably be one of the standard resolutions that the specific camera in use can capture, and is probably the biggest size that is below 8MB in size for a single frame.

So, what advantage of having a 3 megapixel camera? Well, none to you, other than the cost. It's probably cheaper to use a newer 3 megapixel camera than an older 2 megapixel camera.


It is perfectly possible to run at the resolutions you desire though. This resolution is known as QXGA and is supported by the OV3660 driver in the ESP32 Camera library. There are some caveats though:

  1. You must use JPEG compression. Not only is this to make the image small enough to fit into PSRAM but also to make it possible to write the whole frame into PSRAM fast enough that you don't miss bits of the data.
  2. You will not be able to "do" anything with the image other than send it to somewhere else (such as an SD card or a web server). There just isn't enough room to uncompress the image.
8
  • Sure - but that assumes an uncompressed video stream at 3 bytes (24 bits) per pixel. These OmniVision sensors can output colour at 16 bits per pixel in YUYV format. So that would be uncompressed video at 6 Mb leaving 2MB for working stuff. Furthermore these OV sensors also have an inbuilt on-chip JPEG compression of the video stream before it hits the ESP32 - so the 8MB RAM should be sufficient at least for the more compressed streams. I'm guessing there must be some other reason the designers chose this 3MP chip. Possibly cost, as you say, or marketing - but I wonder if there is more to it. – WildCat Nov 22 '20 at 11:43
  • @WildCat You know what you have to do to compressed images to do anything to them? You have to uncompress them. So compression is actually counterproductive, since you then have to accommodate both the compressed and uncompressed versions. – Majenko Nov 22 '20 at 11:44
  • @Mejenko. Yes but you can just pump the compressed stream to TFcard without uncompressing it in RAM and you can use a low res version for viewfinder video - that is how the OV2640 in the TTGO ESP32 camera works. I can save compressed 2MP images but if I lower or switch off compression the PSRAM is insufficient. In theory they could make it work. I wonder if anyone has - and can tell us how. – WildCat Nov 22 '20 at 11:48
  • @WildCat You also have to consider speed as well - writing to PSRAM is not fast, and you have to be able to write a whole frame to the PSRAM fast enough to capture it. Espressif recommend JPEG for anything larger than CIF and converting it afterwards. – Majenko Nov 22 '20 at 11:53
  • QXGA is supported by the ESP-IDF so there's no reason why you couldn't do it. Just follow one of the examples and change the framesize to FRAMESIZE_QXGA – Majenko Nov 22 '20 at 11:54
0

I contacted the M5Stack people directly and they assured me that they made an error in their original web page specs and that the camera does indeed support full 3MP capture. So I bought one of these M5Stack Timer Cams and tested it. I can confirm that the device will save a 3 MP image at full QXGA resolution (2048 x 1536). This option was not available on with the Win10 example app they provide but it was only possible with their official Arduino 'webcam' example. This is a web server WiFi example sketch and one of the options is QXGA and this does work.

So the definitive answer to my question (based on practical experience) is that the advantage of using the OV3660 is that it can provide 3MP pictures and the original specs provided by M5Stack were misleading hence the confusion expressed in my question.

It would also be interesting to hear if anyone has managed to get OV3660 working at full 3MP on other generic ESP32 boards. So far I have seen no other example published on the web.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.