Project tutorial
Retro View Timer

Retro View Timer

Analog view timer based on stepper motor and easy driver, controlled by Arduino Nano with two buttons.

  • 993 views
  • 1 comment
  • 2 respects

Components and supplies

Ard nano
Arduino Nano R3
You can use any other
×1
12859 01
SparkFun Big Easy Driver
Possible with H-Bridge and unipolar steppers
×1
Nema%2017 2
OpenBuilds NEMA 17 Stepper Motor
Small setepper is enough for small design. You can get it from DVD-ROM or laser printer
×1
12002 04
Breadboard (generic)
×1
11026 02
Jumper wires (generic)
×1
09590 01
LED (generic)
×2
Omron b3f 1000 image 75px
SparkFun Pushbutton switch 12mm
×2

Necessary tools and machines

09507 01
Soldering iron (generic)

Apps and online services

About this project

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.

Wood parts are not polished. After doing some changes, i will polish that or may be i can make some shades with gas torch.

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.

Video is in Turkish but i added subtitles

Code

Arduino Code - TRArduino
Explained in Turkish
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);
  }
}
Arduino Code - EnArduino
Explained in English
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);
  }
}

Schematics

Main Circuit
Zamanlayici bb kkjubqh26b
Main Circuit .fzz
zamanlayici_USVXO0g3dr.fzz

Comments

Similar projects you might like

Stopwatch and Lap Timer with Arduino

Project tutorial by LAGSILVA

  • 20,700 views
  • 17 comments
  • 40 respects

Retro 1980s LED Clock/Count Up Timer

Project in progress by randtekk

  • 4,080 views
  • 4 comments
  • 17 respects

Arduino Countdown Timer

Project tutorial by xXarduino_11Xx

  • 7,286 views
  • 0 comments
  • 8 respects

More than an Hour Timer

Project tutorial by Ian Cumming

  • 5,445 views
  • 1 comment
  • 5 respects

Reaction Timer - F1 Style

Project tutorial by LAGSILVA

  • 2,085 views
  • 2 comments
  • 10 respects

DIY Retro Look FM Radio with TEA5767 Module

Project tutorial by Mirko Pavleski

  • 9,830 views
  • 5 comments
  • 41 respects
Add projectSign up / Login