Electronic – Sensor for detecting airsoft bullet

infraredphototransistorsensor

I'm trying to make airsoft chronograph/chronometer (a device that measures airsoft bullet speed). The idea is to measure time in which bullet is traveling from point A to point B, and then I can calculate bullet speed.

Bullet is shot into plastic pipe with diameter of 32mm. I've tried to put on one side IR LED and on the other side phototransistor (BPW 40), both at the start and end of the tube. Something like this:

enter image description here

Blue circles are phototransistors, red circles are IR LEDs and white circles are airsoft bullets.

When bullet passes through area where bullet 2 is drawn (just in between IR LED and phototransistor), everyting works perfectly. But when the bullet passes where bullets 1 and 3 are drawn, it isn't detected. That is expected, but unwanted behavior.

So my question is: how can I detect bullets regardlessly of it's position ? I've thought about putting IR LEDs and phototransistors around the pipe (not only in one place), like this:

enter image description here

but this solution isn't cheapest: 5 IR LEDs + 5 BPW 40 = cca $12 times 2 (because I need it on both sides of the pipe) = $24. Is there any cheaper solution ? Is BPW 40 good choice for phototransistor ? I don't know which IR LEDs I'm using (and salesman in the store also doesn't know – he told me these are generic ones for remote controllers, like TV or DVD controller).

Diameter of the pipe is 32mm and it will be long about 14cm (sensors will be 10cm apart).
Diameter of airsoft bullet is 6mm.

EDIT:

I'll go for my second idea. I just have one more question:
is it better to arrange IR emitters and photo transistors this way:

enter image description here

or this way:

enter image description here

Thanks !!

Best Answer

You don't need the BB to be centered between the emitter and detector

It may be possible to use the phototransistor as an analog sensor rather than a switch (which is what I suspect that you are currently doing). Even if your item does not fully block the light, it will change the light in the area of the pipe occupied Use your phototransistor to create avoltage, amplify or buffer if necessary, and send the output to a differentiating amplifier. This should generate a nonzero voltage whenever the light intensity changes. Assuming that your system is closed at both ends (and that your airsoft gun doesn't have a significant muzzle flash), this should only happen when a bullet is passing the area.

Some ideas from light curtains

Also consider that your problem is similar to the problem solved by light curtains, but on a smaller scale. It's especially similar in your last diagram, with multiple sensors. A few tricks could be borrowed from light curtains:

  • It's easier to design and assemble rectangular light curtains than other shapes. Assuming that you've designed your pipe to be large enough that airflow around the bullet isn't a problem, you could put boxes on the end of your pipe containing flat PCBs for mounting your emitters and detectors. This would be considerably easier and more robust than drilling holes in your pipe and running wires all over the place.
  • Your resolution can be increased significantly by scanning through your emitters and checking each of your detectors. This changes your scan pattern from a row of lines (which would then need to be <6mm apart) to lines between each detector and each emitter. You'll need to check that the pattern formed doesn't leave gaping holes, such as immediately adjacent to the emitters or detectors (though these can be removed simply by spacing the detectors and emitters further apart). Note that you'll need to scan pretty quickly; the limiting factor is probably your phototransistors with rise and fall times on the order of 10 microseconds. To escape detection, a 6mm object would need to be travelling at:

    \$ \frac{6~\mathrm{mm}}{10~\mathrm{{\mu}s}} \approx 2000 \mbox{ feet per second} \$

    which is, I hope, significantly faster than your airsoft gun is capable of.

One more issue about your source:

I don't know which IR LEDs I'm using (and salesman in the store also doesn't know - he told me these are generic ones for remote controllers, like TV or DVD controller).

No. Just no. Physical stores and real-life salespeople are only useful when (1) you're on a ridiculous time crunch and can't wait until the next day for your parts to come in the mail or (2) they add value to the product. You're not pressed for time, and your salesperson is clueless about the merchandise, so I strongly, strongly suggest you start looking at reputable online distributors like Mouser and Digikey which will provide datasheets and genuine parts.

Furthermore, your price quote of $12 for 5 IR emitters (note that LEDs only emit visible light so it's technically incorrect to call them IR LEDs, they're called "infrared emitters") and 5 phototransistors is ridiculous. IR emitters are about $0.15 each, and phototransistors are about $0.30 each, so you ought to be looking at $2.25 for your 5-piece setup. Note, too, that these price quotes are for small quantities of through-hole parts: If you're buying reels or using cheaper SMD parts, neither the LED nor the phototransistor should be more than $0.10.

Edit

To decide between the various possible configurations of emitters and detectors, draw lines-of-sight through each pair that you're going to check as shown here:

dense in center every other

The left one is more dense in the center, while the right uses a significant number of its lines-of-sight in checking the extreme periphery. Since you're not working with a safety-critical application like a light curtain where you can't afford to miss an object once in a while, and since your objects should be concentrated in the center (and give erroneous results if they hit the sides), I'd suggest the left one.

That said, both will be difficult to manufacture. I still suggest using a rectangular arrangement as shown here:

new version with PCBs

This diagram describes a top mainboard containing a microcontroller and connector for power, ground, and a pulse to be issued when an object is detected, with daughtercards mounted on right-angle connectors. This creates a 32/5 = 6.4mm spacing between emitter/detector pairs without checking diagonals, upping the count from 5 to 6 or 8 (which would be easy) would allow you to do a simple linear scan.

Consider that the circuits for the emitter and detector are basically identical (and low density/complexity), you could probably make all three of the boards physically identical and simply populate them differently to save money. For the motherboard, an SSOP or SOIC microcontroller on the top of the board, run I/O off both sides to 0.1" holes for a right-angle header. For the daughter cards, put a row of emitter/detector footprints (they're easy enough to find in mechanically identical packages, like the Kingbright APT2012F3C/AA3021P3S pair) and resistors on the bottom, and run the connections back to the headers. A few solder jumpers would suffice to make a board either type as shown in the following schematic, or you could get fancy and make one end of the board a connection for emitters and the other for detectors.

circuit

Again, I strongly suggest thinking hard about design for manufacturability at this stage! You don't want to end up with a bunch of components that you can't assemble reliably, especially if you have long lead times as indicated. A little effort invested early on can save a lot of effort later.

Edit #2: Schematic for proposed design

I used an ATtiny40 in this design, there are a variety of controllers which could be used. Sorry for the mess of nets around the outside, I'm trying out a neat new online editor (click the image to open it) which doesn't yet have busses.

enter image description here