Camera Shield for S2 Mini

OV2640 shield for the S2 Mini ESP32-S2 board.

Similar projects worth following

With CircuitPython now supporting a camera, it would be nice to have a camera shield to use with my robot #Fluffbug. The OV2640 camera module is pretty powerful (it can create JPEG data to stream), and the S2 Mini has enough pins to drive it, so the only inconvenience left are three voltages need for powering the camera. The shield takes care of that.

Zip Archive - 26.45 kB - 10/26/2021 at 13:05



fritzing design

x-fritzing-fzz - 46.30 kB - 10/26/2021 at 13:04


  • 1 × VVS-8225N-v1.0 OV2640 Camera with a matching socket
  • 1 × AP7365-12WG-7 1.2V LDO
  • 1 × AP7365-28WG-7 2.8V LDO
  • 2 × 1µF Capacitor
  • 1 × 14pF Capacitor

View all 6 components

  • 1.2V and Version 2

    deʃhipu12/02/2021 at 23:33 0 comments

    Today the correct 1.2V LDO arrived, so I replaced it on the shield, replaced the camera sensor (in case I fried this one with the incorrect 1.5V) and tried again. And... nothing again.

    With the help of Jeff Epler, I checked the signals on various pins, and as far as my toy scope can tell, they are all correct. In other words, it should all work, but somehow doesn't.

    Next I'm going to look for a different example, not involving CircuitPython, to see if maybe that will work. I also have a Chinese module with the same camera, that I want to try.

    In any case, the shield doesn't seem to need any electrical fixes, so I went ahead and ordered the second version, with slightly nicer traces, and i2c pins in a more traditional place — so it can be used together with other shields.

  • Testing

    deʃhipu11/27/2021 at 17:54 0 comments

    The PCBs finally arrived, but turns out there was a mistake at the fab, and all holes that were supposed to be 0.9mm are 0.6m instead. I managed to solder pin headers to them anyways, so let's do some testing!

    For the test, I decided it would be the easiest to do it with a display. So I wired an ILI9341 to the pins that are not used by the shield, and... it didn't work. Great, displays were supposed to be a solved problem. After some poking around and testing, it turns out that the silkscreen on the Lolin S2 Mini I have is wrong, and it has pins 12 and 13 swapped. After swapping the pins, it works. Great, so now time to try the test code. Based on Adafruit examples, I came up with this:

    import board
    import terminalio
    import displayio
    import adafruit_ili9341
    import busio
    import adafruit_ov2640
    display_bus = displayio.FourWire(
        busio.SPI(clock=board.IO7, MOSI=board.IO5),
    display = adafruit_ili9341.ILI9341(display_bus, width=320, height=240)
    i2c = busio.I2C(scl=board.IO39, sda=board.IO40)
    cam = adafruit_ov2640.OV2640(
        data_pins=(board.IO21, board.IO17, board.IO16, board.IO18, board.IO33,
                   board.IO34, board.IO35, board.IO36),
    cam.flip_x = False
    cam.flip_y = True
    pid = cam.product_id
    ver = cam.product_version
    print(f"Detected pid={pid:x} ver={ver:x}")
    # cam.test_pattern = True
    g = displayio.Group(scale=1)
    bitmap = displayio.Bitmap(320, 240, 65536)
    tg = displayio.TileGrid(
    display.auto_refresh = False
    while True:

     And... nothing. It seems to hang on the cam.capture(bitmap) line. The good news is that the i2c communication seems to work, as it reports the pid and version correctly. I will need to investigate this further.

  • Pinout

    deʃhipu10/29/2021 at 11:17 0 comments

    Just to make my life a little bit easier in the future, here is the current pinout of the shield:

    D37HS (HREF)Horizontal Sync
    D38VSyncVertical Sync

  • Camera in CircuitPython

    deʃhipu10/29/2021 at 11:05 0 comments

    There is ongoing work being done by Jeff Epler to bring the cameras to CircuitPython. There is an excellent tutorial available here:

    But this is not all. Right now Jeff is working on a way to produce animated GIF images directly from the camera, and save them to the SD card.

    There is also a way to stream the video:

    So I'm confident that even if my own software experiments fail, the shield will still prove useful.

  • What is this for?

    deʃhipu10/26/2021 at 13:57 0 comments

    A bit of explanation is needed here. Obviously an ESP32-S2 is not going to be able to do much with a camera, lacking the processing power and memory. I hope to make it stream low-resolution video over WiFi, and maybe, if in the right light conditions, find color blobs at one frame per 10 seconds.

    Oh, of course I want to put it on my robot, here's a mockup:

    Since both the robot and the shield are waiting for the PCBs, I used the previous version of the robot and some random shield I had lying around, but you get the idea.

    Ideally, if I have a lot of time, and can understand enough of the code, I might be able to port the Apriltags code from OpenMV and use it with the robot — that would be an awesome thing to do, but I doubt if my skills are sufficient.

  • Version 1 PCB

    deʃhipu10/25/2021 at 21:34 0 comments

    This is the first attempt at this shield, and it's mostly based on guesswork, datasheet, schematic for the ESP32 Cam board, and some bad quality images of the pinouts I found online. I have absolutely no idea if it will work, but I can try. The design is pretty dense:

    I didn't feel like fixing the angles of all the traces, so you will have to suffer. The render doesn't look bad:

    There are two voltage regulators, each with its own capacitor, two resistors for I2C pull-ups, a resistor to pull-down the enable pin on the camera, and a 14pF capacitor on the PCLK line, no idea why, but ESP32 Cam had it, so I copied it. And of course the camera socket itself, which is a fun 0.5mm-pitch footprint.

View all 6 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates