Sensor for detecting airsoft bullet

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:

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:

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:

or this way:

Thanks !!

• How large are the bullets you measure? I'm going to do a similar project and I need to detect 4.5mm bullets at speeds up to 400 m/s. I mean, are the sensors going to be sensitive enough? – andr Apr 11 '12 at 10:03
• @andr: Diameter of airsoft bullet is 6mm. I think sensors will be sensitive enough for you bullet, but you'll know for sure after you try it :) If there are some dead spots, you can put more IR emitters and detectors (I have 5+5, you can use 7+7 or more). As for max. speed, it depends on length of your pipe, timer resolution and acceptable error. – xx77aBs Apr 14 '12 at 10:35

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.

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: 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: 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. 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. • Thank you for your response ! After I've read that these prices are ridiculous, I've started looking for various sites that would ship to Croatia. I'm from Croatia, and all stores in Croatia (that have web shop or are accessible to me by means of personal transportation) have this high prices ... Anyway, I've found that there are cheap IR emitters on ebay, but unfortunately items ordered from ebay usually take about 20-30 days to arrive. I've also found this shop: taydaelectronics.com and I think I'll order what I need from them. Shipping is only$2, and prices are great ! – xx77aBs Mar 25 '12 at 18:35
• That said, I'll try to construct my second design (5 IR emitters and 5 photo transistors). I just have one more question (I've added it to bottom of my original question) - please tell me which way is better. Thanks !!!! – xx77aBs Mar 25 '12 at 18:38
• @xx77aBs - Digikey (one of the top distributors of electronics) has a Croatian storefront: hr.digikey.com Arrow Europe also has a Central region which ships to you. Electronics manufacturers in Croatia (I assume that you have electronics manufacturers in your country!) don't buy from Ebay or the shop down the street... – Kevin Vermeer Mar 26 '12 at 19:55
• Thanks! I've looked at digikey, but they say that they have fixed shipping price (12USD) !!! That's just too much ... I will look into Arrow Electronics, thanks ! As for manufacturing the parts, I've already drilled necessary holes on the pipe, so I don't expect any problems there. if there will be some problems, I'll go with rectangular arrangement just like you've suggested ;) Thank you again, you've helped me very much :) – xx77aBs Mar 27 '12 at 8:41
• I've forgot to mention that I'm not using SMD parts, I'm using through-hole parts (mainly because I'm using ready made PCBs). I just don't have equipment to make my own PCBs, so this way is right now easier. – xx77aBs Mar 27 '12 at 8:54

