Uzzors2k Banner

AVR ATTiny2313 VFD Chronograph
ATtiny2313 Ballistic Chronograph

A ballistic chronograph is used to detect the speed of a projectile shot through a sensor port. The simplest type of chronograph design is based on finding the average speed of the projectile between two ports. This is as easy as dividing the distance between the two sensor ports with time taken to travel between the ports. In practice this is done with by simply taking the time from sensor A triggers until sensor B triggers, assuming this to be the time the projectile spent traveling from sensor A to B. The distance between two sensors is assumed to be a constant value known with great accuracy. The speed can then be determined by the simple formula V = S / T. I've made two versions of the chronograph using different display technology. One uses a vacuum fluorescent display, while the other uses a more modern LED display, both of which were found in microwave ovens. The two displays I used differ from regular 7-segment LED modules by being divided into grids, rather than individual digit modules. A grid is basically a single 7-segment display unit used to show one digit. This means that the dot points and hour/minute separator are actually contained on their own grid, instead of being connected to each digit. The most recent model uses the LED display, and is programmed using WinAVR. The basic hardware and firmware is the same in both versions, with the only difference being in how the display is driven.

Schematic

The basic principle behind driving both the VFD and LED displays is multiplexing. Since the number of I/O pins is limited, you have to get creative in order to light up the entire display. Initially, it would appear to take 4 digits multiplied by 7 segments = 28 I/O lines to drive a four digit display. 32 lines if you want a dot point! However due to something known as persistence of vision, not all of the digits need to be on all of the time for the display to appear fully lit. This leaves room for switching one digit on at a time, and therby sharing the same data lines. Suddenly you only need 7 + 4 I/O lines to drive an entire four digit display! Since the displays I used were taken from microwave ovens, they were complete modules instead of individual digits. The dot points were shared by the a,b,c,d and g segments, so a separate dataline for the dot was not required. Instead another anode controller was needed. Changing the 7segment.h library for regular displays would only require that you alter how the dot is drawn, and reduce the number of grids to four. The basic hardware setup can remain the same.

In this design, a digit is lit by switching on a 2N3906 which provides current to the segment anodes in the digit. The ATtiny2313 then looks up which pattern to use, and inverts it. A dark segment is held high, and a bright segment is held low. The digit is held on for 1ms, before moving on to the next digit. Since there are 5 grids on this display, each digit is only for 20% of the time.

 

The display was mounted slightly inside the case to provide shielding from direct sunlight, doing so improves the contrast greatly. The sensor gate used to measure projectile speed isn't very high tech, and consists of two photogates mounted in some PP pipe. The LM393 circuit uses roughly 1000ns to respond to a signal change, and may present a significant source of error. If each comparator has an equal delay nothing is added to the error. If on the other hand, one comparator is faster than the other the difference will between the two will add to the total measurement error. I haven't looked into measuring the response time of the detector circuit, since the worst case total error (assuming one sensor triggers early, and the other late for example) is only 0,01% at 100m/s. Firing into a tube and hoping to break the beam isn't easy, even with a large projectile. For a future sensor gate, I've thought of making a setup similar to the one used in commercial chronographs. The idea is to use an IR LED to illuminate a strip high above the photodiode. The photodiode is of the narrow angle type, sensing in a long, thin line. The detection circuitry could consist of a high-pass filter and discrete amplifier, hopefully reducing delays. If anyone has made something clever like this, let me know!

Previous VFD Version

This project started with me finding two identical VFD displays while gutting a bunch of microwave ovens. Since both of the microwave oven display boards had a vacuum fluorescent display and mains transformer designed for driving the VFD they were ideal for a project. I was keen on using them for something, but without any immediate use I just put them in storage where they stayed for a year. Then after learning how to program in assembly for AVR and acquiring a discounted STK500 through my university, I thought I could put together an accurate speedtrap for an upcoming coil gun project. Note: This project has been superceded. If you want to use a VFD, take a look at my UV timer box to see the proper way of doing it. Using the circuit presented here does not drive the display with enough current, causing it to be very dim.

MO Display Board

