IMX462 libcmaera-still --shutter option doesn't work

I’ve installed the Pivariety Low Light Camera on a Pi-4 exactly as described in the manual, fresh Bullseye 2022-01-28. Photos are fine in normal lighting but under low light conditions the shutter speed never is longer than 1/4 sec with default settings. Adding the --shutter option, as described on the arducam website, for example libcamera-still --shutter 1000000 -o test.jpg, has absolutely no effect. The shutter speed is still reported as 1/4 sec in the jpg metadata.
Another thread here discussing framerate on this camera says the framerate is limited by firmware to no less than ~1 fps but it was unclear if that applies to video or still. Adding as framerate option, for example libcamera-still --framerate 0.1 -o test.jpg, produces unpredictable images. Gain appears to increase but the shutter speeds remains unchanged.
Can Ardcam explain how to use its "Pivariety Low Light Camera " in low light conditions?

@rleyden
please send a email for [email protected],and link to forum. i will give you a firmware to update

OK, I send an email a few days ago but have not yet received the firmware update.

@rleyden

hi rleyday, I 'am sorry for this. I posted to google drive

Note:
This firmware is available for 32-bit systems. The doc password inside is : Arducam

The readme file in the firmware says, “must be run on a Jetson Nano”. Do you have firmware for a Raspberry Pi?

The link to to instructions:

is password protected.
The file, firmware_update, even after making executable with chmod will not execute.
It appears to be binary, “ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=6fe681ba47faf6721fa96ed79a8e67283403f9bd, not stripped”

@rleyden
Sorry, it’s the weekend, I’ll check tomorrow

@rleyden

Hi,

this is generic

cd ~
tar avxf ./imx462_lanes2_firmware_long_exp.tar.gz
cd imx462_lanes2_firmware
chomd +x ./firmware_update
./firmware_update -i 10 -m imx462_lanes2_firmware

Hi Edward,
Thanks for the clear and detailed instructions. The update worked on my Rpi4 and now the --shutter options does something but still does not give long exposures.

Shutter exposure time (reported file) decimal equivalent
2500 1/402 0.00248
25000 1/40 0.025
250000 1/5 0.2
500000 1/5 0.2
1000000 1/5 0.2
2000000 1/5 0.2

The table gives my results. In no case did the exposure time go longer than 1/5 sec.
Is this what Arducam expects for this camera?

@rleyden

It shouldn’t, I’ll test it and give you the corresponding result

@rleyden

Regarding this exposure time, may I ask how you got it?

i use two way test it

Picture of my hardware connection:

my save image command:
libcamera-still -t 1000 --shutter 1000000 -o 1000000_picture.jpg

1.use exiftool

DFACE7CB-FA49-466c-BD2F-C0CD3C387979

pictures:

2.The way we calculate
About the exposure. imx462 supports normal exposure operation(controlling the integration time in 1H uints) and long exposure oepration (control by expanding the number of lines of lines per frame)

For the normal exposure mode, the integration time can be controlled by varying the electronic shutter timing. In the electronic shutter settings, the

integration time is controlled by the SHS1 [19:0] register. Set SHS1 [19:0] to a value between 1 and (Number of lines

per frame - 1). When the sensor is operating in slave mode, the number of lines per frame is determined by the XVS

interval (number of lines), using the input XHS interval as the line unit.

When the sensor is operating in master mode, the number of lines per frame is determined by the VMAX register.

The number of lines per frame differs according to the operating mode.

Notice :

The sensor’s integration time is obtained by the following formula.

Integration time = 1 frame period - (SHS1 + 1) × (1H period)

For the long exposure mode, long exposure operation can be performed by lengthening the frame period.

When the sensor is operating in slave mode, this is done by lengthening the input vertical sync signal (XVS) pulse

interval.

When the sensor is operating in master mode, it is done by designating a larger register VMAX [19:0] value compared to normal operation. When the integration time is extended by increasing the number of lines, the rear Vblanking increases by an equivalent amount.

About this, we have updated pivariety firmware recently. We do some test and found that, in fact in long exposure mode, the VMAX can be set to 0xFFFFF, and the long exposure time is Texp = (hts/pixclk)(VMAX-1) = (2200/148500000)(0XFFFFF-1) = 15.53s

For some speical environment, need long expposure mode, maybe we can try using

libcamera-still -o long_exposure.jpg --shutter 15530000 command.

Edward,
Thank you for your long and detailed explanation and also for sharing your results. Unfortunately, when I repeat your tests exactly, I still get 1/5 sec when 1 sec is requested. Nevertheless, it is very encouraging to me that one day I may set exposures as long as 15 seconds. But for now, it seems I must determine what is different about my setup. I pasted every relevant parameter I can think of below. Please let me know if there is any other data you need.
Cable connections: Although I did test an alternate configuration suggested by a Raspberry Pi engineer, ( https://forums.raspberrypi.com/viewtopic.php?t=331213&start=25 ) it is back as in your picture.
Hardware: Pi Model 4B V1.1, 1 GB
SW(uname –a): Linux testpi 5.10.92-v7l+ #1514 SMP Mon Jan 17 17:38:03 GMT 2022 armv7l GNU/Linux
………………libcamera-hello ………………
libcamera-hello --list-cameras
Available cameras

0 : arducam-pivariety [1920x1080] (/base/soc/i2c0mux/i2c@1/arducam@0c)
Modes: ‘SRGGB10_CSI2P’ : 1920x1080 [60.00 fps - (0, 0)/1920x1080 crop]
………………………lsmod ………………………………….
pi@testpi:~ $ lsmod | grep arducam
arducam 28672 1
v4l2_fwnode 24576 2 bcm2835_unicam,arducam
videodev 249856 9 bcm2835_unicam,bcm2835_isp,v4l2_fwnode,bcm2835_codec,videobuf2_common,arducam,bcm2835_v4l2,v4l2_mem2mem,videobf2_v4l2
mc 45056 8 bcm2835_unicam,bcm2835_isp,bcm2835_codec,videobuf2_common,videodev,arducam,v4l2_mem2mem,videobuf2_v4l2
…………………………… test output …………………………
libcamera-still -t 1000 -v --shutter 1000000 -o 1000000_picture.jpg
Options:
verbose: 1
info_text:#%frame (%fps fps) exp %exp ag %ag dg %dg
timeout: 1000
width: 0
height: 0
output: 1000000_picture.jpg
post_process_file:
rawfull: 0
preview: default
qt-preview: 0
transform: identity
roi: all
shutter: 1e+06
metering: centre
exposure: normal
ev: 0
awb: auto
flush: false
wrap: 0
brightness: 0
contrast: 1
saturation: 1
sharpness: 1
framerate: 30
denoise: auto
viewfinder-width: 0
viewfinder-height: 0
tuning-file: (libcamera)
lores-width: 0
lores-height: 0
mode: unspecified
viewfinder-mode: unspecified
encoding: jpg
quality: 93
raw: 0
restart: 0
timelapse: 0
framestart: 0
datetime: 0
timestamp: 0
keypress: 0
signal: 0
thumbnail width: 320
thumbnail height: 240
thumbnail quality: 70
latest:
immediate 0
metadata
Made X/EGL preview window
Opening camera…
[0:22:42.291175381] [2813] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3729-5f595cca
[0:22:42.313074683] [2816] WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for ‘arducam-pivariety’
[0:22:42.313137757] [2816] WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[0:22:42.328575485] [2816] ERROR IPAProxy ipa_proxy.cpp:149 Configuration file ‘arducam-pivariety.json’ not found for IPA module ‘raspberrypi’
[0:22:42.938357699] [2816] WARN RPI raspberrypi.cpp:1274 Mismatch between Unicam and CamHelper for embedded data usage!
[0:22:42.939788524] [2816] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[0:22:42.940431187] [2816] INFO RPI raspberrypi.cpp:1398 Registered camera /base/soc/i2c0mux/i2c@1/arducam@0c to Unicam device /dev/media3 and ISP device /dev/media1
Acquired camera /base/soc/i2c0mux/i2c@1/arducam@0c
Configuring viewfinder…
Viewfinder size chosen is 960x540
Final viewfinder size is 960x540
[0:22:42.942563212] [2813] INFO Camera camera.cpp:1029 configuring streams: (0) 960x540-YUV420
[0:22:42.999076820] [2816] INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c@1/arducam@0c - Selected sensor format: 1920x1080-SRGGB10_1X10 - Selected unicam format: 1920x1080-pRAA
Camera streams configured
Available controls:
AeEnable : [false…true]
ExposureTime : [14…199940]
ScalerCrop : [(0, 0)/64x64…(0, 0)/1920x1080]
AnalogueGain : [1.000000…200.000000]
AeMeteringMode : [0…3]
AeConstraintMode : [0…3]
ColourGains : [0.000000…32.000000]
ExposureValue : [-8.000000…8.000000]
Contrast : [0.000000…32.000000]
NoiseReductionMode : [0…4]
FrameDurationLimits : [16666…200000]
Brightness : [-1.000000…1.000000]
AwbMode : [0…7]
AwbEnable : [false…true]
ColourCorrectionMatrix : [-16.000000…16.000000]
Sharpness : [0.000000…16.000000]
AfTrigger : [0…1]
AeExposureMode : [0…3]
Saturation : [0.000000…32.000000]
Buffers allocated and mapped
Viewfinder setup complete
Requests created
Camera started!
Viewfinder frame 0
Viewfinder frame 1
Viewfinder frame 2
Viewfinder frame 3
Viewfinder frame 4
Viewfinder frame 5
Viewfinder frame 6
Viewfinder frame 7
Viewfinder frame 8
Viewfinder frame 9
Viewfinder frame 10
Viewfinder frame 11
Viewfinder frame 12
Viewfinder frame 13
Viewfinder frame 14
Viewfinder frame 15
Viewfinder frame 16
Viewfinder frame 17
Viewfinder frame 18
Viewfinder frame 19
Viewfinder frame 20
Viewfinder frame 21
Viewfinder frame 22
Viewfinder frame 23
Viewfinder frame 24
Camera stopped!
Tearing down requests, buffers and configuration
Configuring still capture…
[0:22:44.488171047] [2813] INFO Camera camera.cpp:1029 configuring streams: (0) 1920x1080-YUV420 (1) 1920x1080-SRGGB10_CSI2P
[0:22:44.530256366] [2816] INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c@1/arducam@0c - Selected sensor format: 1920x1080-SRGGB10_1X10 - Selected unicam format: 1920x1080-pRAA
Camera streams configured
Available controls:
AeEnable : [false…true]
ExposureTime : [14…199940]
ScalerCrop : [(0, 0)/64x64…(0, 0)/1920x1080]
AnalogueGain : [1.000000…200.000000]
AeMeteringMode : [0…3]
AeConstraintMode : [0…3]
ColourGains : [0.000000…32.000000]
ExposureValue : [-8.000000…8.000000]
Contrast : [0.000000…32.000000]
NoiseReductionMode : [0…4]
FrameDurationLimits : [16666…200000]
Brightness : [-1.000000…1.000000]
AwbMode : [0…7]
AwbEnable : [false…true]
ColourCorrectionMatrix : [-16.000000…16.000000]
Sharpness : [0.000000…16.000000]
AfTrigger : [0…1]
AeExposureMode : [0…3]
Saturation : [0.000000…32.000000]
Buffers allocated and mapped
Still capture setup complete
Requests created
Camera started!
Camera stopped!
Still capture image received
Exposure time: 199940
Ag 1 Dg 1 Total 1
Thumbnail dimensions are 320 x 240
Thumbnail size 5062
JPEG size is 125172
EXIF data len 330
Saved image 1920 x 1080 to file 1000000_picture.jpg
Closing Libcamera application(frames displayed 23, dropped 1)
Camera stopped!
Tearing down requests, buffers and configuration
Camera closed
………………………………………………………………………
Notice shutter input is correctly read as 1000000 but Exposure time: 199940 (1/5 sec).
…………………exiftool……………………………

exiftool 1000000_picture.jpg
ExifTool Version Number : 12.16
File Name : 1000000_picture.jpg
Directory : .
File Size : 130 KiB
File Modification Date/Time : 2022:07:27 14:16:38-07:00
File Access Date/Time : 2022:07:27 14:16:38-07:00
File Inode Change Date/Time : 2022:07:27 14:16:38-07:00
File Permissions : rw-r–r–
File Type : JPEG
File Type Extension : jpg
MIME Type : image/jpeg
Exif Byte Order : Little-endian (Intel, II)
Make : Raspberry Pi
Camera Model Name : /base/soc/i2c0mux/i2c@1/arducam@0c
Software : libcamera-still
Modify Date : 2022:07:27 14:16:38
Exposure Time : 1/5
ISO : 100
Date/Time Original : 2022:07:27 14:16:38
Create Date : 2022:07:27 14:16:38
Compression : JPEG (old-style)
Thumbnail Offset : 336
Thumbnail Length : 5055
Image Width : 1920
Image Height : 1080
Encoding Process : Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components : 3
Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2)
Image Size : 1920x1080
Megapixels : 2.1
Shutter Speed : 1/5
Thumbnail Image : (Binary data 5055 bytes, use -b option to extract)
………………………………….

