# Bullet Speed Sensor (but there is something Strange)

Hi every one

im trying to make device using arduino mega or UNO to measure the speed of bullet by using Projectile Sensor From Camera Axe

http://www.dreamingrobots.com/store/index.php?main_page=product_info&cPath=1&products_id=17&zenid=hCNxhrsXzlC1egM0VFUvi1

i download the source code for this sensor to use it in Arduino

but if find something unable to understand

if you go to arduino refrence to read the function of programming language you will see

Time (function)

millis()
micros()
delay()
delayMicroseconds()

the function used to start timer in arduino in milli and micro

http://www.cameraaxe.com/files/ca5/cameraAxe55.zip

and read it you will see

@@@@@@@@@@@@@

if (inchCm == 0)
distanceBetweenSensors = 200; // Distance between sensors is 2.00 inches
else
distanceBetweenSensors = 508; // Distance between sensors is 2.00 inches (or 5.08 cm)

startNanoSec();

{
unsigned long startTime;
unsigned long endTime;
unsigned long impactTime;

if (readSensorDigitalFast(0) == lowHigh) // If sensor1 detects projectile
{
startTime = nanoSec();

// Look for sensor2 to detect projectile

@@@@@@@@@@@@@@@@@@@

i search in internet
the arduino cant calculate the time in nanosecond so how this person could use ARDUINO UNO R3 to calculate the Time From Sensor Signal

and can some one explain this code in menu01_projectile.ino how it work

The nanoSec() function is defined in cameraAxe_helperFuncs.ino.

``````////////////////////////////////////////
// Function: nanoSec -  Returns the nanosecond count (similar to micro, but more precission and 4 times faster)
// Parameters:
//   None
// Returns:
//   Number of micros seconds in timer0
////////////////////////////////////////
extern volatile unsigned long timer0_overflow_count;
unsigned long nanoSec()
{
return (((timer0_overflow_count << 8) + TCNT0)*500);
}
``````

is mathematics that is that mean

``````extern volatile unsigned long timer0_overflow_count;
unsigned long nanoSec()
{
return (((timer0_overflow_count << 8) + TCNT0)*500);
}
``````

and why we need to do this

The "<<" part is a bit shift. The BitMath tutorial is very good at explaining this; certainly worth the time to read it and understand it.

The TCNT0 part is the timer/counter register. That's a bit advanced, but you can here's a good tutorial on AVR timers.

Suffice it to say that that the purpose of their method of timing is just a lot of optimization of code to make the CameraAxe as efficient as possible in its timing.

thank you i understand

there is two question

can i connect the Projectile Sensor

http://www.dreamingrobots.com/store/index.php?main_page=product_info&cPath=1&products_id=17&zenid=hCNxhrsXzlC1egM0VFUvi1

directly to arduino input digital pin with out use the Camera Axe 5 Shield

http://www.cameraaxe.com/builders-guide/

and the second question is

why we need this chips when we build the Camera Axe 5 Shield

LTV-847 Optoisolator (Left)74hc4050 Buffer Chip (Right)

the chips in this URL also http://www.cameraaxe.com/builders-guide/

thank you very much

my regards

Haider92:
thank you i understand

there is two question

can i connect the Projectile Sensor

http://www.dreamingrobots.com/store/index.php?main_page=product_info&cPath=1&products_id=17&zenid=hCNxhrsXzlC1egM0VFUvi1

directly to arduino input digital pin with out use the Camera Axe 5 Shield

Yes you could, but then the burden of making it work would be up to you. The Camera Axe makes use of special software to calculate the timing accurately. Normally the digitalRead method is too slow for accurate timing, as is the micros() function. The Camera Axe library has special methods that provide very fast-responding digital read, as well as nanosecond timing information.

Dreaming Robots – Fiber Tools for Fiber Lovers

and the second question is

why we need this chips when we build the Camera Axe 5 Shield

LTV-847 Optoisolator (Left)74hc4050 Buffer Chip (Right)

the chips in this URL also Dreaming Robots – Fiber Tools for Fiber Lovers

The Optoisolator chip provides electrical isolation between inputs and outputs. Internally it uses an LED and a phototransistor to decouple the input from the output. It protects the camera axe from the high voltages sometimes present in cameras and especially in flashes. (Some older flashes put as much as 300 volts through their sync terminals.) The Optoisolator also serves to protect the Camera Axe from those high voltages.

I'm not sure what the 4050 buffer chip is used for. I'd have to look at the schematic to be sure. It is a TTL driver, so it outputs more current than CMOS, and may be used to drive higher power components in a circuit. It will also serve as a voltage translator and signal cleanup. It can convert slow-rising input signals to square wave, and input voltages of 3 to 15 VDC to the supply voltage (usually +5VDC)

thank you very much

my regards