Introduction: Arduino Gyro Clock
Hello everyone, today I'm going to show everyone how to create a special gyrate clock, powered by an Arduino. First of all, I want to give all credit to the original author: electronics for everyone. The original design he made is here. He makes a lot of amazing electronic projects and the original idea of the clock was from him. I use the Arduino Leonardo board, but any other Arduino board should be fine. The clock uses a stepper motor to turn the plate to show different times.
For this project, I added improvements to the original code of the clock to include more functions. I added an LED light to the code so the clock can still be seen at night. I also connected a speaker module to the board so every hour the clock will beep two times to indicate this. I made a base for the clock to connect to and included a removable support stand on the other side of the clock to make it more stable. The video above is sped up 100x for demonstrational purposes.
Step 1: Materials!
Stepper motor and controller
LED of any color
Portable Battery (optional)
Tape and Glue
Step 2: Stepper Motor Library
You only need this in your library if you are using the ULN2003 controller for the stepper motor. Otherwise, you can skip this step.
1. Start by downloading the .cpp and .h file below
2. Create a new file called StepperMotor
3. Drag and Drop both the .cpp and .h file into the new StepperMotor file
4. Go to your Arduino libraries file and drop the StepperMotor file into it
5. Open Arduino IDE and run this test code to make sure everything was installed correctly
6. Now verify the code in the Arduino IDE if it compiles without any issue you have installed everything correctly.
Step 3: Wiring
There are 4 things in total that we will need to connect to the Arduino:
Stepper Motor and controller
First, connect your stepper motor onto the controller. Then connect int 1 on the controller to pin 6, int 2 to pin 7, 3 to 8, and 4 to 9. Then connect - (negative) pin to GND on the board, and + (positive) pin to 5V on the board.
For the speaker, connect the red (positive) to the pin 3, and the black (negative) pin to GND.
Connect the long leg (positive) side of the LED onto pin 2, and the short leg (negative) side to GND.
Check the pictures to make sure everything is connected properly.
Note: If the board you are using cannot be connected directly to the wiring, then you need to use a soldering gun to solder all of the components together.
Step 4: Code
Copy and paste this code below into Arduino IDE and upload it to the board:
Step 5: Casing for Electronics
The casing for the electronics is basically one small box with a circular base and a long strip of paper for the numbers.
8cm x 2cm piece x2
14cm x 8cm piece x2
14cm x 2cm piece x2
11.46 radius circle
72cm x 2cm piece of paper of soft cardboard. Write starting from 12:00 with 1 cm intervals until you reach 11:50, which the length of the paper should be just enough for all numbers to fit.
Any size and shape as long as the clock can fit on it.
Note: Remember to cut small holes in the box (see images above) for power and LED lights. Also cut a hole in the circle for the rod in the middle.
Step 6: Assembly
Before sealing the box off, arrange all of the electronics made according to the image above. Tape or glue everything in place. Then seal off the box. Create a small rod out of cardboard to fit through the clock's hole and connect it to the rod of the stepper motor. If the clock is too heavy and is drooping, you could add support on the other side of the clock. It doesn't really matter how you do it, as long as you can stop the clock from leaning to one side, but the images above show how I did it. Then connect the whole clock to the base below and secure it with some tape and glue (see images above). And to make it even cooler, add an arrow on the box pointing at the numbers to show time more clearly.
Step 7: Testing
After you are done, remember to test out your clock to make sure that it works properly. Check if the clock is running and if it is accurate. If the clock is too slow, you might want to increase the number on motor.step(62) if the clock is going too fast, then decrease the number.
The LED is not on: this is probably because the stepper motor is using too much power. You might want to add additional power (portable battery) if that is the case.
The Clock is turning in the opposite direction: Then go to your code and change the motor.step(62) into a negative number.
2 years ago
Digging the improvements you included - Yay for iterating on designs and making them more accessible !