Introduction: Automatic Stopwatch

Picture of Automatic Stopwatch


Objective of this project is to count the time taken by a climber to climb a wall. But it must be automatic i.e. climber doesn’t has to push a button to start the counter/timer and also he should not does any effort to stop the timer also.

Step 1: So How Are We Going to Do It????

We are going to use Arduino UNO to do the task. The Infrared sensors will sense the climber by its shadow. Sensors will be at the starting point of climbing. As the climber steps on the starting point the sensors will generate a signal and timer will start. Another pair of IR sensors will be placed at finish point. As the climber steps on the finsihing point this pair will generate an interrupt which will stop the timer. The time will be displayed on a 16x2 LCD.

Step 2: Why Use Arduino UNO:-

The built-in libray of liquid crystal display makes it easy for the programmer to control the display of the LCD. The library(LiquidCrystal.h) greatly reduces the amount of code a programmer has to write. Also we don’t have to worry about the limit to which a seven segment can display , in case of 7 segment displays.

Step 3: What Do We Need???

I. Arduino UNO board
II. A pair of infrared sensors

III. An LCD (A 14 pin LCD will work great)

IV. Couple of jumper wires

V. A 5-12V battery

Step 4: Circuit

Picture of Circuit

When all of this stuff is in your bag, just build the circuit as shown in simulation.

I've used push buttons instead of IR sensors cuz them push buttons can do the task.

Step 5: Arduino Code

Picture of Arduino Code

This stopwatch display time in the format hours:minutes:seconds:milliseconds

Below is the code you need to "verify" in Arduino 1.6.6 and upload in the arduino simulation

#include

const byte interruptPin2 = 2;

const byte interruptPin3 = 3;

int state;

int count;

int initial;

int minute;

int seconds;

int hours;

LiquidCrystal lcd(12,11,7,6,5,4);

void setup() {

pinMode(interruptPin2,INPUT_PULLUP);

pinMode(interruptPin3,INPUT_PULLUP);

attachInterrupt(digitalPinToInterrupt(interruptPin2), start, FALLING);

attachInterrupt(digitalPinToInterrupt(interruptPin3), stop1, FALLING);

// set up the LCD's number of columns and rows:

lcd.begin(16, 2);

lcd.setCursor(1,0);

lcd.print("Time elapsed:");

lcd.setCursor(3,1);

lcd.print(":");

lcd.setCursor(7,1);

lcd.print(":");

lcd.setCursor(11,1);

lcd.print(":");

}

void loop() {

initial=millis();

seconds=0;minute=0;hours=0;

while(state){

count=(int)((millis()-initial));

if(count>999){

initial+=1000;

seconds++;

if(seconds>59){

seconds=00;

lcd.setCursor(9,1);

lcd.print(" ");

minute++;

if(minute>59){

minute=0;

lcd.setCursor(5,1);

lcd.print(" ");

hours++;

}

}

}

lcd.setCursor(0,1);

lcd.print(hours);

lcd.setCursor(4,1);

lcd.print(minute);

lcd.setCursor(8,1);

lcd.print(seconds);

lcd.setCursor(12,1);

lcd.print(count);

}}

void start(){

state = 1;

}

void stop1(){

state = 0;

}

Comments

seamster (author)2016-05-19

This is a neat idea. Have you built an actual watch and tested it with a climber?

This sounds similar to the system that some foot race organizers use to time the runners (I think it's basically an RFID chip you clip to your shoe). Interesting stuff :)

JibranE (author)seamster2016-05-19

yeah i've built the watch... it wasnt available at the time when i was writing this instructable so i couldnt include the picture of it...

About This Instructable

1,047views

15favorites

License:

More by JibranE:Automatic Stopwatch
Add instructable to: