loading

This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)

Since their invention, clocks have been in constant motion, a perpetual ticking and tocking of timekeeping. Have you ever asked yourself: "why must they always move?" Do you find yourself grated by the circular motion of their hands? Don't you wish you could have a clock that only moved when you ask it to?

Well, today is your lucky day! With only about an hour of work, you, too, can have a functional and practical piece of machinery that conforms to your skewed worldview. Here's how to do it!

Step 1: Materials

In order to build the Stopped Clock, you will need four main components:

  1. an Arduino UNO board
  2. a distance sensor (here I use an HC-SR04 sensor)
  3. a stepper motor
  4. and a motor driver (I'm using a ULN2003 Motor driver module)

...along with a box to house the main components and plenty of wires for connections.

Step 2: Wiring

Wiring can seem like a daunting task at first, but the most important thing to remember is to keep your wires organized! I found this was easiest using ribbon cable and wires of the same color as the ribbon portion.

The HC-SR04 sensor is connected to digital pins 6 and 7 for its Echo Pin and Trigger Pin, respectively. The Ground connection runs to one of the ground pins on the Arduino, and the 5V connection runs to digital pin 5, which is written to be HIGH, i.e. providing a voltage to the 5V connection.

The stepper motor is connected to the motor driver through a special bundle of wires, and the Arduino connects to the motor driver. Digital pins 8-11 are used to make this connection, and these will be used to drive the motor forward or backward by one step. Pin 8 is connected to step A, Pin 9 to step B, and so on. The motor driver is also connected to 5V of power and the second ground pin on the Arduino.

Step 3: Coding

The code is pretty straightforward: a timer continuously counts up by one second every second (surprise, surprise). When the timer reaches 61 seconds, it lapses, and becomes 1 minute and 1 second. When the timer reaches 60 minutes, it lapses and becomes 1 hour, 0 minutes, and 1 second. And, similarly, when the hour counter reaches 13, it lapses one last time, becoming 1 hour, 0 minutes, 1 second. It's a regular digital clock!

The Arduino also checks distance every second, meaning that the Arduino compares the previously measured distance to the current distance measurement. If these two measurements differ by more than a set amount (15 cm in this code), an alarm goes off (figuratively), and the Arduino considers this to be motion (hooray!). This will be the trigger for the rest of the code.

Now for the good stuff. Unfortunately, if the Arduino gets unplugged or if it reboots or if the battery runs out, there is no way for the board to keep track of where the clock hand is positioned. This has a simple fix: whenever the Arduino boots up, you (yes, you) will have to manually position the clock hand to reflect the hour. After this one adjustment, the Arduino will be ready to keep track of the correct time for the foreseeable future.

Now for the movement of the hand!

The Arduino "maps" the position of the hand relative to a 1 o'clock position. The 1 o'clock corresponds to step number 172, and the 12 o'clock corresponds to step number 2060. The rest of the hours are mapped accordingly.

When motion is detected, the Arduino checks the timer and check the last time it moved. If the current position of the Arduino is less than the position corresponding to the current time, it simply subtracts the position values and moves the stepper motor that corresponding number of steps.

For example, if the Arduino last moved at 1, it's "current position", the position of the hand, would be at step 172. If it then detects motion at 5 o'clock, the hour that corresponds to step number 860, it would simply subtract the step numbers to get a difference of 688 steps. The board would then move 688 steps to the 5 o'clock position.

If the current position of the Arduino is more than the position corresponding to the current time, the board does a different calculation: 2060 - current position + current time-position.

For example: if the current time is 1 o'clock (position 172) and the current position is 5 o'clock (position 860), it would run the calculation: 2060-172+860= 2748. This will go one full loop around the face of the clock and end on the 1 o'clock position.

Step 4: Put It All Together!

The final step! Arguably the easiest part, it's time to put your components in the box.

The stepper motor should go through the box, around the middle, and should hold the clock hand on the side of the face. The distance sensor should be positioned so that only deliberate actions may set it off. You don't want the movement of the clock hand to set it off, or a random passer-by to change the time, either. The motor driver should obviously be positioned close to the stepper motor, although the exact position is not very important, as is also the case with the Arduino. As long as everything connects comfortably, the project should be stable.

I myself placed the distance sensor facing skywards, on top of the clock. I also placed a sticker with the number 12 to indicate the 12 o'clock position.

Once all the pieces are in position, the project is complete! Congratulations-you've stopped time!

<p>Interesting idea!</p>

About This Instructable

180views

2favorites

License:

More by jsrojas1:The Stopped Clock 
Add instructable to: