Introduction: LED Laser -> Photo Resistor=timer

This project was designed to track how long it takes something (In our experiment it is a hockey puck) to get from point A through point B. Point A is the first LED Laser that is wired  through a 2x4 board and shines directly onto the photo resistor at the other 2x4. Point B is a little ways down the first plank also, it is another LED Laser that is doing the same thing as the first point.

When the photo resistor gets blacked out(when the puck passes through it for the brief moment) the timer begins and the timer  doesn't  
stop until the other laser and photo resistor get blacked out for a brief moment also, recording the time in the serial monitor. 

Step 1: Code

int ledPin = 13;                    // select the pin for the LED
int ledPin1 = 11;
int val = 0;                        // variable to store the value coming from the sensor
int val1 = 0;
int potPin = 5;
int potPin1 = 4;
float startTime;
float elapsedTime;
void setup() {
  pinMode(ledPin, OUTPUT);          // declare the ledPin as an OUTPUT
  pinMode(ledPin1, OUTPUT);
  Serial.begin (9600);
}

void loop() {
  digitalWrite (ledPin, HIGH);
  digitalWrite (ledPin1, HIGH);
  val = analogRead(potPin);    // read the value from the sensor
//  Serial.print ("Value = ");   // report the text "Value = "
//  Serial.println (val);        // report val, the number from the analogRead.

  val1 = analogRead(potPin1);
//  Serial.print ("Value2 = ");
//  Serial.println (val1);

if (val <= 830) {
  (startTime = millis());
}
if (val1 <= 830){
  elapsedTime = millis() - startTime;
 
  Serial.print((elapsedTime/1000));
  Serial.println(".");
}
delay(1);
}

Step 2: Drilling/Building

-In order to create stability in our structure, we drilled 2 screws into each end of the top 2x4 plank, directly into the other 2x4 planks on either side. 
- Used a standard drill with a corresponding drill bit size to get the correct sizing for our LED Laser to go directly in without any extra room or lack of room. Turned our LED on and marked where the lasers hit on the corresponding plank and then went and used a smaller drill bit for the photo resistor so that it could be tightly fit inside the hole and it wouldn't have too much excess light determining the "black out" that causes it to time. 

Step 3: Arduino

This is where the arduino is currently. 
In the process of making it more simplified, so that we have a basic timer set up on the 2x4 that shows us our final time, and clean it up overall so there are not so many wires. 

Step 4: Final Side, LED

Final side of the board completed, screws in tact, and arduino lain neatly across the other board. The LED can be seen being put into the drilled hole so that it shoots across to the other side. 

Step 5:

The first picture is the LED hitting the other side of the board.
The second picture is the LED going  through the hole for the photo resistor and coming out the other end cleanly.
The LED won't go through the other board when the photo resistor is placed in the corresponding hole. 

Step 6: Further Explained

We are using this project as a way to travel how long it takes a hockey puck, when shot, to get from point A to point B. In a further expansion of this project the arduino will be replaced and a timer will be placed along the top plank allowing the time to be displayed each time the program is triggered.

Also, there is potential for expansion in this project by making the boards longer and making the lights further and further away and possible accuracy competitions can use something like this. When I say an accuracy competition can use something like this, I mean it will trigger when the first target is hit and then it will stop the timing when the final target has been registered.