About

This page contains a single entry from the blog posted on May 7, 2008 4:35 PM.

The previous post in this blog was Gadgets come alive at Maker Faire.

The next post in this blog is Super flashlight: When the humble torch just isn't enough.

Many more can be found on the main index page or by looking through the archives.

Sign up for the fortnightly Circuits eNewsletter. Get design ideas and circuit schematics straight to your email inbox, no fuss. Just tick the option for Circuits.

RSS Subscribe to this blog's feed
[What is this?]

Recent Comments

Archives

« Gadgets come alive at Maker Faire | Main | Super flashlight: When the humble torch just isn't enough »

Paintball System Exposed

Looking to paint the town red (or his friends at any rate), Nathan Loden devised this simple device to detect if the paintballs are travelling at a safe speed. Consisting of sensor circuitry and a microcontroller with a three digit, seven segment display driver, it detects the presence or absence of a ball by measuring the amount of IR energy striking the sensor, causing a voltage swing detectable by the micro. A timer is set to overload if the number of instruction cycles exceeds the limit, indicating safe shooting.

Paintball Safety System

This Gadget Freak originally appeared in Design News.

This safety system is designed for the casual paintball player to know if his paintballs are travelling at a safe speed (under 300 feet per second). This safety system is not intended to replace calibrated paintball chronographs used at tournaments and paintball fields.

The system can be divided into two major subsystems: the sensor circuitry and the microcontroller code.

The sensor circuitry uses the concept of “beam break” to trigger the microcontroller into action. The IR diodes are constantly on, saturating the phototransistors with IR energy. In this state, the voltage into the micro is about 0.1 V. When a paintball crosses in front of the IR diode, the amount of IR energy striking the sensor plummets. In this state, the voltage seen by the micro is 4.2 V. The voltage swing between the two states is enough to use digital inputs to the micro to distinguish between ball or no ball.

The microcontroller code was specifically written to avoid the use of interrupts and the A/D converter. Call me lazy, but I call it efficient.

The first interesting line of code (line 57 & 58) sets up GPIO2 and GPIO3 as inputs.

Timer 1 is initialized to 63869 or in hexadecimal F97C. This number is derived from a little math calculation. Note: My math is based upon the fact that my sensors are exactly 6 inches apart. Your sensors can be closer or further apart; you will have to adjust for that in your math. If your sensors are too close, you will lose resolution. If your sensors are too far apart, your paintball may not cross the path of your rear sensor.

Once the forward sensor is triggered, the PIC starts Timer 1 to count from 63868 up towards 65535 (FFFF in hexadecimal). The question we ask here is this: Does the timer overflow first or does the rear sensor get tripped? If the timer overflows, then the ball is going “so” slow that it took longer than 1.666 milliseconds to reach the rear sensor. That means the paintball is traveling less than 300 feet per second and is a “PASS”. If the rear sensor is tripped before the timer overflow, it is traveling faster than 300 feet per second and is a “FAIL”. The green LED is activated for a PASS and the red LED for a FAIL. The LED will stay on for two seconds and then the system is reset (both LEDs on) for the next paintball. The reason why both LEDs are on is to show that the safety system is working.

A word on the case. The type of material you use to mount the sensors is not critical, just use some common sense. A shoebox may work, but will it hold up to the abuse it will likely see? If you use a metal case, make sure you don’t short any of your leads to the box.

Room for improvement:

1. An external precision crystal will give more accuracy.
2. LCD display with table lookup for exact speed (For example: if your Timer1 value was FF00 when the rear sensor tripped, then its speed was 354 feet per second or 241 mph.)
3. Being able to count balls shot per second and save measurements.

Paintball%20safety%20system%20exposed.JPG

TrackBack

TrackBack URL for this entry:
http://www.electronicsweekly.com/cgi-bin/mt/mt-tb.cgi/26889

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)