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

5000lm diy highspeed flash

Sat Aug 29, 2020 10:03 am

For v1 camera clone global external shutter work I built a 20$ 5000lm diy highspeed flash. I was able to capture (multiple) exposures with 4µs, mostly with 9µs flash durations (was good enough to capture airgun pellet inflight with 109m/s, clearly). I did a comparison to 940£ Vela One flash (1,000,000lm, but only 50Hz maximal strobe frequency instead of 20KHz with diy flash). One advantage of Vela One was that it allowed for 0.5µs flash duration:
https://github.com/Hermann-SW/Raspberry ... ed-flashes
highspeed_flash.jpg
highspeed_flash.jpg
highspeed_flash.jpg (74.81 KiB) Viewed 1478 times
Initially I used two 0-24V IRF520 mosfets in series to power 50W led with 38V/1.5A from led driver. Lately I use single 0-100V IRF520 mosfet instead.

Yesterday I posted on nanoflash.c code, based on pigpio nanopulse.c example. It allows for 3ns..149µs duration flashes, triggered by rising edge of GPIO4:
viewtopic.php?f=33&t=283993
I mainly used HQ camera module VSYNC signal to trigger, but hardware camera sync pulses for v1+v2 cameras works as well:
viewtopic.php?f=43&t=190314

Yesterday I wanted to know how low pulse duration is still capturable with 5000lm led directed into 35mm C mount lens HQ camera. This should only be done with very short pulse durations in order to not damage HQ camera sensor.

This was how I did it:
  • left bottom window starts nanoflash with specified duration
  • right bottom raspivid captures 4056x3040@10fps, scaled to 507x380 with annotated preview window top right
  • top left window uses raspi2png for screenshot, and uses netpbm tools to cut out preview window only
snapshot.png.jpg
snapshot.png.jpg
snapshot.png.jpg (85.67 KiB) Viewed 1478 times
After this screenshot, I turned off light for dark room.

I captured flash durations 500/400/300/200/150/140/130/120/110/100/90 nanoseconds and created 1fps animation from that for easy comparison of the captured frames. One of the 6 rows of leds is broken, and down to 110ns all remaining leds show up. 500ns flash duration feels still bright, will try capturing airgun pellet inflight when back at home with 0.5µs. This is animation:
Image


P.S:
Light travels 33m in 110ns, so this type of led is not good enough for very short light pulses. I tried green laser as well, and lowest visible duration was 500ns, with green laser directed into camera.
https://github.com/Hermann-SW/memrun
https://stamm-wilbrandt.de/2wheel_balancing_robot
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/en/Raspberry_camera.html

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

Re: 5000lm diy highspeed flash

Mon Aug 31, 2020 8:40 am

HermannSW wrote:
Sat Aug 29, 2020 10:03 am
One of the 6 rows of leds is broken, and down to 110ns all remaining leds show up.
Correction, I bought several 5000lm and some 10000lm leds in the past, and all had 1 led dot per 100lm (5x10 for 5000lm, 10x10 for 10000lm). The led dots can be seen best with 150ns exposure, and there are 5 rows of 10 lit leds. So there is no broken row, two rows just moved a bit from their original positions.
5.png
5.png
5.png (201.56 KiB) Viewed 1384 times

P. S:
150ns exposure image is similar to what I see through welding helmet safety glass at home, with continuous lighting led.


P.P.S:
viewtopic.php?f=43&t=215560&p=1326038&h ... t#p1445999
photo of the 10000lm led through welding shield safety glass with focus on the led
Image
https://github.com/Hermann-SW/memrun
https://stamm-wilbrandt.de/2wheel_balancing_robot
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/en/Raspberry_camera.html

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

Re: 5000lm diy highspeed flash

Wed Sep 02, 2020 11:19 pm

Wow, I did multiple exposure v1 camera global external shutter capturing of closing mouse trap bar, and because of calculation mistake the 9 flashes had 2µs duration and not 20µs -- and exposures are well visible.
In one terminal I executed this command:

Code: Select all

🍓 ./raspivid_ges90
^C
🍓 

That command captures mode7 at 90fps:

Code: Select all

🍓 cat raspivid_ges90 
#!/bin/bash
T=13 # strobe GPIO 
t=2  # initial strobe pulse length [s]

args="-md 7 -w 640 -h 480 -p 10,10,640,480 -fps 90 -awb flash -o tst.h264 -pts tst.pts -t 0"
if [ "$*" != "" ]; then args=$*; fi

cmd=raspivid
if [ "$0" = "raspividyuv_gs" ]; then cmd=raspividyuv; fi

if [ ! -f /var/run/pigpio.pid ]; then sudo pigpiod -s 1; sleep 0.5; fi

( pigs m $T w; pigs w $T 1; sleep $t; pigs w $T 0 ) &

$cmd $args &
PID1=$!

sleep 0.4
pigs i2cc 0  2>/dev/null >/dev/null
set -e
h=`pigs i2co 0 0x36 0`
pigs i2cwd $h  0x30 0x02  0xff       # enable frex mode
pigs i2cwd $h  0x3b 0x06  0x10 0x1d  # frex_ctrl+mode

wait $PID1
🍓 

In the other terminal I initiated 9s of 1KHz flashes with duty cycle 0.2% (2µs):

Code: Select all

🍓 ./pwm_ges 1000 2000 9
🍓 

Frame 1123 from captured video contained what I was after, with logc analyzer verification of 2µs flash duration (and 1KHz frequency) -- nice, and it looks like 0.5µs flash duration would give visible image as well. Complete mouse trap closing takes 10ms only:
closing.mt.mexp9.1KHz.2pm_duty.jpg
closing.mt.mexp9.1KHz.2pm_duty.jpg
closing.mt.mexp9.1KHz.2pm_duty.jpg (71.37 KiB) Viewed 1285 times
https://github.com/Hermann-SW/memrun
https://stamm-wilbrandt.de/2wheel_balancing_robot
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/en/Raspberry_camera.html

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

Re: 5000lm diy highspeed flash

Tue Oct 06, 2020 7:18 pm

I developed my 5000lm diy highspeed flash for my v1 camera clone "global external shutter" work back in 2019:
https://github.com/Hermann-SW/Raspberry ... troduction

In the end I was able to even capture very fast rotating mini drone propeller at daylight:
https://github.com/Hermann-SW/Raspberry ... r#daylight

Two myths remained for me until today:
  • fast moving object needs dark background at least locally
  • either global shutter camera is needed, or at least a camera with global reset like the v1 camera
So lets remove the myths first, I did capture 12MP photo with raspistill and HQ camera without any dark background today at daylight, corollary:
Capturing superfast motion with rolling shutter camera without rolling shutter effect is possible (with stroboscope flash)
This is center part of 12MP photo captured, scaled to 50% for forum attachment:
tst.part.50%.jpg
tst.part.50%.jpg
tst.part.50%.jpg (59.52 KiB) Viewed 1173 times


This was today's setup:
  1. HQ camera with CStoM12 adapter and Arducam 130° M12 lens looks up above 5000lm led
  2. mini drone propeller directly above 5000lm led, powered with 3.3V (from Arduino Uno)
  3. MOSFET module controlling 38V/1.5A DC for 5000lm led
    (Pi4B GPIO13/3.3V/GND connected to SIG/VCC/GND of module)
  4. HQ camera XVS/GND pins connected to Pi GPIO17/GND (VSYNC)
setup.jpg
setup.jpg
setup.jpg (65.86 KiB) Viewed 1173 times

I merged two existing pigpio C interface programs for sshts.c:

Code: Select all

