Analog Yet Digital Looking Clock (Whole Clock Rotates, Handle Is Stationary)

by AbrarFairuj in Circuits > Clocks

233 Views, 0 Favorites, 0 Comments

Analog Yet Digital Looking Clock (Whole Clock Rotates, Handle Is Stationary)

Adobe_Post_20210524_0458260.15228554660908578.png
IMG_20210519_175119.jpg
IMG_20210519_175407.jpg
While sitting idle, I came up with an idea of an clock, where the whole clock(with the numbers) rotates but the handles stay stationary. It is still analog yet looks like Digital clock! So let's dive in the building part

Supplies

We need:
1. 2 Servo (I have used one 180deg and one 360deg servo)
2. Arduino UNO (Any arduino works)
3. L293D Motor Driver Shield
4. Plastic Sheet/Foam Sheet/Cardboard or any material for making the clock body

The Minutes Functionality

Screenshot_2021-05-19-22-03-39-10.jpg
IMG_20210521_052855.jpg
IMG_20210519_175658.jpg
You may ask, why minutes first?
It's simple, because, minutes make hour!

Grab a 360deg servo (I prefer a 360deg servo here)

Now, we need a little calculation. We know that 60 minutes => 1 hour
So,
āœ… 360deg for 60 minutes
ā˜‘ļø 6 deg for each minute!

We need to rotate the Servo(which will hold the clock body) 6deg after every minute. So each rotation becomes a minute. 60 of them will end up in 360deg and then we need to put it back to 0deg once again.

Set the Motor Driver shield on Arduino. Now connect the servo to Servo 1 pins.

I used the following template for the clock body. It is divided into 60 parts. Each line indicates a minute.

The Hours Functionality

Screenshot_2021-05-20-20-03-37-06.jpg
IMG_20210519_180215.jpg
When we will look at the code, you will see, after the minute servo has completed all 60 steps, it comes back to the initial position and the Hour servo moves by 1 step!

In this case, I didn't have a 360deg servo unfortunately, so I had to use a 180deg servo. This made me to make a 12 hour format clock.

After it reaches 12, the servo will rotate to the initial position in the next step.

Check my template below. I cut it half because there are 24 parts here. If you have a 360deg servo, you will want to use the full thing.

Just like before, if you calculate, this time it needs to rotate 15deg for each step.

Connect the servo with Servo 2 pins of the motor driver.

Clock Body

IMG_20210521_052945.jpg

We already have the template cut outs. Now, write down the time indicating numbers. I used white cardboards for the body and glued the number sheet on that.

Coding

programming.jpg

Here is my sample code. You may need to adjust it a bit.

include <Servo.h>
Servo myservo;
Servo myservo1;
String readString;

int servo1 = 0;
int servo2 = 0;
int startMinutes = 0;
int Hours = 0;
int prevHour = 0;

void setup() {
// put your setup code here, to run once:
myservo.attach(9);
myservo1.attach(10);
Serial.begin(9600);
myservo.write(180);
myservo1.write(360);
}

void loop() {
while (Serial.available()) {
char c = Serial.read(); //gets one byte from serial buffer
readString += c; //makes the String readString
delay(2); //slow looping to allow buffer to fill with next character
}

if (readString.length() >0) {
Serial.println(readString); //so you can see the captured String
int n = readString.toInt(); //convert readString into a number
Serial.println(n); //so you can see the integer
if(readString.indexOf('h') > 0){
myservo.write(180 - (n * 15));
servo1 = n * 15;
}else if(readString.indexOf('m') > 0){
myservo1.write(360 - (n * 6));
servo2 = n * 6;
startMinutes = 1;
}
readString="";
}
minutes();
if(Hours > prevHour){
prevHour = Hours;
int newValH = servo1 - 15;
if(newValH < 0){
newValH = 180;
}
myservo.write(newValH);
servo1 = newValH;
}
}

void minutes(){
if(startMinutes > 0){
delay(60000);
int newValue = servo2 - 6;
if(newValue < 0){
newValue = 360;
Hours = Hours + 1;
}
myservo1.write(newValue);
servo2 = newValue;
}
}

What's Next?

Yeah, we are done. Now you should grab a cup of coffee and relax. But what are the possible improvements?

Actually, this is a fun project just like most of the clock projects. Why?
Well, you already have a super powerful clock right now in your hand. These fun projects are valuable to people like you and me but sadly, not to the mass people. But, we love these so we will build these too :)

There are some stuffs that can be improved here, I think. You can add a seconds hand in it. Besides, you can use a RTC to automatically set the current time(I didnā€™t have one). Currently, to set and start the clock, you need to write the current time in the Serial like this:

šŸ”µ 5h //Hour, set it to 5
šŸ”µ 20m //Minutes, set it to 20

This will work only once at the beginning. Then, it will start running!

If you liked my idea and my instructables, please let me know in comments! I will love to hear from you šŸ˜‡