Introduction: Chronograph for Air Cannon
This chronograph project consists of a sensor assembly and timer circuit box that can be used to measure the muzzle velocity of a projectile fired from an air cannon.
I originally built this setup for use with a large air cannon with a 3" bore.
The sensor assembly is attached to the end of the air cannon barrel. It contains infrared sensors used to detect the passage of the projectile. A microprocessor measures the time it takes for a projectile to travel a known distance and displays it on an LCD. From this information, the velocity can be easily calculated.
Step 1: Overview of Operation
Below is a block diagram of the timer box and sensor assembly system. The sensor assembly is shown at the bottom of the diagram, with a round projectile traveling through it. The functional blocks within the grey box are located on the PCB. The switches, connectors, and LCD module are mounted on the case of the timer box.
The sensor assembly consists of a length of 3” diameter PVC pipe, with the two IR sensor pairs mounted 6 inches apart. The sensor assembly has a threaded fitting on one end, which allows it to be easily connected to another threaded fitting on the end of the barrel.
The timing circuit initially monitors the first sensor, waiting to detect that the beam has been broken by the projectile. After the first beam is broken, the processor starts an internal timer to record the time that has elapsed since the beam was broken. The software then begins monitoring the second sensor. When that beam is broken, the timer will be stopped. The processor then displays the time elapsed between the breaking of the beams on the LCD.
Step 2: Circuit Description
The schematic for the timer and sensor set up is shown below. A brief description of the function of each componenent is as follows.
U4 is a 5 volt regulator used to produce the regulated 5 volt “VDD” supply for the microprocessor. C1 and C2 are input filter capacitors for U4, used to stabilize the input voltage. C4 is an output filter capacitor for regulator U4, used to stabilize the output voltage. LED1 is a “power on” indicator, and R43 limits the current through LED2.
The microprocessor U1 monitors the two sensors, measures the time elapsed between the breaking of the two sensors, and configures the results for display on the LCD module. C14 is the bypass capacitor for the VDD input of the microprocessor.
A reset switch is included, so the program can be restarted for another measurement without having to remove power to the circuit. R12 keeps the reset input of the microprocessor pulled high when the button is not pressed. R11 and C16 form a low pass filter to keep the microprocessor from being reset due to electrical noise. C17 is to arrest any ESD spikes that may come in on the switch lines. J5 is the connector for the SPST momentary reset switch on the front panel.
LED1 is a general purpose indicator that is mounted on the front panel. It can be used to provide feedback to the user to indicate any conditions that might be necessary. R15 is the current limiting resistor for LED2
Each sensor pair consists of an infrared LED and a phototransistor. The pair is mounted so that the light from the LED shines across the pipe to the phototransistor on the other side. When the phototransistor is illuminated by the LED, it is “ON” and it pulls its collector low. When the beam is broken and the phototransistor is no longer illuminated, it turns “OFF” and its collector is pulled high by the pull up resistor on the PCB.
IR LED Drive
The IR LEDs themselves are located on the sensor assembly. The microprocessor can turn each IR LED on or off. Once both the sensors have tripped, there is no longer a need for the LEDs to be illuminated, so they are shut off at that point. This is not strictly necessary, but since the unit is battery powered this feature was included to extend battery life.
R38 and R30 are current limiting resistors for the two infrared LEDs. Q1 and Q2 are used to turn the LEDs on or off. R6 and R8 are pull down resistors o the gates of Q1 and Q2, to keep them off when the microprocessor pins are floating during reset. R7 and R9 are not strictly necessary, but they are included here to limit any problems with ringing on the gate when the FETs are turned on or off. They can be replaced with jumper wires if there are no problems with ringing.
IR Phototransistor Inputs
The phototransistors themselves are located on the sensor assembly. When the IR LED is on and the beam is not obstructed, the microprocessor will read the input as low. When the beam is broken, the phototransistor turns off and a pull up resistor on the PCB pulls the microprocessors input high.
Connector J4 is the connection to the collectors of the two phototransistor sensors. R20 and R24 are the pull up resistors that pull the input to the microprocessor high when the phototransistor is off , such as when the beam is broken. R19/C20 and R23/C22 are low pass filters on the sensor inputs used to remove any false triggering due to noise.
The timing results are displayed on a 20 X 4 character LCD. This kind of LCD is used to display character data only. The interface is parallel, and it can be configured for either 4 bit or 8 bit. The 4 bit mode was used, so that fewer IO pins of the microprocessor are needed. In addition to the 4 data lines, there is a line called RS and another called E that are part of the process of sending commands or data to the LCD.
A potentiometer, R10, is used to control the contrast of the LCD. C15 is a bypass capacitor on the VDD pins of the LCD module.
Step 3: Construction
Timing Circuit and PCB
The circuit was constructed on a custom PCB. It was laid out using the free layout tool from expressPCB. The board was ordered per expressPCB’s mini board service.
The timing circuit PCB, LCD module, reset switch, power switch, and interface connectors are built into a small aluminum enclosure. The two IR switches on the sensor assembly connect to the unit via 9 pin D-sub connectors.
The sensor assembly is constructed out of a short length of 3” diameter PVC pipe. There is a female threaded fitting on the sensor assembly, and there must be a male threaded fitting on the end of the barrel to make the attachment. Refer to the pictures below.
The two LED/phototransistor pairs are located 6 inches apart. The pair nearest the muzzle end of the assembly can be seen in one of the pictures below.
The LEDs and phototransistor are mounted in holes drilled in the side of the pipe. Care must be taken to get the pair aligned properly. The axis of the LED and the corresponding phototransistor should both lie on a line through the diameter of the pipe. The LEDs and phototransistors must not protrude into the inside of the pipe, or they will be destroyed by the projectile. They are secured in place with hot glue.
The last picture shows another sensor assembly, for an air cannon with a 1.5” diameter barrel. It is essentially the same in concept as the 3” diameter sensor.
Step 4: Software
The software was written in assembly using Microchip's MPASM tool, which can be downloaded for free from their website.
The source code *.asm file and assembled *.hex file for programming are attached. Also included is a high level flowchart of the main program.
The microprocessor used is a PIC16F628A. The microprocessor runs on its own internal 4 MHz clock. The internal instruction cycles therefore take 1 microsecond each.
The program turns an internal timer on when the first beam is broken. The internal timer (timer 0 on this PIC processor) counts up at a rate of one count per instruction cycle. When the second beam is broken, the program turns off the counter. Timer 0 is only 8 bits, and so it overflows every 256 counts, or every 256 microseconds. The software checks for overflows, and increments another variable each time an overflow occurs, If that variable overflows (after 65536 instructions cycles), then another variable is incremented. In this manner, a 24 bit count of the number of instruction cycles that have occured since the breaking of the first beam is generated. Since an instruction cycle takes 1 microsecond, the count is in microseconds.
If the count overflows the second variable, the program ends and displays a time out message.
24 bits can store a value of 16777215 counts, so the timer can measure an interval between events of as much as 16.78 seconds.
If the second beam is broken before the maximum time has elapsed, the program then proceeds to convert the 24 bit binary count into 8 ASCII decimal digits that are then displayed on the LCD.
When the unit is first power up or reset, an intro screen will appear on the LCD for about 1 second. Afterward, it will display a prompt screen, reading "WAITING FOR START". It will continue to display this message until after the second beam is broken (throughout the interval between the breaking of the two beams). After the second beam is broken, the results are then displayed as XXXXXXXX MICROSECONDS. This message is displayed until the reset button is pressed or the power to the unit is cycled off and on again.
If the count exceeds the maximum, the message "COUNT OVERFLOW" will be displayed until a reset or power cycle occurs.
Step 5: Results
This chonograph was originally built for use with a 3” diameter air cannon.
The cannon was test fired with the tank pressured to approximately 50 PSI. A standard baseball was used as a projectile. The timer results from several such firings were in the range of 2400 microseconds. The sensor pairs on the 3" sensor assembly shown earlier are located 6 inches apart, so this translates to a muzzle velocity of approximately 140 miles per hour.
Step 6: Other Uses
The timer circuit box can be used for other purposes beside a chronograph. It can be used to measure the time interval between any two events, where a switch opens for each event. Any kind of switches that change from closed to open when the event occurs can be connected in place of the phototransistors. This would include mechanical switches, relays, and reed switches, as well as semiconductor devices like transistors, Hall effect sensors, etc.
We have a be nice policy.
Please be positive and constructive.