Archive for December, 2009

Photographing a Speeding Bullet

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.]

Below is a schematic of this new projectile sensor sensor and here are the Eagle files.

If you’re planning to build your own, then this is my parts list

Here is a list of updated files:

  • Updated Camera Axe label.  Nothing special here.
  • 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).

Comments (41)