I’d like to start with a big thanks going to Chris Callander. When he saw the Camera Axe project he shared his idea for a new sensor with me. I took his ideas and developed this new projectile sensor and updated the Camera Axe software to support it. I doubt I would have ever came up with this new sensor idea without Chris. The ideas that get shared in the open source community are great! The hardware and software for this project are shared under the Creative Commons Attribution 3.0 License.

You can purchase the Camera Axe and this projectile sensor at this store or built it yourself (parts list below).

This new projectile sensor is designed to help photograph speeding bullets on the Camera Axe platform, but since I used the Arduino development environment, anyone using an Arduino could easily adapt the this hardware and software to their purposes.

This new sensor has two IR sensors spaced exactly two inches apart. The user inputs the distance from the sensor to the desired position of the projectile when the picture is taken. Based on the time it takes the projectile to travel those two inches between the sensors, a velocity for the projectile can be determined. Since bullets and other projectiles basically travel at a constant velocity, it is easy for the microcontroller to calculate the delay in microseconds until the picture is taken. I ran into a few gotchas in the software while I was writing it.

Needed to use digitalRead() with the sensors and not analogRead() (analog read is too slow at 100 us)

Used integer math because floating point math is very slow in Arduino

Had to be careful with my order of operations or I would overflow 32 bit unsigned integers in certain cases

I’m very pleased with the results. I’ve tested it with an airgun that travels at a relatively slow 500 ft/sec (half the speed of sound), but my calculations show that the Camera Axe’s 16 MHz ATmega168 chip can easily predict the position of a high speed riffle (several times the speed of sound) to within a fraction of an inch. I had known that this should work, but it was still amazing to see it working perfectly in the real world, considering all the micro fluctuations that I didn’t account for in the calculations. In the end, things like gravity, air resistance, and quantum forces just didn’t matter

[Update: Alan Sailer correctly pointed out the IR transistor I’m using only works at 15us, this would limit photos to around 2x the speed of sound, see the comments for options on faster transistor options.]

Updated Camera Axe source code to support this new sensor. One nice feature of the projectile code is that I print out the feet/sec or the cm/sec that the bullet was traveling. While this wasn’t needed for photography; it is still fun to see the numbers.

Updated user manual to include the software changes.

Using the Projectile Sensor with the Camera Axe

First, visually line up the IR LEDs to the IR transistors so that they are pointing at each other. Then just plug the 3.5mm cord from Sensor1 on the Camera Axe to Sensor1 on the projection board. Next do the same for sensor2. Plug a flash into Camera/Flash1 on the Camera Axe. Turn on the Camera Axe and go to the sensor menu. (Optional if you want to change from inches to centimeters press [Menu]+[Set]+[Left] while turning on the Camera Axe to enter the special menu to change from English units to Metric units.) In this menu you can set the distance from the sensor to where the projectile should be on the picture (0->999 cm/inch).

You can test your the projectile sensor’s set up by putting your finger in front of the first sensor. After one second a message will display saying that the “second trigger failed”. After this message goes away, put your hand in front of the second sensor and then your other hand in front of the first sensor. This will basically simulate an infinitely fast projectile and the Camera Axe will display the speed of a fast projectile (something more than 45 times the speed of sound).

This sensor should generally be placed at the end of the gun barrel so you don’t need to worry about the bullet hitting the circuit board or sensors. The bullet/projectile must pass through this sensor before it hits the target. In my setup I have everything firmly bolted to a table and trigger the gun with a string from a safe distance.

Pretty Pictures

Last but not least, here are a few of the pictures I took with this new sensor. Taking these pictures was possible with the Camera Axe before I had the projectile sensor using a microphone or a laser sensor, but it involved a lot of trial and error. With the projectile sensor, every picture is what I was shooting for (pun intended).

First, visually line up the IR LEDs to the IR transistors so that they are pointing at each other. Then just plug the 3.5mm cord from Sensor1 on the Camera Axe to Sensor1 on the projection board. Next do the same for sensor2. Plug a flash into Camera/Flash1 on the Camera Axe. Turn on the Camera Axe and go to the sensor menu. (Optional if you want to change from inches to centimeters press [Menu]+[Set]+[Left] while turning on the Camera Axe to enter the special menu to change from English units to Metric units.) In this menu you can set the distance from the sensor to where the projectile should be on the picture (0->999 cm/inch).

