Skip to content

Instantly share code, notes, and snippets.

@askpatrickw
Last active May 2, 2024 15:00
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save askpatrickw/0179d09e74d5f2a4347d5666ea937c4d to your computer and use it in GitHub Desktop.
Save askpatrickw/0179d09e74d5f2a4347d5666ea937c4d to your computer and use it in GitHub Desktop.
Research about the ESP32-S2 Camera Interface

Research about the ESP32-S2 Camera Interface

I am very interested in the ESP32-S2's camera port and the possibility of using it for a variety of MicroPython\CircuitPython projects. My hope is that the ESP32-S2 will the ability to do do things similiar to what is possible on the Raspberry Pi. Today there is no ESP32-S2 board available which exposes this port, and no camera modeles, but I wanted to understand the hardware capabilities to understand what might be possible and just as important, what is not.

This write up is based on solely on a morning's worth of research. If there are errors let me know. tx!

ESP32-S2 Data Sheet

I²S Interface

ESP32-S2 includes a standard I²S interface. It can operate in main or secondary mode, in full-duplex andhalf-duplex communication modes, and can be configured to operate with an 8-/16-/24-/32-/48-/64-bitresolution as an input or output channel. BCK clock frequency, from 10 kHz up to 40 MHz, is supported.The I²S interface has a dedicated DMA controller. PCM interface is supported.

Camera Interface

ESP32-S2 supports one 8 or 16-bit DVP image sensor, with clock frequency of up to 40 MHz. The camera interface is implemented by using the hardware resources of I²S.

Raspberry Pi Data Sheet

Camera and Display Interfaces

The RPi4B has 1x Raspberry Pi 2-lane MIPI CSI Camera and 1x Raspberry Pi 2-lane MIPI DSI Display connector. These connectors are backwards compatible with legacy Raspberry Pi boards, and supportall of the available Raspberry Pi camera and display peripherals.

What are the DVP and MIPI Interfaces?

MIPI Camera Serial Interface 2 (MIPI CSI-2)

https://www.mipi.org/specifications/csi-2

NOTE: "Companies must be members of MIPI Alliance to employ its specifications, however non-member companies benefit whenever they procure and implement components that use its specifications."

Digital Video Port (DVP)

https://electronics.stackexchange.com/questions/4363/what-is-a-digital-video-port "...there is no DVP spec but the pinout seems to be something of a de facto standard, even though part manufacturers doesn't always call it DVP. That is, there is a pixel clock, some sort of horizontal sync, some sort of vertical sync, and however many data lines."

DVP vs. MIPI

https://electronics.stackexchange.com/questions/308935/dvp-vs-mipi-camera-interface "CMOS image sensor interface divided into two catalogs, one is DVP (Digital Video Port) interface, the other is MIPI Mobile Industry Processor Interface. The main difference between DVP and MIPI is that DVP is parallel interface and the MIPI interface is high speed differential serial interface. MIPI interface provide higher data band width than DVP interface and support higher resolution and frame rate. "

Summary

The key difference is the ESP32-S2 has a DVP interface and the Raspberry Pi a MIPI interface. In theory, this means the Raspberry Pi's MIPI port is more capable at the higher-end than the DVP port on the ESP32-S2. What does this look like in the marketplace of available sensors? Which suport MIPI, DVP and what are their specs?

If you look at OmniVision's site, you will notice that DVP is only available on 1080p\2MP sensors. Above 2MP and up to 13MP MIPI only or MIPI+LVDS are supported and above 13MP only MIPI.

Follow-up Items

  • How would you add a more robust port to a CP or MP Board via a shield or a wing on a feather?

Additional Information

@askpatrickw
Copy link
Author

askpatrickw commented Jul 25, 2020

More exploration....

The datasheet says: "The camera interface is implemented by using the hardware resources of I²S."
CP 3.0+ supports I2S: "CircuitPython 3.0 and higher has I2S built in", but it does not appear to be for every board.
see: https://learn.adafruit.com/adafruit-i2s-stereo-decoder-uda1334a/circuitpython-wiring-test

Question: Does the FeatherS2 expose I2S to CP?
Answer: from Unexpected Maker (in discord), I2S is exposed on pins 23 & 24 and are labeled as DAC1, DAC2
https://discordapp.com/channels/605621786616528915/699857241506971660/736427749740249189

@askpatrickw
Copy link
Author

askpatrickw commented Aug 27, 2020

Feather Wing Specs

https://learn.adafruit.com/adafruit-feather/feather-specification#feather-and-wing-sizes-2861831-2

  • .9" x 2.0" with 0.1" holes at each corner
  • one 16-pin breakout strip on the bottom side, centered 1.0" from the left edge
  • one 12-pin breakout strip on the top side, 1.2" from the left side
  • Strips are spaced 0.8" apart

image

@askpatrickw
Copy link
Author

@jywarren
Copy link

jywarren commented Jul 7, 2022

Hi, i'm very interested in the low-power capabilities of esp32-s2 when used with a camera. Have you heard of any progress or products using a camera with the s2?

@jywarren
Copy link

jywarren commented Jul 7, 2022

For example this repo is very promisingly named but 2 years old: https://github.com/AI-Thinker-wm/esp32-s2-cam

@jywarren
Copy link

jywarren commented Jul 7, 2022

@askpatrickw
Copy link
Author

@jywarren I have not, sorry. You might try the Adafruit Discord or Forums for more help though. Assuming you want to user CircuitPython.

@askpatrickw
Copy link
Author

@smirnovich
Copy link

Despite csi-2 has a standard, different manufactures makes crazy decisions by using absurd pinout for their connectors: camera with 0.5mm step fpc, two-sides 1mm step connector on boards, sometimes it is even in reverse order so you should by another converter for the converter and if you put it with the wrong side your camera easy burned...
DVP modules on the other hand often utilize simple gpio and it is soooo much easier to use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment