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

Gun chronograph / capturing inflight photo

Mon Sep 20, 2021 6:38 pm

I did measure speed of inflight bullets with single digit µs duration flashes at 9KHz frequency:
https://github.com/Hermann-SW/Raspberry ... m-exposure

Knowing the length of the bullet allowed to determine length per pixel. Distance between successive exposures of bullet can be computed from length per pixel. Finally multiplying with frequency resulted in speed of bullet. Intially I did those experiments with v1 camera and global external shutter. Later with just an HQ camera, even at daylight:
https://github.com/Hermann-SW/Raspberry ... t-inflight
Image


A modern gun chronograph does determine bullet speed differently:
The modern chronograph consists of two sensing areas called chronograph screens, which contain optical sensors that detect the passage of the bullet. The bullet is fired so it passes through both screens, and the time it takes the bullet to travel the distance between the screens is measured electronically.

I did buy a 32$ gun chronograph, and did not notice the word "mini" -- it is really a small device, 75x43x33 mm³, with tube diameter of 12mm:
https://www.aliexpress.com/item/4001044624890.html

The bullet has to be shot through the tube. I can see the two screens from the side, but they are roughly 1cm inside the tube. I will try to use v1 spy camera to get detailed photos from the screens.

After turning on the gun chronometer, I tried to get a first measurement. I took a pointed bullet and just tried to throw it through the tube -- always 0 was displayed. Then I placed chronometer on floor with tube vertical. After a few tries letting fall the bullet from 50cm height, it passed both screens in tube and resulted in 3.3m/s measurement:
20210920_154417.15%.jpg
20210920_154417.15%.jpg
20210920_154417.15%.jpg (22.08 KiB) Viewed 2157 times
I did not correct the weight of the bullet, used a milligram precision scale to see that pointed pellet (8mm long, left of chronometer) does weigh 620mg, so the 0.20g weight on display is wrong.

After playing with the chronograph I ended up in a different display, showing multiple measurements. That photo revealed that my previous 5 attempts resulted in measurements as well, but speeds less than 2m/s were not displayed in the other display. On the left side you can see the tube in this photo as well:
20210920_182205.15%.jpg
20210920_182205.15%.jpg
20210920_182205.15%.jpg (19.52 KiB) Viewed 2157 times

Product description states:
Measurement speed range: 1-999.9 m/s (fps range 30-999.9)

Not sure yet whether screen is a single row camera, or even a single pixel "camera". The airgun of a friend I use has shown speeds of 109m/s, far below maximal speed that can be measured.

I will try to repeat Raspberry camera PWM multiple exposure speed deterrmination just after pellet leaves the chronograph tube, in order to verify that both speeds determined match.

The device runs on 5V, later I will try to open it and get hold of the 2nd screen signal (with voltage level adjustment to Pi). I did captures with sound trigger before:
https://github.com/Hermann-SW/Raspberry ... nd-trigger
This is a 5 exposures photo of an inflight softair pistol pellet taken with sound trigger:
Image


Plan is to use 2nd screen signal (instead of microphone) to trigger capture of single digit microsecond flash after delay so that a single exposure photo at high speeds becomes possible.
Last edited by HermannSW on Tue Sep 28, 2021 8:28 pm, edited 1 time in total.
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: 4627
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Gun chronograph

Tue Sep 21, 2021 7:27 am

Spy cam did not work, too close in tube.
I removed cover plate and saw 5 elements on pcb, which I was able to verify by inspection:
20210921_002230.jpg
Opened, 5 elements
20210921_002230.jpg (75.05 KiB) Viewed 2087 times

Although chronometer worked, I could not see anything for the 5 elements.
My assumption was that infrared light was used, which is invisible to humans.
Any camera can show infrared light (as different color).
Nothing for the 4 elements on one side, but the single element is an IR led.
Therefore each of the 2 chronometer screens is a "camera" with frame size 4x1 pixels!
20210921_002139.jpg
Infrared led
20210921_002139.jpg (70.75 KiB) Viewed 2087 times

I did use airsoft pistol, did weigh a pellet as 117mg, with 6mm diameter.
So weight and caliber display is now correct.
The 32.3m/s speed measured corresponds to what I measured with multiple exposures before:
20210921_002312.jpg
32m/s measurement
20210921_002312.jpg (50.33 KiB) Viewed 2087 times

P.S:
Looking at the first photo, the direction of 2nd back screen in tube seems to be orthogonal to direction of front screen.
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: 4627
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Gun chronograph

Tue Sep 21, 2021 7:37 pm

Before adding Raspberry camera with flashes, I gave the airgun a try with new gun chronometer.
In normal orientation airgun is difficult to get repeatedly into same position.
So I just did lay the airgun onto the side.
But then the gun barrel was not horizontal.
It turned out that a (blue in photo) 4x2 normal Lego piece was needed below muzzle.
Then barrel was horizontal, and mid of barrel was at same height as mid of chronograph tube.
Behind the chronometer is a little box, filled with pressed newspapers, as bullet catcher:
20210921_174258.15%.jpg
20210921_174258.15%.jpg
20210921_174258.15%.jpg (92.03 KiB) Viewed 2034 times

I did some shots and measured speeds in 86m/s..96m/s range:
20210921_175507.15%.jpg
20210921_175507.15%.jpg
20210921_175507.15%.jpg (37.71 KiB) Viewed 2034 times

It turned out that bullet weight was important.
I used milligram precision scale, and 0.65g rated pellets shows weight in 615mg..635mg range.
Finally, after weighing many pellets, I found one with 605mg weight.
I forgot to adjust the weight, so display of 0.62g is wrong -- but the speed is cool !
20210921_182207.15%.jpg
20210921_182207.15%.jpg
20210921_182207.15%.jpg (36.55 KiB) Viewed 2034 times

109.4m/s is 393.84km/h ... (I know that real guns can show several 100s m/s, and BMG50 bullets can show 900m/s)

P.S:
50fps framerate means a frame each 20ms.
100m/s bullet would fly 2m between two neighbored frames.

P.P.S:
I have measured that "same" speed (109.2m/s) two years ago with 3KHz PWM multiple exposures (8.33µs duration bright flashes):
https://github.com/Hermann-SW/Raspberry ... us_top_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

memilanuk
Posts: 63
Joined: Fri Aug 09, 2013 2:20 pm

Re: Gun chronograph

Wed Sep 22, 2021 4:35 am

Nice!

I have some experience with chronographs (as a user, not a designer) in relation to high-velocity centerfire cartridges. Got rid of the optical chronos years ago, as the issues of ambient light levels and precise alignment were constant headaches. Moved to units that used magnetic pulses, or even radar, and enjoy much more consistent performance!

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

Re: Gun chronograph

Wed Sep 22, 2021 6:59 pm

memilanuk wrote:
Wed Sep 22, 2021 4:35 am
Got rid of the optical chronos years ago, as the issues of ambient light levels
Since the chronograph uses IR sensors, I doubt ambient light is much of a problem when using inhouse. In addition the sensors are hidden by a slit that is 1cm distant to outside:
chronograph_tube.png.jpg
chronograph_tube.png.jpg
chronograph_tube.png.jpg (25.31 KiB) Viewed 1936 times
I think that measurements are reliable, different speeds get measured because of at least ±10mg weight for the bullets. Left side of photo shows that no bullet seems to have touched the tube, no scratches.

I tried one more thing to get less weight bullets than just measuring one after the other. Since bullet has just to pass 10cm before hitting bullet catcher, my hope was that slight form changes would not matter for >100m/s speeds. So I took out my Dremel and reduced one bullet to 580mg. Immediate success, 110.2m/s measurement. Next I did dremel away quite some material, bullet does weigh 481mg only (started at 619mg):
pointed_480mg.png.jpg
pointed_480mg.png.jpg
pointed_480mg.png.jpg (53.49 KiB) Viewed 1936 times

And the one shot with that bullet (with correctly telling chronometer of 0.48g weight) resulted in this measurement:
20210922_200634.10%.jpg
20210922_200634.10%.jpg
20210922_200634.10%.jpg (11.4 KiB) Viewed 1936 times
125m/s is 450km/h(!) -- as said the modification of pellet is definitely not something one wants to do when trying to hit a distant target, but for pure speed measurement increase as here bullet modification is an option.

My 1kg raspcatbot maximal circular speed in garage was 3.13m/s sofar, and that is 4.9 Joule, not much more than the chronograph did show for the little (fast) bullet:
viewtopic.php?f=37&t=267999&p=1887701&h ... t#p1885623
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

