Annual Clock with a fast forward function

Hi there,

a while ago i stumbled upon this (formerly Kickstarter) project; https://thepresent.is/ An annual clock (or a month/day version). A clock that does one rotation a year. I tried to contact them about availability, but with no response. So I decided to try to make one.

I think I have the hardware figured out;
Arduino Uno, a stepper motor + ULN2003 board (more in the pictures)

The thing is, I am not good at programming.

I am trying to write a code that would: Rotate the motor one step at a time in a sequence usual to this stepper motor. In between these steps, I added a sequence for all 4 poles of the motor to be turned off. To save some power, as one step is ca. 2 hours apart.

Additionally, I would like to have a function of fast spinning, turned on with a button, so I can set the clock when first turned on (or after a power shortage). This doesn't have to be (and by design can't) precise.

This part I cant figure out.

Id like to have a button (with 10k resistor) to be plugged to pin 12 + ground for this function.

Could you guys help me to write this part of program?

const int in1 = 8;
const int in2 = 9;
const int in3 = 10;
const int in4 = 11;
const int button = 12;
int fast = 10 ;       //delay for fast forward and and one step
int Delay = 863 ;     //delay for in between steps

//2037.8864 = 1 rotation
//4076 = 1 rotation with delay steps

void setup() {
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
pinMode(button, INPUT);
}

void loop() {

  if(digitalRead(button) == LOW) {
    ticking();}
  else {
    fastForward();}
}
  void ticking() {
  step1();
  off();
  step2();
  off();
  step3();
  off();
  step4();
  off();
  step5();
  off();
  step6();
  off();
  step7();
  off();
  step8();
  off();
}
  void fastForward() {
  step1();
  step2();
  step3();
  step4();
  step5();
  step6();
  step7();
  step8();
}
void step1(){
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
  delay(fast);
}
void step2(){
  digitalWrite(in1, HIGH);
  digitalWrite(in2, HIGH);
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
  delay(fast);
}
void step3(){
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
  delay(fast);
}
void step4(){
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);
  delay(fast);
}
void step5(){
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);
  delay(fast);
}
void step6(){
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  digitalWrite(in3, HIGH);
  digitalWrite(in4, HIGH);
  delay(fast);
}
void step7(){
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);
  delay(fast);
}
void step8(){
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);
  delay(fast);
}
void off(){
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
  delay(Delay);
}

The link shows under construction message..

Why not also add a Potentiometer to an analogue pin to set a delay value in the loop to control the speed of the rotation when setting. This would give you a little better accuracy

Drop me a PM if you want guidance

Cheers Pete

It's not clear whether you want someone to do this for you. You posted in "Jobs and Paid Consultancy".

Hi,
this was the link I found for the annual clock.
https://www.kickstarter.com/projects/scottthrift/the-present
(the project is from 2011/2012).

I believe he doesn't use stepper motors, as they need a higher voltage and current than proposed by the project's author.
In the original project he talks about using battery that can last from 4 to 12 years.

I think he uses digital clock motors, such as this model, and changes the original electronic circuit and uses some IC to divide the frequency that goes to the motor.

A year has 525,960 minutes.
The hand of a normal clock makes one revolution every minute.
The hand needs to rotate 525,960 slower.
If you divide the frequency going to the motor by 525,960, you get one lap per year.

But what I've described is a mere assumption, I don't know if it will work doing it that way and also what the accuracy of this watch is.

Quartz clock:

As pointed out, this forum section is for those who want to offer money to others to write code for them (or design circuits) so they don't have to try to do it themselves.

If that's what you want to happen, you need to confirm that you will pay, even if you don't want to agree on a price until later.

If you did not intend to pay, and you only want help and guidance so that you can write the code yourself, then you can get that for free in any other party of the forum. Let me know and I can move your post to an appropriate section.

I moved the post to Using Arduino/Programming Questions

replace your "off()" function with a "delay(1000)". Note that ULN2008 is inverting (please read the datasheet for further information). Also note that yout "off()" function does not do what you think it does - get a sheet of paper and draw the signals, then you know what happens.

This link describes methods for using a clock mechanism at a different rate:

You probably are better off not using an Arduino.

HTH

a7

the function does exactly what i want it to do.
instead of feeding 5V to one of the 8 steps for full time
it just moves the steps and then turns the power to motor off until next step
confirmed by the LEDs on the stepper motor control board.
idk what should I do with the paper :slight_smile:
this part of the code works and I was able to set it to rotate one rotation each hour for testing.

I would like to thank you all for all the input, I mean it.

BUT none of you actually helped with my problem.

"Add a function", "Use different motor"...
I have this thing done almost completely built, I will use Arduino, because I have it (unlike modified quartz clock(modified how?)) .

If there is anyone who can help me with the rule that will
switch between slow rotation or fast forward based on the button input, I would very much appreciate it.

Just change the value in your delay(). But have you chacked that your code actually makes the stepper stepping?

so can you provide links to the components - eg "stepper motor"

?

strange calling an output "in1"

this part of the code works and I was able to set it to rotate one rotation each hour for testing
just changing the delay would result in sending 5V to the stepper motor for 24h a day, which is not neccesary.

Sure;

Sorry, i forgot to upload the images;



And yes, weird, i copied this par from net and didnt bother changing that since

I suspect your problem is that you use the delay() statement to control the timing, and as a result your problem spends 99% of the time in the ticking routine. It only returns to the loop where the button is checked very infrequently.

If you hold the button down as the Uno powers on does the fast forward work as expected?

Hey, that might be it! I'll try setting the delay down to 100ms or something and hold it then.
(After I come home from work.)
Thank you!

It would be better to use millis() as in the blink without delay sketch.

Your stepper motor seems to include a /64 gear ratio which gives one step = 5.27 minutes of arc

nice project

I found this;

"According to the data sheet, when the 28BYJ-48 motor runs in full step mode, each step corresponds to a rotation of 11.25° . That means there are 32 steps per revolution (360° / 11.25° = 32) . In addition, the motor has a 1 / 64 reduction gear set . (Actually its 1 / 63.68395 but for most purposes 1/64 is a good enough approximation) What this means is that there are actually *32 63.68395 steps per revolution = 2037.8864 ~ 2038 steps!"

The delay calculations work when working with the 2038 steps.
TY!

Just thinking aloud: when you turn off the motor power, Did you check that the remaining torque is high enough to hold the needle in place? In one of your picture the clock is almost horizontal so the weight is probably negligible but what if the clock was vertical?