One method which might end up cheaper and simpler is to use a laser. As Kevin said, it's easier to make a light curtain in a rectangular tube than in a round one. Make the insides of the tube reflective, either by gluing mirrors inside, or by super polishing them. Then aim a laser through a hole in the tube so that it bounces around multiple times before hitting the phototransistor. As long as there are no holes big enough for the ball the pass through, then you're guaranteed to detect it (You might need more bounces in the circular case than I've drawn).

Another sensing method, which is closer to what you're using now is to invert things. Rather than the LEDs shining on the phototransistors, and the ball cutting out the signal, why not arrange it so that the phototransistors detect light reflected from the ball?

Arrange the LEDs so that there is no light shining on the phototransistors. Make the LEDs very bright. When the ball passes the LEDs, it glows brightly under the illunination, and a small signal is detected at the phototransistors.

• These two ideas are super-creative. +1 ! – boardbite Sep 11 '12 at 16:45

So far most of the detectors suggested in this thread appear to operate in the digital domain, requiring the bullet to obstruct the light beam sufficiently to trigger a digital output. Since the emitter and detector maybe arranged either to detect a pulse of reflected light from the passing bullet or its shadow. I suggest that the photo detector should be analogue in operation, working below saturation level and AC coupled to an OOK Op-Amp detector.

The advantage of using an OOK detector is that background noise is filtered to provide the bias level for the threshold detector comparator, making the detector very sensitive to small changes in input signal. Any sudden small change in light level above the background level triggers a digital output. By careful selection of the time constants of the input high pass filter and the bias low pass filter, it should be possible to tailor the overall detector response to the signature of the light change associated with the passing projectile, filtering out most of the background noise resulting from slow changes in the ambient light level.

Thus the high gain of the detector could then be used to convert a slight change in light level into the required digital pulse. I suggest that the first step in building such a system would be to experiment by connect an ac coupled oscilloscope to a photo-transistor wired in a follower configuration and investigate the best position arrangement of emitter LED and photo-detector in the tube that produces the greatest signal from either reflection or shadow from the passing bullet.

Without knowing the IR albedo of both the projectile and the interior wall of the tube it is not possible to recommend which arrangement will produce the best results. I suspect that the greatest signal to noise ratio might be obtained from detecting the back scattered flash of light off the passing bullet, but this requires the albedo of the tube to be very low and that of the bullet to be high.

I suggest that both the emitter and receiver should be selected to have the widest view angle, the object being to produce a fan of light across the tube, to maximise the detection area. Common sense indicates that the greater the ration of the projectile cross section to that of the tube, the higher the signal to noise ratio the shadow will produced.

The function of the tube is to reduce as much as possible the effects of ambient light on the detector. Provided the light from the IR emitter dominates, it should be possible to adjust the IR emitters output to bias the detector into its most sensitive linear region of operation, the point of greatest slope on the detectors response curve.

A further improvement in the detectors speed, sensitivity and noise rejection performance may be obtained by replacing the simple photo-transistor with a photo-diode, such as a BPX65 and a high speed OP-Amp. There are a number of circuits that use voltage feedback to maintain the DC bias voltage across the photo diode constant. This increases the detector speed, as the photo-current is not used to charge the diodes internal capacitance. Such circuits are commonly used by radio amateurs who are exploring long range, line of sight, optical communication using small amplitude modulation of LED light by a low IF modulated, sub-carrier. In this case the AM modulation index is usually less than 10%, typically 5%. This I suspect is similar to the AM signal that might be expected to be produced by a passing bullet, but only experimentation can confirm this.

Thinking about the optimum optical arrangement for the detector and the emitter. I believe that the detector and emitter light should be collimated to produce a parallel beam across the tube. This might be achieved by placing the detector and emitter at the opposite focal points, of facing parabolic reflectors. This should result in both a crossing and a parallel beam of IR light crossing the tube centre line.

Since it is impractical to shape the tube into the required parabolic profile, such an arrangement might be produced inserting two thick plastic sheet, shaped with a parabolic reflector edge profile into the opposite side walls of the tube, via slits cut into the tube wall. The parabolic shaped edge of the inserts being covered with Fablon mirror reflective tape. The required parabolic profile could be produced by printing the required curve on laser printer paper and transferring this to say half inch thick uPVC plastic sheet as a stencil mark for cutting. How much of an improvement this ideal optical arrangement offers over just using the circular profile of the tube is the subject for experiment or detailed calculation.

Perhaps multiple leds pointing at one phototransister might be detectable and reduce the dead zone.

Time to do some exerimenting! Also a bench rest to ensure you are always in the sweet spot might be worth looking at.

• I'm not sure if multiple leds are good idea - there's a chance that bullet won't block all IR light from photo transistor - if that happens, bullet won't be detected. But thanks for idea ;) – xx77aBs Mar 25 '12 at 18:27
• Aye, I think you'd be looking for multiple phototransistors and a single led – CoderTao Mar 25 '12 at 18:50

Just to extend the answor allitle. There is an app for windows phone users Wp7. Wp 7.5 Wp7.8 and Wp8. This app is called CronoPhone (Not chrono but without the "h") it's a great airsoft app with calculaters and stuf...

But it alsow has a detailed guide that describes just how to make the chronograph harware you are taking about .. In adition it has software where it uses the phone microphone sampler to find the analog spikes from the recivers... And then calculates the MpS of the bullet. If you want FPS use the calculater in the app ...

Hope i helps. Remeber it's called CronoPhone (without the "h" in Chrono) ...