cleverca22
Posts: 4714
Joined: Sat Aug 18, 2012 2:33 pm

Re: Gun chronograph

Thu Sep 23, 2021 2:47 am

HermannSW wrote:
Wed Sep 22, 2021 6:59 pm
125m/s is 450km/h(!) -- as said the modification of pellet is definitely not something one wants to do when trying to hit a distant target, but for pure speed measurement increase as here bullet modification is an option.
in my area of canada, you dont need a license for any airgun under ~150 meters/sec

so if your modifications go too fast, you could potentially turn something that is legal to own, into something that requires a license to own

source

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

Re: Gun chronograph

Thu Sep 23, 2021 6:16 am

@cleverca22:
Thanks for the hint.
In Germany use of air guns is OK up to muzzle energy of 7.5J.
I already reached 3.8J, but have seen 3.7J before, so likely the airgun I use cannot show 7.5J.
Next I will do the camera stuff I described to do with this chronometer.
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: 4627
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Gun chronograph

Thu Sep 23, 2021 10:13 pm

HermannSW wrote:
Thu Sep 23, 2021 6:16 am
Next I will do the camera stuff I described to do with this chronometer.
Just one more thing, I had a phone call with the friend whose airgun I use.
We talked about bullet weight and that less weight means higher speeds.
He proposed to 3D print 4.5mm diameter bullets and try those to measure higher speeds.

Later I realized that I have very stable 3D printed airsoft pistol pellets of 6mm diameter.
I used my Dremel to reduce diameter to make it fit into the 4.5mm caliber airgun:
airgun_bullet_dremel.jpg
airgun_bullet_dremel.jpg
airgun_bullet_dremel.jpg (72.58 KiB) Viewed 1829 times

First the modified bullet was too thick, later it did fit, with final weight of 54mg only (down from 114mg):
airgun_bullet_final.jpg
airgun_bullet_final.jpg
airgun_bullet_final.jpg (79.59 KiB) Viewed 1829 times

Then I wanted to measure speed, and chronometer said low battery. So I charged the chronograph and measured:
airgun_275mps.15%.jpg
airgun_275mps.15%.jpg
airgun_275mps.15%.jpg (34.49 KiB) Viewed 1829 times

Wow, 275.2m/s -- that is 990km/h!
With only 2.272J muzzle energy legal in Germany, because less than 7.5J.
But since faster than 150m/s illegal in Canada as @cleverca22 stated.

I just verified muzzle energy for checking, with 0.06g as stored into the chronograph:
https://en.wikipedia.org/wiki/Muzzle_energy

Code: Select all

$ echo "0.5*0.06/1000*275.2^2" | bc -ql
2.27205120000000000000
$

275m/s is not much less than speed of sound 343m/s ...
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: 4627
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Gun chronograph

Fri Sep 24, 2021 9:49 am

Now to the camera aspect of capturing a bullet inflight with 275.2m/s.
I used 8.33µs flashes sofar, but at that speed bullet moves 2.3mm while flash is active.
Even with only 2µs flash duration, bullet moves 0.55mm and will likely not give a clean photo.
With 0.5µs flash duration photo might be sharp, bullet moves only 0.14mm:

Code: Select all

$ bc -ql
(275.2/10^6)*8.33*10^3
2.29241600000000000000
(275.2/10^6)*2*10^3
.55040000000000000000
(275.2/10^6)*0.5*10^3
.13760000000000000000

I did investigate how short duration flashes can be done with the 5000lm 38V/1.5A leds I use. Down to 100ns is visible to camera, maybe 500ns=0.5µs is bright enough to capture 275.2m/s inflight bullet ...
viewtopic.php?f=43&t=284108
Image


When I captured inflight airgun bullets with HQ camera a year ago, I used two leds, and both were 10000lm leds instead of 5000lm, which should definitely help to get inflight bullet better lighted:
viewtopic.php?f=43&t=288886#p1747830
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

Jack Hogan
Posts: 121
Joined: Wed May 13, 2020 2:08 pm
Contact: Website

Re: Gun chronograph

Fri Sep 24, 2021 3:01 pm

