Hardware components | ||||||
![]() |
| × | 1 | |||
![]() |
| × | 1 | |||
![]() |
| × | 1 | |||
![]() |
| × | 1 | |||
![]() |
| × | 1 | |||
![]() |
| × | 2 | |||
![]() |
| × | 2 | |||
Software apps and online services | ||||||
![]() |
| |||||
Hand tools and fabrication machines | ||||||
![]() |
|
In fittness club my friend asked me to design digital timer for to measure user excercises. After a while i could not find big 7 segment display so i decided to do this project in my way; "Old Fashion, New Tech!"
I tried various types of servos, DC motors with encoders but my friends old laser printer saved me from long wires. Finally i fixed motor problem with stepper motor and easy driver.
Plastic parts produced with Arduino GRBL CNC machine. Black base part recovered from lab type gas torch.
Wood parts are not polished. After doing some changes, i will polish that or may be i can make some shades with gas torch.
Arduino is connected with sockets. I use this Arduino in different projects. (Arduino is not cheap in my country (Turkey))
Easy driver, pull-down resistors and tactile buttons are soldered on pcb. L7812cv attached for led strip. Thin sticks are holding box a little bit for light beam.
int dir = 12;
int pulse = 11;
int drvAktif = 10;
int saatAyar = 125;
int buton1 = 8;
int buton2 = 7;
int ledPin = 9;
int sayac = 0;
int uyariSayaci = 0;
int limit = 1;
int limitLed = 0;
int uyariLimit;
int sayacAktif = false;
int t;
int t2;
void setup() {
Serial.begin(9600);
pinMode(buton1, INPUT);
pinMode(buton2, INPUT);
pinMode(ledPin, OUTPUT);
pinMode(drvAktif, OUTPUT);
pinMode(dir, OUTPUT);
pinMode(pulse, OUTPUT);
digitalWrite(dir, LOW);
digitalWrite(pulse, LOW);
digitalWrite(drvAktif, HIGH);
}
void loop() {
//---------Buton Kontrolleri---------------------------------
while (digitalRead(buton2) == HIGH && sayacAktif == false) {
t++;
delay(1);
}
if (t > 500) {
saatAyar = 125;
t = 0;
}
if (t > 50 && t < 500) {
saatAyar = saatAyar + 125;
delay(100);
t = 0;
}
//----------Set ayarları---------------------------------------
while (digitalRead(buton1) == HIGH && sayacAktif == false) {
t2++;
delay(1);
}
if (t2 < 500 && t2 > 50) {
limit = limit + 1;
delay(100);
if (limit > 5) {
limit = 1;
}
while (limitLed < limit) {
analogWrite(ledPin, 200);
delay(150);
analogWrite(ledPin, 0);
delay(200);
limitLed = limitLed + 1;
}
limitLed = 0;
t2 = 0;
}
if (t2 > 500) {
sayac = 0;
sayacAktif = true;
delay(100);
t2 = 0;
}
Serial.print(limit);
Serial.print("\t");
Serial.print(sayac);
Serial.print("\t");
Serial.print(saatAyar);
Serial.print("\t");
Serial.println(sayacAktif);
delay(1);
//---------Buton Kontrolleri---------------------------------
while (sayacAktif == true && sayac < limit) {
//---------uyarı bölümü----------------------------------
uyariLimit = limit - sayac;
while (uyariLimit > uyariSayaci) {
delay(300);
analogWrite(ledPin, 200);
delay(150);
analogWrite(ledPin, 0);
delay(300);
uyariSayaci = uyariSayaci + 1;
}
uyariSayaci = 0;
//---------uyarı bölümü----------------------------------
geriSayim();
sayac = sayac + 1;
if ( sayac == limit) {
sayacAktif = false;
digitalWrite(drvAktif, HIGH);
}
}
}
void geriSayim() {
digitalWrite(drvAktif, LOW);
digitalWrite(dir, LOW);
for (int i = 0; i <= 240; i++) {
analogWrite(ledPin, i);
digitalWrite(pulse, HIGH);
delayMicroseconds(50);
digitalWrite(pulse, LOW);
delay(saatAyar);
}
delay(100);
digitalWrite(dir, HIGH);
for (int i = 0; i <= 240; i++) {
analogWrite(ledPin, 240 - i);
digitalWrite(pulse, HIGH);
delayMicroseconds(50);
digitalWrite(pulse, LOW);
delayMicroseconds(2500);
}
}
int dir = 12;
int pulse = 11;
int drvActive = 10;
int timeSet = 125;
int buton1 = 8;
int buton2 = 7;
int ledPin = 9;
int counter = 0;
int warnCount = 0;
int limit = 1;
int limitLed = 0;
int warnLimit;
int counterActive = false;
int t;
int t2;
void setup() {
Serial.begin(9600);
pinMode(buton1, INPUT);
pinMode(buton2, INPUT);
pinMode(ledPin, OUTPUT);
pinMode(drvActive, OUTPUT);
pinMode(dir, OUTPUT);
pinMode(pulse, OUTPUT);
digitalWrite(dir, LOW);
digitalWrite(pulse, LOW);
digitalWrite(drvActive, HIGH);
}
void loop() {
//---------Button Controller---------------------------------
while (digitalRead(buton2) == HIGH && counterActive == false) {
t++;
delay(1);
}
if (t > 500) {
timeSet = 125;
t = 0;
}
if (t > 50 && t < 500) {
timeSet = timeSet + 125;
delay(100);
t = 0;
}
//----------Set Settings---------------------------------------
while (digitalRead(buton1) == HIGH && counterActive == false) {
t2++;
delay(1);
}
if (t2 < 500 && t2 > 50) {
limit = limit + 1;
delay(100);
if (limit > 5) {
limit = 1;
}
while (limitLed < limit) {
analogWrite(ledPin, 200);
delay(150);
analogWrite(ledPin, 0);
delay(200);
limitLed = limitLed + 1;
}
limitLed = 0;
t2 = 0;
}
if (t2 > 500) {
counter = 0;
counterActive = true;
delay(100);
t2 = 0;
}
Serial.print(limit);
Serial.print("\t");
Serial.print(counter);
Serial.print("\t");
Serial.print(timeSet);
Serial.print("\t");
Serial.println(counterActive);
delay(1);
//---------Buton Controller---------------------------------
while (counterActive == true && counter < limit) {
//---------Warning Part----------------------------------
warnLimit = limit - counter;
while (warnLimit > warnCount) {
delay(300);
analogWrite(ledPin, 200);
delay(150);
analogWrite(ledPin, 0);
delay(300);
warnCount = warnCount + 1;
}
warnCount = 0;
//---------Warning Part----------------------------------
countDown();
counter = counter + 1;
if ( counter == limit) {
counterActive = false;
digitalWrite(drvActive, HIGH);
}
}
}
void countDown() {
//------------Countdown Starts here---------------------
digitalWrite(drvActive, LOW);
digitalWrite(dir, LOW);
for (int i = 0; i <= 240; i++) {
analogWrite(ledPin, i);
digitalWrite(pulse, HIGH);
delayMicroseconds(50);
digitalWrite(pulse, LOW);
delay(timeSet);
}
delay(100);
digitalWrite(dir, HIGH);
for (int i = 0; i <= 240; i++) {
analogWrite(ledPin, 240 - i);
digitalWrite(pulse, HIGH);
delayMicroseconds(50);
digitalWrite(pulse, LOW);
delayMicroseconds(2500);
}
}
Comments
Please log in or sign up to comment.