Go Down

Topic: Feedback on multi-gates chrono (Read 154 times) previous topic - next topic

CronosVirus00

Jun 14, 2018, 04:02 pm Last Edit: Jun 14, 2018, 04:53 pm by CronosVirus00
Hi all,

I would like your feedback on my multi-gates chronometer.

The idea beyond this project is to have the ability to measure an athletic performance at different intervals, for instance a sprinter running 100m and getting the split times every 20m or performing  repeated sprints test.

HARDWARE


First of all, I wanted it to be wireless as having cables around for +100m is not really practical. I used HC-12 modules as they have a theoretical range of over 1000m; more than enough for my purpose.
Regarding microchips, I got attiny84; they are easy to program with arduino.
Last but not least, how to detect the runner crossing the gate. At the beginning, I thought about laser gates: when the athlete breaks the beam, I get the time stamp. The same goes for using IR beams; however, it has a downside.
I needed to use two stands (or mounts), one for the laser and the other one for the photoresistor; moreover, you need to be very precise when setting this up, as the laser needs to hit directly the photoresistor.
I solved the problem using a proximity sensor, E18-D80NK; this sensor works up to 80 cm. Therefore, athletes need to pass by fairly close ( still far enough to be safe) to the sensor to get the time stamp. In this way, I can use only one mount per gate (so, is not technically a "gate")
Then I bought PCBs and soldered everything together. Here the results:   Picture 2

I added a switch to turn it on and off and a led to see when the device is on; I'm using an usb power bank to operate every gate.

Regarding the "receiver", I'm simply using an arduino nano connected to the HC-12 module.


SOFTWARE (gates)

I wanted something extremely versatile, that can be used for other purposes rather than just for time gates (for instance, games where you need to tag the gate itself).
Therefore, every gate as a number (1,2,3,4,...) and everytime someone passed by, it transmits that number. Here the example for gate 1:

Code: [Select]

//by CronosVirus00, 2018


int sensore = 1; // proximity sensor

byte incomingByte;
String readBuffer = "";

#include <SoftwareSerial.h>

const byte HC12RxdPin = 4;                 
const byte HC12TxdPin = 5;                 

SoftwareSerial HC12(HC12TxdPin,HC12RxdPin);

void setup() {

  HC12.begin(9600);                       
}

void loop() {
if(digitalRead(sensore) ==0) {  //check if someone passes by the sensor
 HC12.write("1");
 delay(500); // delay necessary to avoid double reading
}
 
  while (HC12.available()) {             // Checks If HC-12 has data; data is sent by laptop; see next if
  incomingByte = HC12.read();         
  readBuffer += char(incomingByte);   
 

if (readBuffer == "Test") {  // If i send "test", it replays saying that this gate is working.
              HC12.write("1OK");
              delay(1000);
             readBuffer = ""; 
            }
  }
}

 
As you can see, there is a section to check from remote if the device is working or not (Test).

SOFTWARE (Receiver)

I'm still working on the code for the receiver; the idea is to have a software that allows you to select different tests and modes (i.e. number of gates).

Here I will post draft of a two gates system: n1 will get a split time where n2 will give me the end time. It is based on the Chrono library by Sofapirate. When I press "v", the time start running and the receiver is "allowed" to receive data from the gates.

Code: [Select]
#include <SoftwareSerial.h>


const byte HC12RxdPin = 4;                 
const byte HC12TxdPin = 5;                 

SoftwareSerial HC12(HC12TxdPin,HC12RxdPin);

/////////////////

#include <Chrono.h>
#include <LightChrono.h>
int x = 0;  // x will contain the received data from gates
int imenu = 0; // creating a menu for the future
Chrono crono;


void setup() {
  Serial.begin(9600);                       
  //HC12.begin(9600);                         
crono.stop();
delay(1000);

}

void loop() {

menu();
HC12.begin(9600);
if(HC12.available()){                     
    //Serial.write(HC12.read());           

    x = HC12.read();  //
 
   
    if (x == 49) { //49 is ascii for 1
      crono.elapsed();
      Serial.println(crono.elapsed()/1000.0,3);
   
    }

      if (x == 50) { //50 is ascii for 2
      crono.stop();
      Serial.println(crono.elapsed()/1000.0,3);
      Serial.println("----------END-----------");
      imenu= 0;
     
    }
   
       }
 
  if(Serial.available()){                 
    HC12.write(Serial.read());             
  }
 

}
//////////////////
void menu() {
  while(imenu == 0){
   
 
     if( Serial.available() )       // if data is available to read; press v to start the chrono
 {
  int val = Serial.read(); 
   switch (val){ 
    case 'v':
        Serial.println("Running");
        HC12.end();
        HC12.flush();
        crono.restart();
        crono.start();
        imenu = 1;
   }
  }
}
}


CONCLUSION

I tested on a track (100m) and everything went fine. Still need to compile a decent software for the receiver, one that allows my to select number of gates or even record best times and get stats (i.e. power output in W over repeated sprints).

I would like to know your opinion and suggestions to improve my project.

Thank you!

CronosVirus00

Sorry Moderators, I posted in the wrong section, just realized it. How can I move it?

el_supremo

Click on "Report to Moderator" below each message and ask to have the thread moved - I'd suggest to "Project Guidance"

Pete
Don't send me technical questions via Private Message.

el_supremo

P.S. Also post your code in code tags, not in quote tags. Edit your post and change quote to code at the beginning and change /quote to /code at the end.

Pete
Don't send me technical questions via Private Message.

CronosVirus00


el_supremo

Don't send me technical questions via Private Message.

Go Up