Friday, November 12, 2010

Ballistic metrics on the cheap

Once upon a time I had nice home-made ballistic timer. You can see it here on the right. It ran on 5V. Once upon a time I plugged it into a 14V power supply. I no longer own a nice ballistic timer.

What I do own is a half-assed ballistic timer and a triggering oscilloscope. Here you can see the parallax USB oscilloscope. They're about $100 and probably one of the best buys a home electrical engineer can make.

I've got it hooked up to some infrared sensors (shown in the next pic). When the beam is broken the sensor makes a pulse that the scope can pick up. Setting up the scope every time, however, is kind of a bitch. There's a lot of clicking and getting things just right. When you're tuning an electromagnetic rifle, you'll need to take many shots in succession and this will slow you down.

My solution was to hack a microcontroller into doing it for me instead. The microcontroller also watches the sensors but it resets every time it sees a new round go through so there's not re-setting. And instead of having a nifty, highly accurate but click-drag heavy way of finding the distances between the pulses the microcontroller just counts off in binary on the lights that come mounted on it by default. All lights on means it's ready and waiting for a shot.

I didn't try real hard to calibrate it but the pulses come out to about 1ms per binary digit. When the gun is firing at full speed I'll have to reduce the wait time.

Here's the code:


void wait(int a, int b)
int i,j;
for(i = 0; i < a; i++)
for(j = 0; j < b; j++)

void count()
int time;
TRISD = 0x00;

//Check portc 0 going to high
//Check portc 1 going to high
//Show elapsed time

if( (PORTC & 0b00000001) > 0)
PORTD = 0b11001100;
time = 0;
while( (PORTC & 0b00000010) == 0)
PORTD = time;

void main()

No comments:

Post a Comment