User avatar
HermannSW
Posts: 1319
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Raspberry v1 camera global (external) shutter videos

Thu Jul 04, 2019 1:57 pm

I am currently working on sub-project "ESP32-CAM ov2640 sensor global external shutter" and created a sub repo already:
https://github.com/Hermann-SW/Raspberry ... aWebServer

The most difficult part after hardware reverse engineering the ov2640 sensor
https://www.esp32.com/viewtopic.php?f=1 ... 4a48842dd5
Image

was to solder a thin cable to flat ribbon cable connector pin10 (those pins are 0.5mm spaced!), which was surprisingly easy to do with using v1 camera as big magnifying glass and look into HDMI monitor only while soldering:
Image

While with Raspberry v1 camera ov5647 sensor I have full control over when to trigger global reset frame and independently to control the shutter time, the ov5647 predecessor sensor ov2640 that I debugged and use has pins A2 and B2 connected. When setting pin10 to high, all lines get reset. When pin10 gets low, readout of image already starts?!?!? I am pretty sure that global external shutter frames can be captured by ov2640 sensor that way, only some lines at top of frame will be "lost" because they have already been read out and sent to ESP32 when the flash actually happens. This is work in progress.


Today I looked something up on aliexpress and unplanned realized that v1 camera clones (Raspberry v1 camera is not sold anymore after v2 appeared in 2016) do cost less than 4$ these days with free shipping(!):
https://www.aliexpress.com/wholesale?Se ... FreeShip=y
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

User avatar
HermannSW
Posts: 1319
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Raspberry v1 camera global (external) shutter videos

Tue Jul 16, 2019 3:55 am

It turned out that soldering cable to ESP32-CAM flat ribbon cable connector was not necessary for taking global (external) shutter frames with ov2640 sensor. Instead ov2640 sensor allows for:
  • some kind of "implicit" global shutter mode
  • global shutter capturing at daylight without external shutter
  • mixed mode global+rolling shutter frames
I added new section "TODOs+ideas" to github repo, also related to Raspberry cameras; for now:
https://github.com/Hermann-SW/Raspberry ... todosideas
TODOs+ideas
  • fully understand how+why (implicit) global shutter capturing for ov2640 works without being triggered explicitely
  • Raspberry v1 camera ov5647 is successor of ov2640; does it have an implicit global shutter mode as well?
  • Raspberry v2 camera Sony imx219 sensor is different; does it allow for implicit global shutter capturing as well?

Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

mkirk
Posts: 33
Joined: Tue Mar 06, 2018 4:21 pm

Re: Raspberry v1 camera global (external) shutter videos

Wed Jul 31, 2019 3:55 pm

The datasheet for the OV5647 states that it supports both rolling and global shutter modes.
https://cdn.sparkfun.com/datasheets/Dev ... 7_full.pdf

Datasheet feature list on page 5: Shutter: rolling shutter / global shutter

Register SC_CMMN_MISC_CTRL has bit[0] defined as cen_global_o
Is that for global shutter mode?

Is it possible to enable global shutter mode on the Pi V1 camera? What parameter is used?

Or does global shutter require an mechanical shutter to control the light?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7026
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Raspberry v1 camera global (external) shutter videos

Wed Jul 31, 2019 4:03 pm

mkirk wrote:
Wed Jul 31, 2019 3:55 pm
The datasheet for the OV5647 states that it supports both rolling and global shutter modes.
https://cdn.sparkfun.com/datasheets/Dev ... 7_full.pdf

Datasheet feature list on page 5: Shutter: rolling shutter / global shutter

Register SC_CMMN_MISC_CTRL has bit[0] defined as cen_global_o
Is that for global shutter mode?

Is it possible to enable global shutter mode on the Pi V1 camera? What parameter is used?

Or does global shutter require an mechanical shutter to control the light?
There is no true global shutter mode.

A global shutter sensor has two image arrays in the silicon, the first exposed to the light, and the second to take the charge and allow readout. The OV5647 does not have this.
It does allow a global reset, and then readout is triggered the exposure time later. This will behave like a global shutter sensor if you either have a mechanical shutter, or disable any form of illumination at the end of the exposure time. This is the mode that HermannSW has been experimenting with.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

User avatar
HermannSW
Posts: 1319
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Raspberry v1 camera global (external) shutter videos

Wed Jul 31, 2019 9:17 pm

6by9 wrote:
Wed Jul 31, 2019 4:03 pm
... or disable any form of illumination at the end of the exposure time. This is the mode that HermannSW has been experimenting with.
Exactly, and I am still surprised how well that worked.
See the images (especially the multiple exposure) frames in this thread or on github:
https://github.com/Hermann-SW/Raspberry ... al_shutter
mkirk wrote:
Wed Jul 31, 2019 3:55 pm
Is it possible to enable global shutter mode on the Pi V1 camera? What parameter is used?
See lines 22-23 in raspivid_ges tool, it was really surprising to me that two register settings sufficed to force gobal reset mode on ov5647 (v1) sensor:
https://github.com/Hermann-SW/Raspberry ... id_ges#L22


Besides the captured airgun pellets in flight, this is one of my favorite multiple exposure v1 frames (8000eps). The cardbox is not that dark because I took the frame with 1fps framerate video, so total light on cardbox was 8000*9us=72ms per frame:
Image


What is still mysterious to me is why I was able to do global shutter (yes, without external) with ov2640 sensor -- it seems to be some kind of overlay of global shutter frame and rolling shutter frame, but at daylight!?!?!
Image

6by9 wrote:
Wed Jul 31, 2019 4:03 pm
A global shutter sensor has two image arrays in the silicon, the first exposed to the light, and the second to take the charge and allow readout. The OV5647 does not have this.
There are two (0.3MP and 1.0MP) Arducam monochrome global shuuter cameras (<30$) that have the mechanism 6by9 stated. And both can be connected to the Pi CSI-2 connector like v1 and v2 camera:
https://www.raspberrypi.org/forums/view ... 3#p1485903
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

User avatar
HermannSW
Posts: 1319
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Raspberry v1 camera global (external) shutter videos

Sat Aug 10, 2019 10:59 am

I just looked at the 5MP sample for rolling shutter effect I used in Information section of github repo:
https://github.com/Hermann-SW/Raspberry ... troduction

I realized that the image provides the propeller rotation direction.
Camera scans lines from top to bottom.
The inserted horizontal blue line shows that propeller blade moved from right to left above propeller center.
The red horizontal line shows that propeller blade moved from left to right below propeller center.
Therefore the rotation direction is counter clockwise (when looking at the image):
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

Return to “Camera board”