You can test your the projectile sensor’s set up by putting your finger in front of the first sensor. After one second a message will display saying that the “second trigger failed”. After this message goes away, put your hand in front of the second sensor and then your other hand in front of the first sensor. This will basically simulate an infinitely fast projectile and the Camera Axe will display the speed of a fast projectile (something more than 45 times the speed of sound).

41 Comments

mike said,

emilio said,

awesome! i’ll definitely be trying this out once i get some general microcontroller experience under my belt. it should easily capture some fat, shiny 900FPS .45 bullets.

now this begs the question: can it measure bullet speed? the cheapest commercial chronometers are around US$90-120, and the prices shoot up for data storage, printing, etc. a great project would be an accurate chronometer with data display and output to an SD card. these can be tricky devices to engineer, though, as the cheaper models perform poorly under some lighting conditions.

Maurice Ribble said,

Emilio, I actually display the bullet’s speed (in ft/sec or cm/sec) to the LCD for two seconds after the shot so the answer is yes it can measure and report a bullet’s speed. I haven’t tested this thing in harsh lighting conditions (my photos are always in a dark room), but I think it should do decent in most lighting conditions. The IR transistor I choose is very directional. If nothing else you could always put up a little light shielding to protect the transistor from outside light sources. I don’t plan to turn this into a logging chronometer, but it should be pretty easy for someone to take this hardware/software and adapt it for that use. If this happens please post a link. I’d love to see other uses for this project. Open source is great.

Maurice Ribble said,

Frollard is correct. Although the bullet passes more like an inch away from the sensor and not a few millimeters. Since this board is right next to the barrel I had no issues with hitting it. Your target can still be up to 999 inches (83 feet) away so you don’t have to worry about that being too close either. If being close to the board is really an issue then it would be trivial to add some wires to move the sensors farther away from the circuit board. The idea setup is having the gun, sensor and target all really close and firmly held in place. Then the gun could be triggered from a safe distance via a string. This is how I did my shots with the airgun.

alan sailer said,

By the way, in my own high speed work I found that the phototransistors were marginal. They are slow, about 15usec rise time. If your pellet is traveling at 800fps or greater, the resulting waveform looks like a triangle wave, not a clean pulse.

I found another Honeywell device, the SD5600 optoschmidt detector to be the cats meow. Rise and fall times are 10’s of nanoseconds, pulse is clean as a whistle. In fact, it was such a clean pulse that I can measure the pellet velocity with one detector. Length of pellet/pulse width.

Maurice Ribble said,

Alan, thanks for your input. I looked at the specs for the IR transistor I used and like you said it only works at 16us. This is going to be the limiting factor in this trigger. I agree the SD5600 looks much better for really high speed stuff. I’ve updated the article to point out this oversight I had. Thanks!

Anonymous said,

Maurice Ribble said,

Strachan, I started with a nice simple 2 inches, but decided to make this 200 hundredth inches when I started supporting the metric system. I suspect with some clever thinking you could get rid of the divides, but I don’t see the point. These divides happen outside the critical timing loop so a few extra cycles don’t matter much. The comment about FP in my article isn’t that critical as long as the conversions are delayed. I probably shouldn’t have mentioned it, but I’ll leave it there so these comments don’t confuse people reading an updated article.

[Edit: I’m not changing the above, but I was having a stupid moment and what I said is wrong. See below for the correction.]

Anonymous, the software can switch between metric and English units.

gmg said,

I’m curious about the kind of flash you’re using to get such crisp shots. When I use a Canon EZ430 in manual mode at the lowest setting (1/32) with my rig, I get blurring of the balloon edges as they peel back. Typical camera settings would be ASA 200-400, minimal aperture for best depth of field.

Any thoughts?

Strachan said,

I assume there are two “critical timing loops”: the first measures the time between beam breaks and computes the projectile velocity; the second waits for the projectile to cover the specified distance. The math is being done while the projectile is in flight, making the time consumed by those operations relevant.

If the sensor spacing is a power of two (256 x .01in, say), the velocity calculation can be implemented using a shift, which should be substantially faster than integer division. Also, the remainder from the division can be determined using a bitmask, and used to improve the accuracy of the flight-distance timing.

You’re obviously in a better position to tell whether this makes any difference in the real world, but it wouldn’t cost anything to try.

Maurice Ribble said,

I’m sorry for confusing you Strachan. You are correct. I was having one of my stupid moments.