I did investigate how short duration flashes can be done with the 5000lm 38V/1.5A leds I use. Down to 100ns is visible to camera, maybe 500ns=0.5µs is bright enough to capture 275.2m/s inflight bullet ...
Hermann, for such captures, why don't you compensate for the shorter flash duration by increasing analog/digital gain? That way brightness stays about the same while noise increases, but at least you can see something even with very short durations. Use the shortest one that yields acceptable SNR (eyeball it, usually around 10).

If you are using the HQ cam, it has about an 11 stop DR (from full scale to SNR = 1). With SNR>10 (3+ stops above that) DR is 7+, which means that if you saturate the sensor at 500ns, you should get an acceptable image at 500/2^7 = 4ns. Anything longer than that is bonus.

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

Re: Gun chronograph

Sun Sep 26, 2021 10:14 pm

Thanks, I have done much with Raspberry cameras in the past, but very seldom modified gains. I will look into this when I will have 2x10000lm highspeed flash setup up and working again.

When I saw 275m/s with the modified 6mm diameter airsoft pistol pellet, I searched for 4.5mm caliber airsoft pistol pellets and ordered them, mostly because they would not need any "Dremel time" before shooting, and because of 5x weight reduction over the pointed bullets I used before:
https://www.amazon.de/gp/product/B08PNN ... le_o00_s00
They are not really 4.5mm diameter, a little less (4.2mm):
20210926_235027.15%.jpg
20210926_235027.15%.jpg
20210926_235027.15%.jpg (44.06 KiB) Viewed 1627 times
For one pellet I tried, when I moved airgun barrel with muzzle down, the pellet did fall out through muzzle ...

Although stated to be 0.13g, I measured around 125mg. I did find some of weight 121mg that I used.
Repeatable speeds around 220m/s (roughly 800km/h) are possible now -- not 275m/s, but repeatable and easy:
20210925_224308.15%.jpg
20210925_224308.15%.jpg
20210925_224308.15%.jpg (18.17 KiB) Viewed 1627 times

I did one experiment indicating that possibly these pellets have too much play in gun barrel. I did put a bit of superglue on one pellet and used it to glue two pellets together. With more than double weight, I would have expected sqrt(2) less speed (because of energy formula 0.5*m*v²). But surprisingly the two glued pellets showed nearly same speed of 203m/s ...

At least I now know that airgun can show more than 5 Joule:

Code: Select all

$ echo "0.5*0.125*2/1000*203^2" | bc -ql
5.15112500000000000000
$

P.S:
I will redo this experiment with camera control. That will answer the question whether the two pellets pass camera still glued together, or separated by the big pressure in gun barrel.

I once did shoot 3 pellets in one shot, they were not glued together.
The double exposure photo shows the yellow pellet falling off common trajectory:
https://github.com/Hermann-SW/Raspberry ... t-3pellets
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: 4627
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Gun chronograph

Mon Sep 27, 2021 6:54 am

For reacting very fast on 2nd chronometer screen signal, a Pico is an option. Any normal Pi has high IRQ startup time, and can just be late 50µs because of OS scheduling with active waiting code. With active waiting a Pico would be able to respond in 3 clock cycles, not sure what the cost of interrupt processing is on Pico. Maybe I will use Pico for triggering flash with a delay after airgun bullet passes 2nd screen of airgun chronometer -- even at Pico default frequency of 125MHz chronometer signal will be detected in 3*8ns=24ns at most. Fastest bullet I have measured until now had 275m/s, that is 0.275mm/µs, which means bullet moves 6.6µm at most(!) before being detected by Pico ... of course I will need to find the chronometer 2nd screen signals of the 4 IR detectors or a combined signal. At least the front screen signals seem to be easily accessible by photo from earlier in this thread. Checking for 4 signals sequentially would take 13 clock cycles -- bullet moving 28.6µm at most in that time seems to be very acceptable:
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: 4627
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Gun chronograph

Mon Sep 27, 2021 7:24 am

HermannSW wrote:
Sun Sep 26, 2021 10:14 pm
For one pellet I tried, when I moved airgun barrel with muzzle down, the pellet did fall out through muzzle ...
My wife gave me a 3.95mm diameter thread rod we bought years ago. That easily passes 4.5mm caliber airgun barrel. This should resolve the 4.2mm diameter pellet problems when using airgun as muzzle loader:
20210927_091818.15%.jpg
20210927_091818.15%.jpg
20210927_091818.15%.jpg (25.27 KiB) Viewed 1564 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: 4627
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Gun chronograph