/*
   $ gcc -O6 -o sshts sshts.c -lpigpio -lrt -lpthread
   $
   
   $ sudo killall pigpiod
   $ sudo ./sshts o N d f
   $
   N flashes of length d[us] will be generated at frequency f[Hz] on GPIO13,
   after offset o[us] for each GPIO17 rising edge.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>

#include <pigpio.h>

#define gpioStrobe 13
#define gpioDin 17

int wave_id, N=1;

gpioPulse_t *pulse;

int main(int argc, char *argv[])
{
   unsigned int d,f,o;
   assert(argc == 1+4);
   assert(0 <= (o = atoi(argv[1])));
   assert(0 < (N = atoi(argv[2])));
   assert(0 < (d = atoi(argv[3])));
   assert(0 < (f = atoi(argv[4])));
   f = 1000000/f - d;

   assert(gpioCfgClock(1, 1, 0) >= 0);
       
   assert(gpioInitialise()>=0);

   gpioSetMode(gpioDin, PI_INPUT);
   gpioSetMode(gpioStrobe, PI_OUTPUT);
   gpioWrite(gpioStrobe, 0);

   gpioWaveAddNew();

   assert(pulse = malloc(sizeof(gpioPulse_t) * (2*N+1)));
   pulse[0].gpioOn  = 0;
   pulse[0].gpioOff = 1<<gpioStrobe;
   pulse[0].usDelay = 2;

   for(int i=1; i<=N; ++i)
   {
      pulse[2*i-1].gpioOn  = 1<<gpioStrobe;
      pulse[2*i-1].gpioOff = 0;
      pulse[2*i-1].usDelay = d;

      pulse[2*i-0].gpioOn  = 0;
      pulse[2*i-0].gpioOff = 1<<gpioStrobe;
      pulse[2*i-0].usDelay = f;
   }

   gpioWaveAddGeneric(2*N+1, pulse);

   wave_id = gpioWaveCreate();

   assert((wave_id >= 0) || !"wave create failed\n");

   for(;;)
   {
     while (!gpioRead(gpioDin))  {}
     usleep(o);
     gpioWaveTxSend(wave_id, PI_WAVE_MODE_ONE_SHOT);
     while (gpioRead(gpioDin))  {}
   }

   gpioTerminate();

   free(pulse);

   return 0;
}

Since HQ camera XVS is connected to GPIO17, the flashes are created in each camera frame:
viewtopic.php?f=43&t=281913

For v1 and v2 camera hardware camera sync pulses could be used alternatively:
viewtopic.php?f=43&t=190314

In one terminal I started this command (creates five 19µs duration flashes at 4KHz frequency, 30ms after frame VSYNC rising edge):

Code: Select all

$ sudo ./sshts 30000 5 19 4000

In 2nd terminal raspistill just captures the photo:

Code: Select all

$ raspistill -md 3 -w 4056 -h 3040 -p 515,22,507,380 -o tst.jpg

12MP photo:
https://pbs.twimg.com/media/Ejq4p1eXcAA ... =4096x4096

Code: Select all

$ jpegtopnm tst.jpg | pnmscale 0.15 | pnmtojpeg > tst.15%.jpg
jpegtopnm: WRITING PPM FILE
$
tst.15%.jpg
tst.15%.jpg
tst.15%.jpg (14.7 KiB) Viewed 1173 times

This multi exposure also reveals rotational speed of the propeller!
The 1st and 5th exposure of propeller are 4/4000Hz=1ms apart.
And the area covered between them is roughly 1/3rd of full circle.
So one full rotation takes 3ms, and motor runs at 333rps or 20,000rpm;
Propeler diameter is 34mm, so propeller speed at blade tip is 35.6m/s or 128km/h.
Blade tip moves 19µs*35.6m/s=0.68mm during a single flash.


I am impressed of the two myths removed.
Plan for next week is that I willl be home few days before moving to rehab hospital.
I am pretty sure that I will use airgun of friend (not used for a year) for capturing >100m/s inflight pellets passing just above 5000lm led with HQ camera.

Unlike 2019 where I did capture pellet 10 times in multiple exposure photo
https://github.com/Hermann-SW/Raspberry ... nt-9000eps
with camera distant to 5000lm led, this time I will try to capture pellet inflight for very near to HQ camera lens as propeller today -- I will have to be careful to not hit the M12 lens ;-)


P.S (10/14):
I never had problems with the 38V/1.5A 5000lm flash for more than a year, until last week accidentially 38V got in contact with GPIO and killed my 4GB Pi4B. So be careful with the 38V cables. More:
viewtopic.php?f=29&p=1741647#p1741644
https://github.com/Hermann-SW/memrun
https://stamm-wilbrandt.de/2wheel_balancing_robot
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/en/Raspberry_camera.html

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

Re: 5000lm diy highspeed flash

Fri Oct 23, 2020 7:46 pm

I was able to capture >92m/s inflight bullet with HQ camera with the help of multiple single digit microsecond duration 5000lm led flashes:
viewtopic.php?f=43&t=288886&p=1746620#p1746620
Image


But the 1012x760 frame shows that using a single 5000lm flash lights the bullet from one side only.
I searched for all 5000lm and 10000lm leds I had.
And it turned out that the three 5000lm leds I have are all broken, with at least 1 of the 5 rows with 10 led dots each not working.
This includes the led used to capture above frame, with 4 rows working it was a 4000lm flash only.

Luckily I have five(!) fully woking 10000lm leds.
In the past I preferred using the 5000lm leds, because they could be used with 40x40x20mm passive heatsinks for longer time.
The 10000lm leds did need big active heatsinks, without they become disfunctional within few seconds.
This is one of two I tried:
https://www.aliexpress.com/item/32808714316.html


The 50W 5000lm leds need led drivers converting mains 220V AC to 38V/1.5A DC.
The 100W 10000lm leds need led drivers converting mains 220V AC to 38V/3A DC.
I have three 50W led drivers and one 100W.

Connecting the 50W led drivers to 10000lm led showed 32.1V/1.37A on 100V/10A voltmeter/amperemeter for all three.
Connecting the 100W led driver to 10000lm led revealed that the driver was fake, showed only 31.5V/1.14A.

For building 100W drivers I combined pairs of the four led drivers.
Connecting to one 10000lm led they showed 35.3V/2.80A for two 50W drivers, and 35.2V/2.58A for 50W+bad 100W driver.
Led gets very hot quickly (because of no heatsink), and then the voltage decreases quickly.
This is photo done as fast as I could after powering on 50W and 100W fake led driver:
20201023_170032.jpg.15%.jpg
20201023_170032.jpg.15%.jpg
20201023_170032.jpg.15%.jpg (55.68 KiB) Viewed 1001 times

Next I took a photo focussing on two 10000lm leds both connected, powered with single 50W led driver only.
Even that is very bright, so I took the photo through welding helmet safety glass.
As can be seen the 10x10 led dots in each 10000lm led work fine:
20201023_172259.jpg.15%.jpg
20201023_172259.jpg.15%.jpg
20201023_172259.jpg.15%.jpg (15.21 KiB) Viewed 1001 times

Because of the difference in amperage of both pairs I decided to power both 10000lm leds from parallel four led drivers I have.
I measured 35.8V/5.44A which is 194.8W, pretty close to 200W needed:
(after powering on all four driver switches leds became hot, and the 35.8V reduced to 34.9V already)
20201023_184649.jpg.15%.jpg
20201023_184649.jpg.15%.jpg
20201023_184649.jpg.15%.jpg (68.75 KiB) Viewed 1001 times

I did the captures of airgun bullet inflight with led lighted for 4 seconds, but the led was "on" with 8.33µs long flashes at 9KHz, that is only 75ms per second. Should not be a heat problem with the two 10000lm leds.

For controlling the 5000lm led up to now I used 100V IRF520 mosfet -- luckily that can deal with 9A, more than enough for letting Pi control the two 10000lm leds.
https://github.com/Hermann-SW/memrun
https://stamm-wilbrandt.de/2wheel_balancing_robot
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/en/Raspberry_camera.html

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

Re: 5000lm diy highspeed flash

Fri Oct 30, 2020 11:55 am

This is followup on the very low exposure investigation done for 5000lm led before:
viewtopic.php?f=43&t=284108#p1719823
Image


Last night I did power a single 10000lm led with two led drivers (100W in total) and wanted to see how low 10000lm led would be visible. To my surprise there was a hard lower bound of 500ns, below that nothing could be seen, neither for camera nor for my eye. Reason seems to be, that below 500ns time is too short to build >2A for the two led drivers.

Today at daylight I did another capture showing what I captured at 500ns exposure time with the same method described in detail in previous posting. 12MP photo:
https://stamm-wilbrandt.de/en/forum/10Klm.500ns.day.jpg
Scaled to 15%:
10Klm.500ns.day.15%.jpg
10Klm.500ns.day.15%.jpg
10Klm.500ns.day.15%.jpg (24.94 KiB) Viewed 911 times

Similar photo in darkness, also 500ns exposure time:
https://stamm-wilbrandt.de/en/forum/10Klm.500ns.jpg
10Klm.500ns.15%.jpg
10Klm.500ns.15%.jpg
10Klm.500ns.15%.jpg (13.04 KiB) Viewed 911 times

A 1:1 copy out of top left corner shows interesting details about 15 of the 100 led dots:
10Klm.500ns.part.jpg
10Klm.500ns.part.jpg
10Klm.500ns.part.jpg (34.95 KiB) Viewed 911 times
https://github.com/Hermann-SW/memrun
https://stamm-wilbrandt.de/2wheel_balancing_robot
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/en/Raspberry_camera.html

Return to “Camera board”