Page 1 of 1

AT89S8253 based chronograph

Posted: Tue Jun 10, 2014 9:20 am
by FighterAce
Last week I've defended my graduation project and got an excellent mark so I guess now I can finally share this project with you.
It all started 6 months ago with me choosing the project "Microcontroller based projectile speed measurement". The first thing on the list was designing a frame that would hold two pairs of light sources and sensors at a precise distance from each other. After many design changes I've come up with this:

Image

It consists of 6 spacing elements (5,4), 4 mirror housings (3), 2 laser module housings(1) and 2 adjustable mirrors (6). It holds two pairs of mirrors perfectly parallel to each other so a laser beam could bounce a few dozen times inside the 20x30cm area. The angle of the laser beam can be adjusted, thus the number of reflections can be changed depending on the diameter of the projectile. The BPW-34 photodiodes are held in an adjustable fixture on the spacing element, below the laser module housings.

Image

For the project I chose AT89S8253 microcontroller since thats what we mostly used at school. Its running at 24MHz which gives me a time measurement resolution of 500ns. When the laser is directed onto the sensor, the photodiode output voltage is only about .4V which is not enough to set the microcontroller input to "1" so I had to use a LM319N high speed voltage comparator in a basic photo detector circuit. On its output I can get 3.5V when the laser is on the photodiode, and 0.8V when the laser beam is broken. This is just within specs for the AT89S8253 logic "0" and "1" voltage levels. It enabled me to program the microcontroller to check only two ports for the time measurement. Once the first laser beam is brkoen, the microcontroller starts a timer. When the second laser beam is broken, it stops the timer. Then it automatically calculates the speed v=0.3/t (sensors are .3m apart). After that it freezes the result for 1 sec so anything flying behind the projectile won't break the first laser beam and restart the measuring sequence, erasing the previous result. After that 1 sec the measurement can be repeated or the result can be displayed in fps or km/h. Power source is a Leoch hermetically sealed 12V lead acid battery regulated down to 5V with a LM317 voltage regulator.
Here is the inside of the control box:

Image

The two lasers and photodiodes mounted in the aluminum frame connect to the control box with a VGA cable. It has just enough wires to connect everything I need but unfortunately it left a mess inside. On the front of the control box there is a simple power switch. To the right of that is the 20x2 LCD. Under the LCD are two status LEDs. Once the front laser is directed onto the start photodiode, the left green LED will turn on. The same goes for the rear laser/stop photodiode and right LED.
On top of the control box are two buttons which allow for unit conversion. The default is m/s but pressing the appropriate button will display the speed in fps or km/h. This was the 10th measurement at 10 bar: (PS: "Brzina" is "Speed" in Croatian ;) )

Image

I don't have a commercial chronograph to compare the results but I did run a couple of tests. For the first test I've calculated the speed at which a .50 cal paintball will hit the ground after falling from a height of 1.8m. Its around 5.78m/s. Then I measured the speed of the same scenario with my chronograph. After 10 measurements the average measured speed was 5.85m/s which turned out to be an error of about 1%. Heres the setup:

Image

For the second test I've fired 10 .50 cal paintballs from my Barret 98b at a chamber pressure of 10 bar.

Image

The average measured speed was 178.53m/s. The only thing I could compare this to was GGDT. I'm just not 100% certain of the dead volume value since I didn't really measure the volume of the 5cm long safety switch between the barrel and QEV. Even if this value is incorrect by a fraction, the results are still surprising.

Image

GGDT estimates a speed of 178.6m/s which would mean the chronograph accuracy is 99.96%. I know that speed is just an estimate and I'm probably introducing an error with my inconsistent reading of the tiny pressure gauge and really cheap ammunition but these tests at least proved the chronograph is not spitting out complete nonsense. The real test will come when I get to compare it directly to a commercially made chronograph. The only problem is finding somebody willing to do the experiment.

Re: AT89S8253 based chronograph

Posted: Tue Jun 10, 2014 10:22 am
by POLAND_SPUD
Heh awesome build

Re: AT89S8253 based chronograph

Posted: Tue Jun 10, 2014 1:10 pm
by mobile chernobyl
Really cool!

I love the idea of bouncing the laser back and forth like that to essentially create a "plane" the projectile must pass through.

Now just for positive object identification so that particulate in the air/wadding doesn't through false positives when measuring muzzle velocity close to the barrel!

Re: AT89S8253 based chronograph