I did some calculations and if something is traveling the speed of sound it takes 70 us to travel 1 inch. Since the ATmel is clocked at 16 MHZ it can do approximately 110 cycles in 70 us. I think it’s more realistic that the target would be more than 10 inches away which should give more than enough cycles for the division. I don’t know off the top of my head how the Arduino library breaks up a 32 bit division so I can’t easily calculate the clocks it uses for this operation. If this ever is a real problem then I I agree with you that changing the software to use a shift would be a good improvement.

Maurice Ribble said,

gmg, I sometimes see a little bluring with my 580ex at 1/32nd power, but I can go to 1/128th power and that is almost always crisp. You can google for something like “flash duration 430ex” and find out how long the different flash exposures are. With a little math you can then calculate how how fast an object can move before it starts to blur.

Maurice Ribble said,

This device has 3 pins and I’m not exactly sure without a little testing if it’s compatible with the boards I’ve done (if it is you’d just screw two of the pins into a single terminal). If someone knows for certain that’s how this would work it would be a great response. The IR frequency of these devices is not mentioned in the spec and they suggest using their IR emitters so you’d need to see if the IR emitters I suggested are compatible or if you need to use their emitters too.

Chris C said,

kyndal said,

shouldent take much to adapt the code to account for gravity.
and used for dropping things.. 😉
would be slightly better than my curent setup
which is time delay only, and highly depending on the initial speed and height of the target release..

/Rune Kyndal

Chris C said,

Kit arrived and built :-). Hoping for a test run in the next couple of days.

I have been getting used to the menu’s etc. But find that the technique you mention above for changing from inches to cm doesn’t work. Pressing those three keys and switching on just gets the Camera/Flash1 line up. Am I missing something?

Chris C

Maurice Ribble said,

Are you sure you’re holding down the menu, set, and left buttons when you turn on the power? Make sure you are firmly holding these buttons down when you turn on the power and you should enter the special menu where you can select centimeters. [Edit: The correct buttons are menu, set, and RIGHT. A mental block must have had me saying left.]

Maurice Ribble said,

Chris, I am sorry for the confusion. You are correct that it is [menu] + [set] + [right]. I don’t know why I kept saying left. I must have meant my other left 😉 I updated the user manual and my comment above so others hopefully don’t get confused like you did. Thanks for catching this bug in the documentation.

Maurice Ribble said,

Chris C said,

Any experience of using this with airgun pellets? I have had no joy triggering with a .177 or even a .22. I only seem able to line up enough to trigger the first sensor. I haven’t had much time admittedly and need to try some other mounting/set up options but was just wondering if anyone had any tips.

I made an alternative sensor with plastic tubing that slid over the barrel. But while dropping a small coin through the tube to test it triggered the axe, no joy on the gun. I’m assuming it is an alignment thing on that basis.

Do the sensors need to have the source completely blocked or just partially? A .177 may be simply too small if it is completely.

Chris C said,

Rune Kyndal said,

im working on a similar “ghetto” version,
based on IR LEDs and photo transistors from a couple of old logitech mice.
i have no specs on the transistors. so ill have to do some testing to figure
if they are up to the job.. (reaction speed, beam width, and projectile size tolerance.)

target range for this one. is an air-pellet gun 5mm projectiles
with exit velocity probably in the 300 – 400 m/sec range

/Rune Kyndal

Eric van Dee said,

to detect smaller objects you have to use multiple transmitters and receivers in parallel.
Since you have problems with the second detector you could use (for example) 4 transmitters and detectors with a slight vertical distance offset.

Maurice Ribble said,

This setup could trigger a camera at 1/8000 a second, but since most cameras have about a 50 ms (1/20th of a second) shutter lag you will always miss the shot. It’s only practical to use this with a flash in a dark room like I described in the article above.

HB said,

I see this article is about 3 years old. I am just getting into Arduino myself and am hoping to measure the speed of a .22-250 which is about 4000ft/s. Would your code be fast enough for that? I have been looking around to squeeze as much speed into the trigger and this is what I came up with:

HB said,

No, but its in the back of my mind. I have the program ready and two push buttons as the “sensors”. If I hold the second “sensor” and then press the first sensor, the fastest possible read, I get around 40,000 fps for max. speed. But an actual circuit with the sensors as Maurice said might limit that. The circuit I used was part of a project totally unrelated but I used it just to see what speeds we are limited to.