Noshirt
ITALY • + Follow
Edit Project
Components
Description
Start/Stop Chronometer
Me and my friend are always in competition for something, in every sports, from ski to run, to MTB. I decided to build this Chronometer to have a precise measurement of the time spent to complete a pre-made circuit. You just have to choose a start and an end point, and place the two module (we 3D-printed a case for it because we soldered everything on a circuit board, you can also do this if you want something definitve) to start the competition.
Credits for the wiring label to: https://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
Code
Code for the Start/RX
C/C++
#include <LiquidCrystal.h>
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define CE_PIN 9
#define CSN_PIN 53
LiquidCrystal lcd(12, 11, 5, 4, 3, 10);
int trigPin = 6;
int echoPin = 7;
int greenLed = 38;
int redLed = 39;
int m;
int s;
int dc;
const byte thisSlaveAddress[5] = {'R','x','A','A','A'};
RF24 radio(CE_PIN, CSN_PIN);
char dataReceived[10];
bool newData = false;
void setup() {
lcd.begin(16, 2);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(redLed, OUTPUT);
pinMode(greenLed, OUTPUT);
digitalWrite(greenLed, LOW);
pinMode(53, OUTPUT);
Serial.begin(9600);
Serial.println("SimpleRx Starting");
radio.begin();
radio.setDataRate( RF24_250KBPS );
radio.openReadingPipe(1, thisSlaveAddress);
radio.startListening();
}
void loop() {
int duration;
int distance;
digitalWrite(redLed, HIGH);
digitalWrite(trigPin, HIGH);
delay(1);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
if (distance <= 100 && distance >= 0) {
digitalWrite(greenLed, HIGH);
while (digitalRead(greenLed) == HIGH) {
tempo();
getData();
showData();
}
}
}
void tempo() {
lcd.setCursor(0,1);
dc = dc + 1;
lcd.print(m);
lcd.print(":");
lcd.print(s);
lcd.print(".");
lcd.print(dc);
delay(100);
if (dc == 9) {
dc = 0;
s = s + 1;
}
if (s == 60) {
s = 0;
m = m + 1;
}
}
void getData() {
if ( radio.available() ) {
radio.read( &dataReceived, sizeof(dataReceived) );
newData = true;
}
}
void showData() {
if (newData == true) {
Serial.print("Data received ");
Serial.println(dataReceived);
digitalWrite(ledVerde, LOW);
newData = false;
}
}
Code for the Stop/TX
C/C++
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define CE_PIN 9
#define CSN_PIN 10
int trigPin = 3;
int echoPin = 4;
int ledVerde = 5;
char dataToSend[10] = "Message 0";
char txNum = '0';
RF24 radio(CE_PIN, CSN_PIN);
const byte slaveAddress[5] = {'R','x','A','A','A'};
void setup() {
Serial.begin(9600);
Serial.println("SimpleTx Starting");
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(greenLed, OUTPUT);
digitalWrite(greenLed, LOW);
radio.begin();
radio.setDataRate( RF24_250KBPS );
radio.setRetries(3,5); // delay, count
radio.openWritingPipe(slaveAddress);
}
void loop() {
int duration;
int distance;
digitalWrite(greenLed, LOW);
digitalWrite(trigPin, HIGH);
delay(1);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
if (distance <= 100 && distance >= 0) {
digitalWrite(greenLed, HIGH);
while (digitalRead (greenLed == HIGH)) {
send();
}
}
}
void send() {
bool rslt;
rslt = radio.write( &dataToSend, sizeof(dataToSend) );
// Always use sizeof() as it gives the size as the number of bytes.
// For example if dataToSend was an int sizeof() would correctly return 2
Serial.print("Data Sent ");
Serial.print(dataToSend);
if (rslt) {
Serial.println(" Acknowledge received");
updateMessage();
}
else {
Serial.println(" Tx failed");
}
}
void updateMessage() {
// so you can see that new data is being sent
txNum += 1;
if (txNum > '9') {
txNum = '0';
}
dataToSend[8] = txNum;
}
Schematic and Layout
Jun 17,2022
512 views
Start/Stop Chronometer
That's a two-module chronometer for your MTB (or any others sports) to measure your time in a determined circuit!
512
0
0
Published: Jun 17,2022
Purchase
Donation Received ($)
PCBWay Donate 10% cost To Author
Copy this HTML into your page to embed a link to order this shared project
Copy
Under the
Attribution-ShareAlike (CC BY-SA)
License.
- Comments(0)
- Likes(0)
Upload photo
You can only upload 5 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
0 / 10000
It looks like you have not written anything. Please add a comment and try again.
You can upload up to 5 images!
Image size should not exceed 2MB!
File format not supported!
View More
View More
VOTING
0 votes
- 0 USER VOTES
0.00
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Design
1/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Usability
2/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Creativity
3/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Content
4/4
More by Noshirt
- IR Remote for Fan So, I found this little Fan (it should be at least 10 years old), which was powered by some buttons ...
- Arduino Weather Station v1.0 (BMP280) First version of a very simple weather station made with an Arduino UNO, a BMP280 sensor and a LCD.I...
- Wi-Fi Controlled Relay One day I woke up. I thought, why can't my windows be opened from my pc?! Why I have to get up from ...
- Start/Stop Chronometer Me and my friend are always in competition for something, in every sports, from ski to run, to MTB. ...
- Arduino Keyboard V2.0 That's an update for the older version of the project!Now you can play the keyboard on the keys from...
- Arduino Keyboard Didn't know what to do as my first Arduino Project, so i thought of starting out with something litt...
You may also like
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
74 0 0 -
DIY Laser Power Meter with Arduino
86 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
120 0 2 -
-
A DIY Soldering Station Perfect for Learning (Floppy Soldering Station 3.0)
416 0 1 -
Custom Mechanic Keyboard - STM32
243 0 3