Mon Sep 27, 2021 6:23 pm

HermannSW wrote:
Mon Sep 27, 2021 7:24 am
This should resolve the 4.2mm diameter pellet problems when using airgun as muzzle loader:
It did, I just did 7 shots, did load the airgun without pellet inserted, then inserted pellet through muzzle, and finally used thread rod to move pellet to defined, always same position at end of barrel. All 7 shots show nearly exactly the same speed (the 203m/s measurement was last measurement from yesterday). So now I have an easy to use, repeatable source of 224m/s (806km/h) inflight pellets for capturing photos:
20210927_201320.15%.jpg
20210927_201320.15%.jpg
20210927_201320.15%.jpg (35.29 KiB) Viewed 1513 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: 4627
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Gun chronograph / capturing inflight photo

Tue Sep 28, 2021 8:55 pm

OK, today I searched for the two 10000lm leds, powered from four 38V/1.5A power supplies in parallel, controlled with 100V IRF520 mosfet, and found them. Sadly one has only rougly 80 of the 100 leds working, the other less than 70. I did order 4 new on amazon, bug they will take more than two weeks to arrive.

Anyway I started with what I have, and moved to next room, the stuff can remain there for next days work. Besides what I stated, a Pi0W (with big monitor) is used to control the flash lights, and Pi4B with original Raspberry display captures the video. Airgun shoots through chronograph, above v2 camera with lens directed up. The two 10000lm leds light scene above lens:
20210928_213108.15%.jpg
20210928_213108.15%.jpg
20210928_213108.15%.jpg (39.04 KiB) Viewed 1448 times

The first try to capture inflight pellet in video (raspivd -md 1 -w 1920 -h 1080 -o tst.h264 -t 9000) was done with "pigs hp 13 30000 60000" command on Pi0W for 30KHz strobe light with 6% duty cycle. I was surprised to see this crazy speed on chronograph:
20210928_214212.15%.jpg
20210928_214212.15%.jpg
20210928_214212.15%.jpg (15.07 KiB) Viewed 1448 times
A second try with capturing showed same crazy speed. Then I did just a shot as yesterday, no camera, no led light -- now 223.9m/s was shown. Sadly the IR led of the 2nd chronograph screen is at bottom, so that the 4 IR sensors are top, and take the 30KHz led strobe light as pellet passed ... perhaps turning chronograph upside down will resolve the issue tomorrow.

I did take 30KHz strobe frequency, because a 224m/s pellet will move 1000000/30000*0.224mm=7.5mm between two flashes. The 6% duty cycle (100% is 1,000,000) results in 1000000/30000*0.06= 2µs flash duration.

There are multiple problems to work on, as stated the chronograph speed measurement, v2 (NoIR) camera with lens too near to pellet trajectory, bad signals resulting in stripes in video (I know, I should not use the 2m long flat ribbon cable), ...

At least I got a first real capture of 4.2mm diameter pellet inflight with 224m/s -- not that bad image considering the speed, relatively sharp because of only 2µs flash duration. Three frames are shown, the one before pass of pellet, the one with pellet captured top left, and the next frame showing a lot of dust particles activity (1920x1080 scaled to 25% size):
x.anim.gif
x.anim.gif
x.anim.gif (184.49 KiB) Viewed 1448 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: 4627
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Gun chronograph / capturing inflight photo

Wed Sep 29, 2021 1:13 pm

I wanted to understand the 4.2mm diameter pellet capture top left in frame, and why I see only one pellet despite 30KHz 6% duty strobe pulses (1920x1080 frame scaled to 640x360):
frame.0006.png.33%.jpg
frame.0006.png.33%.jpg
frame.0006.png.33%.jpg (11 KiB) Viewed 1359 times

First, the camera needs to be turned by 90°, since as is the pellet passes from bottom to top, while there is more FoV when passing from left to right:
20210929_121012.15%.jpg
20210929_121012.15%.jpg
20210929_121012.15%.jpg (42.71 KiB) Viewed 1359 times
I had to turn out the lens a lot in v2 camera (self added) M12 mount in order to get a sharp image around middle of gun chronograph tube. Also the vertical range with sharp view is perhaps 1cm only.