@rleyden

I now suspect that your bootloader may be an old version,

Let’s use another method.

  1. Raspberry Pi shuts down and powers off

  2. Enable recovery on Pivariety adapter board using Dupont Line


  3. Unplug the Dupont Line about 5 seconds after the Raspberry Pi is powered on

  4. Install firmware

cd ~
tar avxf ./imx462_lanes2_firmware_long_exp.tar.gz
cd imx462_lanes2_firmware
chomd +x ./firmware_update
./firmware_update -i 10 -m imx462_lanes2_firmware
  1. The message at the beginning of the following appears, indicating that the firmware has been programmed correctly
    186E5800-91AF-46bc-8CAB-6186B85DEBA5
    If not, you need to repeat the previous steps.

  2. reboot your raspberrypi and try again.

By the way,why do we set a password for that web page, because under normal circumstances, users will not use that page, and we don’t want people to follow the content inside, which will cause the device to fail to work normally. If the customer has problems, after our judgment, the camera needs to update the firmware, we will let him use this solution, which does not require the user to send the camera to us, or upgrade their firmware. I’m sorry if this made you confused or uncomfortable.

Edward,
The firmware reset worked and I tested the shutter time up to 15 secs. The exif data is now consistent with commanded shutter, actual elapsed time capturing seems OK, and the images are probably OK too (all white longer than 1 sec). I will, of course, do more end-use testing but the functionality seems in line with what I hoped for. My sincere thanks for your help and persistence.

Regarding password protecting your help page: I understand your reasoning. Arducam can run their business however they choose. However, I think sending me a readme document directing me to the help page, without warning that I cannot access it, seems a poor implementation of your policy. Also, in this case it wasted both my time and your time and possibly caused your company reputational damage.
Best regards,
Rich

@rleyden

First off, I’m glad the firmware works.
Regarding the documentation, I’ve been working on it recently and we’ll discuss it based on your feedback.
Improving the user experience is a long-term work, not only our own detection, but also the user’s feedback is more important to us.

@rleyden

How is it working in low light ? Would you mind sharing some pictures please.

Thank you

I’m satisfied with the IMX462 hardware. I had a mix of applications in mind, night time surveillance (wild life focused) and astro photography.
For night time surveillance, low light performance was great but I was hoping to use it as a drop-in sensor with a Raspberry Pi app, pikrellcam. However, Pi app support for sensors requiring libcamera2 remains no existent. Writing my own is possible but unrealistic. Here are a couple sample images.


imx462-led-light

Astro photography is more promising,

I replaced the stock lens with a slightly telephoto lens, ~15 mm, as a proof of concept. Promising, so I started making a mount for my telescope to place the sensor at the focal plane. I ordered a few parts but got side-tracked.

1 Like

Thank you @rleyden

I’m interested in terrestrial observation in low light and no light.

I want to use 850 nm Near IR leds.
As you have changed lens and all,

my question to you is, if I buy an ir pass M12 lens to replace the one that comes with it, will the sensor see in NIR ?

The forest one looks awesome. I want to use it to make a night vision.

Thank you so much !

@rleyden
Hi, may I ask a few question? I am also working on deploying the IMX462 for astrophotography. Which SKU you are using? I am using the B0444 with a wide angle lens version, which they call Pivariety series.
Basically I successfully make it work already but there is 1 issue that is not satifactory. I am doing live stacking so I capture image after image to stack. I use a 3s exposure time. However to get a 3s image, the overall cycle time is 20s. So I only manage to stack about 2-3 frames per minute (that is an accumulated time of 6-9s, vs a 60s duration). According to Pi document, to avoid this long delay I need to specify the gain, white balance, shutter speed manually to disable the AGC alogrithm. That works in the past for me when I used a HQ IMX477 Pi camera. But for this IMX462, it does not. Do you experience this long delay also? For your 15s exposure I just imagine that it take a minute plus to finish.

It’s been a few months since I used the camera but I don’t recall the issue that you mention. I tried both using timelapse mode and a simple python program to take a timed sequence. In neither case was there a significant post exposure delay, at least none that cause me concern. I only briefly looked at stacking images. I wasn’t satisfied with the results because even with the 15 mm lens the images were more wide angle than I was hoping for. I had planned to make a adapter to have the IMX 462 sensor at the focal plane of my 6" reflector telescope but put that on hold when my tracker motor broke.
I still hope to use the IMX 462 as a low light surveillance camera but was hoping for better software support. I still use Pikrellcam app with the original pi cameras but it does not support v4l2 type cameras. As an aside, I bought a Reolink CX410 camera and found the night time images essentially like day time, It comes as a complete system in a high quality outdoor housing for less than 2x the cost of the IMX 462, a much better price/perforamnce option.