Posted: Tue Jun 10, 2014 2:55 pm
by wyz2285
Things like this make me wish I had learnt more about electronics... :cry:
Excellent, well done. Love the laser wall :thumbright:

Re: AT89S8253 based chronograph

Posted: Wed Jun 11, 2014 8:14 am
by jackssmirkingrevenge
Fantastic!

As part of this school project, I had to figure out how calculate velocity in the absence of a chrony, so with the help of my physics mentor came up with the system illustrated below (we happened to be covering capacitors at the time). The time across the two foil strips is calculated as follows:

time = resistance x capacitance x ln(voltage across resistors/initial battery voltage)

I never compared this system to a "proper" chrony but for the launcher being tested I got an average velocity of 30 metres per second which sounds about right.

Image

Re: AT89S8253 based chronograph

Posted: Wed Jun 25, 2014 6:28 pm
by jimmy101
Someday people will realize they have a high performance analog to digital system at their finger tips (literally) that can do everything a laser+uP or some caps+battery+DVM can do. And do it better. And usually without any external circuitry, or at most $5 worth of parts.

Every person that teaches math, physics, chemistry ... at the high school or college level needs to be retrained so that "laptop" is their first response any time a timing problem presents itself.

Re: AT89S8253 based chronograph

Posted: Thu Jul 03, 2014 1:09 pm
by FighterAce
Jack that really reminds me of the first ballistic chronograph designed by Kiryako Arvanetakis. I've had an entire segment about him in my presentation ;) Nice to see the design hasn't been forgotten, or perhaps reinvented?

Jimmy, the whole point of my graduation project was using the things I was taught during high school (PCB design, programming, analog circuits, machining, mechanical drafting, etc.) and applying them in a single project. Using a laptop to do all the work would make things too easy and probably wouldn't get me a silver medal from the Faculty of mechanical engineering and naval architecture inventors competition.

Re: AT89S8253 based chronograph

Posted: Tue Jul 08, 2014 6:31 pm
by jimmy101
FighterAce wrote:Jimmy, the whole point of my graduation project was using the things I was taught during high school (PCB design, programming, analog circuits, machining, mechanical drafting, etc.) and applying them in a single project. Using a laptop to do all the work would make things too easy and probably wouldn't get me a silver medal from the Faculty of mechanical engineering and naval architecture inventors competition.
Probably true, but as a potential employerthe laptop approach would have impressed me more.

Re: AT89S8253 based chronograph

Posted: Wed Mar 23, 2016 3:59 am
by tahirmaqsood
FighterAce
sir your project ; AT89S8253 based chronograph;
is very grat
sir i want make this project for cricket ball speed
plz send me code and schematic
thanks

Re: AT89S8253 based chronograph

Posted: Fri Mar 25, 2016 11:05 am
by FighterAce
Hey if you think you can reproduce this, go ahead. I couldn't find my last code with m/s to km/h and fps conversion so I'm posting the original one I submitted in paper.

Code: Select all

Dim A As Byte , Brojac As Word ,
Broj As Long , Ukup As Long , 
Time As Single , V As Single , 
Targ As Iram String * 6	

$crystal = 24000000				
Config Timer0 = Timer , 			
Gate = External , 				
Mode = 1				
On Timer0 Pot
Enable Timer0				
Enable Interrupts	
			
Config Lcd = 20 * 2				
Config Lcdbus = 4				
Config Lcdpin = Pin , 
Db7 = P1.4 , Db6 = P1.5 , 			
Db5 = P1.6 , Db4 = P1.7 ,
E = P2.1 , Rs = P2.0				
Cursor Off					

Prov:					
A = 0						
Counter0 = 0					
Cls						
Lcd " Brzina:"					
Locate 2 , 10					
Lcd Targ ; " m/s"				
Do
If P1.0 = 0 Then				
Goto Kreni					
End If						
Loop

Kreni:						
Start Timer0					
Do
If P1.1 = 0 Then				
Goto Stani					
End If						
Loop

Stani:						
Stop Timer0					
Brojac = Counter0
Goto Mat					
Pot:						
Incr A					
Return	
					
Mat:						
Do
Broj = 65535 * A				
Ukup = Broj + Brojac				
Time = Ukup / 2000000			
V = 0.3 / Time				
Targ = Fusing(v , #.##)		
Goto Prov:					
Loop

The electrical schematic is in the attachment. Good luck ;)

Re: AT89S8253 based chronograph

Posted: Sat Mar 26, 2016 9:15 am
by tahirmaqsood
bundle of thanks sir
plz say me how to you use compiler for this code
Thanks