arnotixe
Published © CC BY-NC-SA

Cheap slow 24 hour analog clock, recycled

Make a standard, cheap analog clock go just 1 round in 24 hours. Like Slow watches, just a lot cheaper, in all the word's meanings ;)

BeginnerFull instructions provided703
Cheap slow 24 hour analog clock, recycled

Things used in this project

Hardware components

Wire, Hook Up
Wire, Hook Up
Just use any thin cable
×1
Arduino Nano R3
Arduino Nano R3
or any arduino
×1
Analog wall clock
or any old recycled cheap clock
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Schematics

Clock schematics.

2 wires.

Code

24 hour clock

Arduino
Pull cheap clock lavet motor a little once every 24 seconds to convert the minute hand into a 1-rotation-per-24-hour-hand
/*
  Arno's UTC clock

  Copyleft Arno Teigseth
  Licensed under CC BY-NC-SA 4+

  computer version see https://teigseth.no/clock

*/

int D0 = 3;                  // Pin1 to use for clock's lavet motor
int D1 = 4;                  // Pin2 to use for clock's lavet motor
int phase = 0;               // current motor phase (forward/backward)
unsigned long last = 0;      // last time we pulsed the lavet motor
unsigned long second = 1000; // standard period for second duration, in milliseconds

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(D0, OUTPUT);
  pinMode(D1, OUTPUT);

  second = 1000UL * 24UL; // 1/24 Hz, using the minute visor for "24-hours-per-rotation hour hand". Note the UL https://forum.arduino.cc/t/unsigned-long-overflow/395902/2
  // second = 1000; // 1 Hz for testing, to avoid waiting 24 seconds between second visor movement
}


// function to set clock "motor" voltage
//
// 0 = off
// 1 = on forward
// 2 = on backward
//
void setit(int clockstate) {
  switch (clockstate)
  {
    case 0:
      digitalWrite(D0, LOW);  // D0 -
      digitalWrite(D1, LOW);  // D1 -
      break;
    case 1:
      digitalWrite(D0, HIGH); // D0 +
      digitalWrite(D1, LOW);  // D1 -
      break;
    case 2:
      digitalWrite(D0, LOW);  // D0 -
      digitalWrite(D1, HIGH); // D1 +
  }
}

// the loop function runs over and over again forever
void loop() {

  if (millis() - last > (second)) {
    if (last == 0) {
      last = millis(); // get initial milliseconds
    } else {
      last = last + second; // exactly 24000ms since last go. Or 1000ms if in test mode
      // Hoping it will rollover after 50 days 70 minutes, https://www.norwegiancreations.com/2018/10/arduino-tutorial-avoiding-the-overflow-issue-when-using-millis-and-micros/
    }

    // Toggle motor direction for a few ms
    if (phase == 1) {
      phase = 0;
      setit(1); // "Tighten up" lavet motor to point in current direction again (might have moved due to gravity while being turned off)
      delay(50);
      setit(0);
      delay(50);
      setit(2); // Then set to new direction
      delay(100);
      setit(0); // Done
    } else {
      phase = 1;
      setit(2); // "Tighten up" lavet motor to point in current direction again (might have moved due to gravity while being turned off)
      delay(50);
      setit(0); // Then set to new direction
      delay(50);
      setit(1);
      delay(100);
      setit(0); // Done
    }
  }
}

Credits

arnotixe

arnotixe

0 projects • 0 followers

Comments