VFDs are most common is Stereos, Microwave ovens and VCRs. They are actually tube devices and require a filament voltage and "high" anode voltage to function. Most commonly the filament runs at around 200mA or so, while the anode voltage required is between 15 and 30V. The filament produces a cloud of electrons like in any tube, and the voltage difference between the filament and anode accelerate electrons to the anode segments. Holding some segments at 0V and other at the anode voltage allow one to create digits. A VFD has several "grids" as well, which function as a switch between the anode and filament. To activate any of the segments in a VFD one or more of the grids must be brought to the anode voltage. This allows the electrons to flow from the hot filament to the anode segments, exciting the phosphors and giving light. So to write a digit to the display a grid must be selected, and then the correct anode segments must be selected. The pinout of a VFD is usually easy to find. The filaments will have pins on each end of the display, and the resistance across them should be 10 ohms or so. The grids can be found simply by looking at the grid and following the lead from under the glass out the the pins. The anode segments will have a schematic on the back, or they can be determined empirically. Given the strange voltage requirements of a VFD, a level-shifter must be used before interfacing with 5V logic chips. This can be built by simply using a few transistors and resistors.

VFD Lit up with TTL control board

So after some unsoldering, examination of the circuit board and probing I discovered the pin-out of the transformer and VFD. Shortly afterwards I had a 23V and 5V voltage source with filament supply, along with a 5V TTL compatible VFD. The next step was to make the actual detectors, which ended up just consisting of an IR LED/phototransistor pair and comparator setup. Each pair was mounted exactly 15cm from eachother in a 3cm diameter PVC tube. The IR LED and phototransistor are placed on the same side of the tube, so that a passing object increases the amount of IR detected by the phototransistor. Once the amount of detected light passes a certain threshold the sensor will comparator wil trigger.

Speed tube
 
After discovering the difficulty of something as simple as division in assembly, I chose to program in Basic instead given some past experience with basic for PICs. MikroBasic Pro from mikroElektronika was used for the programming.  The program itself is rather simple, with the most complex and process consuming portion being multiplexing the display. The program continuously takes the value in the speed variable and converts it to single digits. The digits are converted to a corresponding output pattern which is sent to the segment control pins (abcdefg) and the correct grid is chosen. The digits are then sent individually to the VFD, lighting one digit place at a time in quick succession, which is known as multiplexing. Due to presistance of vision the digits appear to be in one place the entire time. Interrupts on INT0 and 1 start and stop the timer respectively. The INT1 interrupt also takes care of calculating the speed. Timer 0 is used and setup for Compare Match mode at 240, which gives are period of 83.3kHz. This results in 12Ás increments in the counter value. On top of this, timer0 increments every 50ns amd is used to create a small decimal value when done timing, giving 50ns resolution. This is done by taking the value in the timer's register after it has finished counting, since this value will not have been sufficent to trigger an overflow, but still represents the recorded time. Currently it is coded it to read speeds from as low as 0.19m/s up to 99.99 m/s before the number of digits on the display run out. The precent error from 0.19 to 99.99 m/s should never exceed 0.01%. The chronograph starts up with 0.00 on the display, and will show the speed of a projectile immediately after detecting a shot. The last measured speed will stay on screen until the next shot, giving good time to read it. The program assumes the sensors are spaced 15.00 cm apart. How accurately you can manage to space the sensors will have an impact on the error of the measured speed.

Inside of chronograph box  completed chronograph
I left a little 4-pin connector sticking out the side for quick sensor replacement. That way mechanical or audio sensors, or another type of optical sensor can be swapped in place on the fly. The inputs are TLL compatible at 5V, and are trigger on a rising edge. The source code, schematic and a little calculator are provided for download. Modifying the code for regular LED 7-segment displays should be very easy using MikroBasic Pro. Remember to cut out the grid and segment code used for writing to the dot if you chose to do this! The circuit required for driving a LED display compared to the VFD will be significantly simpler too. But hey, you can't spell obsolete without 1337.


Comments





Youtube Flickr Twitter LinkedIn


Disclaimer: I do not take responsibility for any injury, death, hurt ego, or other forms of personal damage which may result from recreating these experiments. Projects are merely presented as a source of inspiration, and should only be conducted by responsible individuals, or under the supervision of responsible individuals. It is your own life, so proceed at your own risk! All projects are for noncommercial use only.


Creative Commons License This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.


830165 unique visitors since 28th July 2009.

Website layout by Elinor, and Eirik Taylor, 2016.