Next, it is a while back that I captured with v2 camera, and capturing with mode 1 1920x1080 is not a good idea FoV wise for v2 camera (image from https://picamera.readthedocs.io/en/rele ... 2/fov.html):
Image
I just tested, capturing in mode 4 allows for full FoV, with 1640x1232 at 40fps without any frameskips -- definitely preferable (ptsanalyze tool is here):

Code: Select all

pi@raspberrypi4B:~ $ raspivid -md 4 -w 1640 -h 1232 -o tst3.h264 -t 9000 -fps 40 -pts tst3.pts
Too many macroblocks/s: Increasing H264 Level to 4.2
pi@raspberrypi4B:~ $ ptsanalyze tst3.pts 
creating tstamps.csv
357 frames were captured
majority framerate 40fps
...
> after skip frame indices (middle column)
0 frame skips (0%)
average framerate 40fps
pi@raspberrypi4B:~ $

As calculated in previous posting, 30KHz PWM results in (224m/s) pellet exposure every 7.5mm. Given that pellet diameter is 4.2mm and its size in current frame capture, at least two exposures, maybe even 3 exposures should show up on 1640x1232 frame with camera turned 90 degrees ...
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: 4627
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Gun chronograph / capturing inflight photo

Wed Sep 29, 2021 7:56 pm

Before continuing with multiple exposures and camera, I wanted to check what really happens when using pigpio "pigs hp" command to set hardware frequency (available only on few of the Pi GPIOs, I use GPIO13).

I have not used my 1Gs/s (10^9 samples per second) for quite some time. I really had to read the manual (yes, RTFM) and did probe compensation for both probes first. Then I had to learn how to display 3.3V logic signal CH1 and 12V "test" switched signal CH2 on same display (I used 10x attenuation for CH1 probe, 1x for CH2).

First I did run the command already shown, "pigs hp 13 30000 60000" for getting 30KHz PWM with 6% or 2µs duty. Screenshot of only yellow CH1 looks really clean, as I would have expected. Signal is 10 units of 200ns long, that is 2µs -- nice:
bmp_51_002.bmp.png
bmp_51_002.bmp.png
bmp_51_002.bmp.png (7.04 KiB) Viewed 1322 times

Next I displayed blue CH2 switched 12V signal as well for same 30KHz 6% duty PWM:
bmp_51_003.bmp.png
bmp_51_003.bmp.png
bmp_51_003.bmp.png (8.61 KiB) Viewed 1322 times
The yellow signal is not that rectangular anymore, but still 4 units of 500ns or 2µs long. The interesting part for me is, that when yellow logic signal goes back to 0, it takes another microsecond before the 12V signal becomes 0 as well. So while the logic signal tells the two 10000lm leds to light for 2µs, they most likely give light for 3µs.

Finally I reduced duty to 3% or 1µs for 30KHz PWM, and that confirms that 1µs gets added to the 12V light signal time:
bmp_51_004.bmp.png
bmp_51_004.bmp.png
bmp_51_004.bmp.png (7.73 KiB) Viewed 1322 times

I did these measurements with my Pi400 and 12V instead of 38V in next room, but the IRF520 mosfet module is the same. So nice to see that switched IRF520 voltage is precise up to 1 microsecond. On the other hand the original plan to use 500ns duration flashes will not work because of 1µs addition.

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

pidd
Posts: 2621
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK
Contact: Website

Re: Gun chronograph / capturing inflight photo

Thu Sep 30, 2021 3:23 am

You might get better readings on DC coupling instead of AC.

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

Re: Gun chronograph / capturing inflight photo

Thu Sep 30, 2021 6:53 pm

pidd wrote:
Thu Sep 30, 2021 3:23 am
You might get better readings on DC coupling instead of AC.
I hoped, and tried.

But when both channels are DC coupled, the 2nd channel shows as constant, no idea why.
I thought it might be because the V-/V+ of IRF520 had no consumer connected.
So I connected a 12V motor, but still CH2 (connected to V-/V+) shows constant value (regardless of GPIO13 signal).
When I disconnected CH2 signal, with GND cable still connected to V-, and GPIO13 set to 0, the motor did run?!?!?


I did shooting experiments with gun chronograph in all possible 4 orientations, still crazy measurements when 30KHz PWM flash light is active. I moved both 10000lm leds away from gun chronograph, no change. But then I made use of empty Raspberry boxes in direct sight between led and gun chronograph tube, still leaving space for pellet to pass, and that was successful. Again roughly 224m/s speed readings then, that should show up:
20210930_201335.15%.jpg
20210930_201335.15%.jpg
20210930_201335.15%.jpg (43.63 KiB) Viewed 1225 times

Made progress on Pico side as well, for making Pico act as fixed delay after pellet has reached 2nd chronograph screen and then triggering a single flash for capturing pellet with camera at same position (from left to right) always. I revived my Pico skills from quite some months ago, and flashed compile hello_gpio_irq.c uf2, after having modified CMakefile to enable USB output (I connected Pi400 GPIO13/GND to Pico GP2/GND):
https://github.com/raspberrypi/pico-exa ... gpio_irq.c
Peek_2021-09-30_20-20.gif
Peek_2021-09-30_20-20.gif
Peek_2021-09-30_20-20.gif (57.88 KiB) Viewed 1217 times

IRQ latency on microcontroller should not be that high as on the PIs with an OS, will try to measure the latency now.
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

pidd
Posts: 2621
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK
Contact: Website

Re: Gun chronograph / capturing inflight photo

Thu Sep 30, 2021 7:14 pm

You probably need X10 for channel 2 if its 12V (or 38V)

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

Re: Gun chronograph / capturing inflight photo

Thu Sep 30, 2021 8:27 pm

pidd wrote:
Thu Sep 30, 2021 7:14 pm
You probably need X10 for channel 2 if its 12V (or 38V)
I have x10 for both, which should go x1?

HermannSW wrote:
Thu Sep 30, 2021 6:53 pm
IRQ latency on microcontroller should not be that high as on the PIs with an OS, will try to measure the latency now.
I am surprised that Pico latency is still slightly more than 1µs although a microcontroller (rise=0x8, fall=0x4, Pi400 50KHz PWM with 50% duty on GP2):

Code: Select all

...
void gpio_callback(uint gpio, uint32_t events) {
    gpio_put(5, events>>3);  
}
...
    gpio_set_irq_enabled_with_callback(2, GPIO_IRQ_EDGE_RISE | GPIO_IRQ_EDGE_FALL, true, &gpio_callback);
...
bmp_55_000.bmp.png
bmp_55_000.bmp.png
bmp_55_000.bmp.png (7.24 KiB) Viewed 1200 times

I think I will go with polling instead:

Code: Select all

...
    for(;;)
    {
      while (b!=gpio_get(2)) {}
      gpio_put(5, b);
      b=1-b;
    }
...
Shortest delay seen was 120ns, longest here 175ns:
bmp_55_003.bmp.png
bmp_55_003.bmp.png
bmp_55_003.bmp.png (8.1 KiB) Viewed 1200 times

The delay is not a problem since Pico will have to wait for fixed time before doing a single 2µs flash anyway. The relatively close minimal and maximal delays are good (depending where execution in while loop is when signal changes on GP2). 224m/s is 0.244mm/1µs, and pellet moves at most 0.244mm*(0.175-0.120)=0.0123mm=12.3µm in that time -- so pellet should appear at "exactly same position" on triggered flash photos.

P.S:
Pico runs at default frequency of 125MHz, that is 8ns per clock cycle.
175ns-120ns=55ns, so 7 clock cycles.
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: 4627
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Gun chronograph / capturing inflight photo

Fri Oct 01, 2021 9:01 pm

In the morning I played with airgun again. In order to reduce the stripes I tried to shield v2 camera from 38V cables and 10000lm led with aluminum foil. It got slightly better, but did not resolve the issue. Despite many shots, now from right to left, I did not get any captures. Also I could not let Pi0 turn on 30KHz PWM for more than 1.5 seconds, otherwise the Pi4B raspivid command aborts recording with connector message. At least all shots did show speeds around 224m/s thanks to the two Raspberry boxes. What is remarkable, for every shot the fast pellet moving between the boxes produced so much air turbulence, that both boxes moved a bit together, and I had to move them away from each other a bit for the next shot. Will do more shots Sunday evening when back home, in hope of getting first multiple exposure photo at 224m/s.
20211001_095903.15%.jpg
20211001_095903.15%.jpg
20211001_095903.15%.jpg (41.28 KiB) Viewed 1141 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: 4627
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Gun chronograph / capturing inflight photo

Wed Oct 13, 2021 9:31 pm

Before starting to work on camera and flashes, I just did 3 shots each, with 1/2/3/4 pellets front loaded.
These are the measured speeds in m/s:

Code: Select all

1: 220.6 224.3 222.7
2: 177.0 175.7 177.0
3: 152.8 153.6 150.2
4: 133.1 136.0 138.1
Tried to make sense of 0.5*m*v² formula, not perfect but roughly:

Code: Select all

pi@raspberrypi400:~ $ bc -ql
sqrt(4)*133
266.00000000000000000000
sqrt(3)*152
263.27172275046934861504
sqrt(2)*175
247.48737341529163354000
sqrt(1)*222
222
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: 4627
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Gun chronograph / capturing inflight photo

Thu Oct 14, 2021 11:17 pm

Replacing long flat ribbon cable with original 15cm flat ribbon cable resolved all issues. Not perfect setup, flash duration was 2µs at 30KHz PWM frequency (only 33.3µs between exposures), more details and analysis later in the day.

The first multiple exposure capture of 222.8m/s or 802km/h airgun pellet was split onto two frames of 40fps 1640x1232 mode4 v2 camera video without frameskips.

Full 2MP frame: https://stamm-wilbrandt.de/airgun/1/frame.0055.png
Scaled to 30% for forum attachment:
frame.0055.png.30%.jpg
frame.0055.png.30%.jpg
frame.0055.png.30%.jpg (7.83 KiB) Viewed 284 times
Full 2MP frame: https://stamm-wilbrandt.de/airgun/1/frame.0056.png
Scaled to 30% for forum attachment:
frame.0056.png.30%.jpg
frame.0056.png.30%.jpg
frame.0056.png.30%.jpg (7.53 KiB) Viewed 284 times

The second multiple exposure capture of 221.0m/s or 796km/h airgun pellet on single frame of 40fps 1640x1232 mode4 v2 camera video without frameskips.

Full 2MP frame: https://stamm-wilbrandt.de/airgun/2/frame.0017.png
Scaled to 30% for forum attachment:
frame.0017.png.30%.jpg
frame.0017.png.30%.jpg
frame.0017.png.30%.jpg (7.71 KiB) Viewed 284 times

P.S:
Just realized that I missed "-awb greyworld" in raspivid command although I used v2 NoIR 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: 4627
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Gun chronograph / capturing inflight photo

Fri Oct 15, 2021 8:28 am

Here are the details and analysis, hopefully next multiple exposures look better colorwise with "-awb greyworld".

This was the setup, now with Pi4B with original Raspberry display very near to scene because of the 15cm camera cable. 15cm are normally not a problem, but because of the case and height where cable leaves case I had to tape v2 camera module onto the desk. 10000lm leds are too far distant to pellet trajectory, but this was first multiple exposure setup, where the main task was to eliminate the stripes seen before. I copied in photo of gun chronometer, showing the two reported speeds as 3rd and 2nd last:
20211015_000125.tw.20%.jpg
20211015_000125.tw.20%.jpg
20211015_000125.tw.20%.jpg (21.89 KiB) Viewed 228 times

Because v2 camera looks up, 4.2mm diameter pellets fly from left to right through frame.
Because of nearly only horizontal movement, pellets are very sharp at top and bottom (pellet does fly 0.442mm in 2µs flash time at 221m/s).
I measured both pellet exposures as 432 pixel vertically.
Distance from left to right pellet is measured with gimp as 738.5 pixels:
measure.jpg
measure.jpg
measure.jpg (24.59 KiB) Viewed 228 times

Computed speed from this measurement is slightly less than 221m/s, most likely because of lens effects.
But I like it to be so close to what gun chronometer measured -- camera is for getting photos, not precise measurements.

Code: Select all

pi@raspberrypi400:~ $ echo "0.0042/432*738.5*30000" | bc -ql
215.39583333333328410000
pi@raspberrypi400:~ $

I did place both pellets vertically to see that a darker area near pellet bottom moves:
rotation.jpg
rotation.jpg
rotation.jpg (36.52 KiB) Viewed 228 times

With better photos and dark dot painted on pellet before front loaded, rotation determination at 221m/s will be interesting.
Done with 30m/s airsoft pistol pellets inflight before (30000rpm rotation speed):
https://github.com/Hermann-SW/Raspberry ... re-panning
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

Return to “Camera board”