DIY Space Clock / Arduino Servo Clock.
by Misfit Maker in Circuits > Arduino
889 Views, 12 Favorites, 0 Comments
DIY Space Clock / Arduino Servo Clock.
Hello, creative makers! We're back with another exciting project. This time, I wanted to create a simple yet captivating clock. What could be more mesmerizing than the vast universe? Drawing inspiration from space, I brainstormed and came up with a unique design featuring a rocket and an astronaut as the hour and minute hands. The clock is straightforward: servo motors drive the hour and minute hands, and an RTC module fetches the time, all controlled by an Arduino.
So what are you waiting for? Let's make this awesome clock!
Supplies
Materials / Tools Required :
- Printout of the Clock Template (Preferably in sticker format)
- Foam Board 3mm
- 20 gauge wire [ Floral stem wire ]
- Two servo motors
- Arduino UNO
- RTC module (DS3231 RTC)
- TM1637( Optional )
- 7805 IC
- Two 100uF Capacitor
- 12 Volt DC adapter (at least 2A )
- White Glue
- Super Glue
- Two Side Tape
- Rubber based glue
- Small washers (as weights)
- Craft Knife
- Nose Plier
Refer to the Fusion 360 CAD file provided in the supplies section for reference.
Making the Cutouts
Get the clock template printed, ideally on sticker paper for smooth application onto the foam board. Use the provided PDF file for making the printouts. Once the template is ready, adhere it to the 3mm foam board and skillfully carve out the shapes using a craft knife.
Downloads
Hour & Minute Hand Part 1
To craft the hour and minute hands, we'll utilize 20-gauge floral stem wire. Following the design outlined in the CAD file provided in the supplies section, we'll shape the wire accordingly. Bends in the wire will be created using a pair of needle-nose pliers. To secure the hands in place, a small bend will be made at the end of the wire before inserting it through the foam board cutout, as depicted in the accompanying images. The bend, serving to hold the astronaut or rocket, will be positioned approximately 115mm away from the center of the cutout.
Hour & Minute Hand Part 2
After creating the desired bends on the wire, we'll proceed to paint it black and affix the astronaut and rocket cutouts at the ends of the wire, as shown in the attached images. Rubber based glue will be used to attach the servo motor horn/arm to the hands. Additionally, we'll attach washers to the ends of our rocket / astronaut cutouts using glue, serving as weights to maintain the desired positioning.
Assembling the Electronics
Referencing the attached image, assemble the electronic components and securely attach them to the back of clock, as shown in the attached images. Utilize the Fusion 360 file included in the supplies section for reference. TM1637 display module is optional.
The Code
After assembling the electronic components, upload the following code to the Arduino. Ensure to install the necessary libraries. For the DS3231 library, I obtained the zip file from a website called rinky-dinky electronics. Make sure to set the right time in your RTC (Here, I used DS3231 )module, there are a lot of Youtube videos out there explaining how to set time in an RTC module.
// Simple Space Clock Code
// If you like this project, please subscribe to my YouTube channel-Misfit Maker.
// Happy making....!
#include <Wire.h>
#include <DS3231.h>
#include <Servo.h>
#include <TM1637Display.h>
// DS3231 RTC module
DS3231 rtc(SDA, SCL);
// Servo motors
Servo hourServo;
Servo minuteServo;
// TM1637 Display module
#define CLK 2
#define DIO 3
TM1637Display display(CLK, DIO);
// Constants for servo angles
const int HOUR_MIN_ANGLE = 0;
const int HOUR_MAX_ANGLE = 165;
const int MINUTE_MIN_ANGLE = 0;
const int MINUTE_MAX_ANGLE = 168;
// Pins for servo motors
const int HOUR_SERVO_PIN = 9;
const int MINUTE_SERVO_PIN = 10;
void setup() {
// Initialize the RTC
rtc.begin();
// Attach servos to pins
hourServo.attach(HOUR_SERVO_PIN);
minuteServo.attach(MINUTE_SERVO_PIN);
// Initialize the display
display.setBrightness(0x0f); // Set brightness to maximum
}
void loop() {
// Get current time from RTC
Time t = rtc.getTime();
// Convert 24-hour format to 12-hour format
int hour = t.hour;
bool isPM = false;
if (hour >= 12) {
isPM = true;
if (hour > 12) {
hour -= 12;
}
} else if (hour == 0) {
hour = 12;
}
// Map hours and minutes to servo angles
int hourAngle = map(hour, 1, 12, HOUR_MIN_ANGLE, HOUR_MAX_ANGLE);
int minuteAngle = map(t.min, 0, 59, MINUTE_MIN_ANGLE, MINUTE_MAX_ANGLE);
// Move servos to the correct position
hourServo.write(180 - hourAngle); // Rotate clockwise
minuteServo.write(180 - minuteAngle); // Rotate clockwise
// Display time on TM1637
int displayTime = (hour * 100) + t.min;
display.showNumberDecEx(displayTime, (isPM ? 0b01000000 : 0b00000000), true);
// Wait for half minute before updating again
delay(30000);
}
Final Assembly
Next, we'll connect the power supply to the clock and set the hour and minute hands to their designated positions, as shown in the above pictures. To secure the planet cutout in place, we'll use double-sided tape, stacking four layers to create the necessary space for the hour and minute hands to move without obstruction. With this our build is complete.
Ta Da...
Ladies and gentlemen, our clock is now geared up and eager to start ticking away the moments in style. For a visual walkthrough of the build process, check out the attached YouTube video. You can also modify the decals of the clock and make your clock customized to your liking [ CAD file attached in the supplies section ].
I hope you enjoyed following along with my project. Your support, in the form of likes and comments, fuels the fire of creativity.
Stay tuned for more exciting projects !
Thanks for reading.