Measuring Projectile Velocity with CPLDs

Netduino Forum member “Spork” is an avid marksman who wanted to build a chronograph with higher velocity measurement capabilities and better resolution than commercially available offerings. His solution was to interface the CED M2 sensors to an Amani GTX which in turn hands the timing information to a Netduino for storage.

The basic idea is to use two optical sensors spaced some distance apart (say 2 feet) to measure the transit time of a projectile. When the first sensor fires, a timer starts. When the second sensor fires, the timer is stopped.

Since I wanted to cover a wide range of projectile velocities (about 30 fps to 8000 fps, which covers Nerf guns, archery, airsoft, pellet guns, pistols, rifles, and high power rifles) it seemed like a 4 MHz clock (I divided the GTX’s 64 MHz clock) and a 24 bit counter would be best. If my math is right, that 1/4 microsecond resolution should get a velocity reading that’s 99.9% accurate across the entire ridiculously-wide velocity range. Commercial products generally promise 99.5% but they require that the user select “high speed” or “low speed” mode (which I’m assuming selects a lower or higher speed clock).

Spork’s execution of the electronics package includes a Netduino, an Amani GTX, a Bluetooth Shield, and a custom PMod. He describes the lab-verification method needed prior to field testing:

I whipped up a schematic for the GTX that would dim out LEDs in a pattern that would approximate the shadows cast by passing projectiles. Then I bought a couple high brightness LEDs from Radio Shack and an OC1 Pmod from Digilent. The OC1 was plugged into the GTX and then connected to a 9V battery and the LEDs using a little green breadboard. Everything appears in the (kinda sloppy) photo below, but the GTX isn’t visible because I have a Bluetooth board stacked on top of it.

And what project is truly complete until you have fired 25 rifle rounds at it?

Finally got around to doing a real-world test of my Amani GTX based chronograph, yesterday. I fired 25 rounds from a rifle past the chronometer. All were detected and the velocities are more-or-less normally distributed around 2400 feet per second, as expected. Completely trouble-free.

Spork is a newcomer to programmable logic design, however was quick to learn Quartus II’s schematic entry tool to implement his design. In fact he laid out and simulated his design prior to actually purchasing hardware.

Since the Amani GTX is based on an Altera Max II CPLD, I used Altera’s free Quartus II and ModelSim tools for creating, testing, and deploying designs. I decided that the design would communicate back to the Netduino via serial, so I designed a simple asynchronous serial transmitter in Quartus, as part of the design. The pros will probably laugh at my design, but here’s what I did, just to give an idea of what it’s like to work in Quartus:

Spork discusses the reverse engineering effort:

The sensors have cables with stereo plugs and they pull “ring” from 5V to 0V when they detect a “significant” dip in light intensity. 9V goes to “tip” on both jacks and the pmod routes the two “rings” back to the GTX. I did add resistors (not in photo) to divide the 5V down to about 3V, but that’s it.
[sic]This is what I found inside the sensor. I didn’t try to reverse engineer it beyond figuring out what was connected to “tip” and “ring” and determining the input voltage accepted by the regulator labeled “LTGG”. There’s also an op amp (“OP291″), a light sensor, and a bunch of capacitors and resistors. Since the behavior of the sensor was clear enough on my cheap little DSO Nano ‘scope, I decided I didn’t need to understand the sensor circuitry, yet. I’ll figure it out if I ever decide to build my own.

The bottom line is that I’m now able to measure the time between sensor hits to about 1/4 uSec and those times are shuffled off to the Netduino via serial. It all works like a charm and if I ever decide that I want to use the Amani for some other project, I can reconfigure it with new application-specific logic. But I’ve got more to do with this project, first. For instance, I’m going to add Digilent’s PmodAD1 (12 bit ADC, shown below) and an Amani RAM daughterboard to solve a problem I originally raised in this thread. Should be able to measure the projectile transit times and log strain gauge data (at 1 million samples per second) simultaneously, on the Amani.

2 comments on “Measuring Projectile Velocity with CPLDs
  1. Pingback: Measuring projectiles with OpenChronometer - Hack a Day

  2. Pingback: Projectile measurement | Puisernu

Leave a Reply