Article count:10804 Read by:13623255

Account Entry

Make a "hollow clock" with Arduino (only hands, no dial)

Latest update time:2022-06-27 16:22
    Reads:

For more exciting content, please click on the blue words above and follow us!


Let's see how to use Arduino to make a "hollow clock" with only hands but no dial.

It still looks pretty cool. Here are a few pictures made by netizens referring to the tutorial:

Flash the code to the Arduino. Upload the code to the Arduino IDE.

If your motors are running in the wrong direction, change the order of the numbers in the code:

int port[4] = {4, 5, 6, 7};

Change to

int port[4] = {7, 6, 5, 4};

The numbers here correspond to the pins on the Arduino Nano (D4-D7).

The complete code is as follows:

// Please tune the following value if the clock gains or loses.
// Theoretically, standard of this value is 60000.
#define MILLIS_PER_MIN 60000 // milliseconds per a minute

// Motor and clock parameters
// 4096 * 110 / 8 = 56320
#define STEPS_PER_ROTATION 56320 // steps for a full turn of minute rotor

// wait for a single step of stepper
int delaytime = 2;

// ports used to control the stepper motor
// if your motor rotate to the opposite direction, 
// change the order as {4, 5, 6, 7};
int port[4] = {4567};

// sequence of stepper motor control
int seq[8][4] = {
  {  LOW, HIGH, HIGH,  LOW},
  {  LOW,  LOW, HIGH,  LOW},
  {  LOW,  LOW, HIGH, HIGH},
  {  LOW,  LOW,  LOW, HIGH},
  { HIGH,  LOW,  LOW, HIGH},
  { HIGH,  LOW,  LOW,  LOW},
  { HIGH, HIGH,  LOW,  LOW},
  {  LOW, HIGH,  LOW,  LOW}
};

void rotate(int step) {
  static int phase = 0;
  int i, j;
  int delta = (step > 0) ? 1 : 7;
  int dt = 20;

  step = (step > 0) ? step : -step;
  for(j = 0; j < step; j++) {
    phase = (phase + delta) % 8;
    for(i = 0; i < 4; i++) {
      digitalWrite(port[i], seq[phase][i]);
    }
    delay(dt);
    if(dt > delaytime) dt--;
  }
  // power cut
  for(i = 0; i < 4; i++) {
    digitalWrite(port[i], LOW);
  }
}
void setup() {
  pinMode(port[0], OUTPUT);
  pinMode(port[1], OUTPUT);
  pinMode(port[2], OUTPUT);
  pinMode(port[3], OUTPUT);
  rotate(-20); // for approach run
  rotate(20); // approach run without heavy load
  rotate(STEPS_PER_ROTATION / 60);
}

void loop() {
  static long prev_min = 0, prev_pos = 0;
  long min;
  static long pos;
  
  min = millis() / MILLIS_PER_MIN;
  if(prev_min == min) {
    return;
  }
  prev_min = min;
  pos = (STEPS_PER_ROTATION * min) / 60;
  rotate(-20); // for approach run
  rotate(20); // approach run without heavy load
  rotate(pos - prev_pos);
  prev_pos = pos;
}

Step 8: Testing and Adjusting

  • Since the gear train has a certain amount of backlash, the position of the hour hand will be offset to the left and right. To solve this problem, some soft material, such as felt or sponge, can be inserted there to provide a little friction.
  • Paint the pointer to improve visibility. Pigment-based paint is better than dye-based ink, which will have capillary diffusion phenomenon.

Step 9: Adjust the Time

  • Use the Nano's reset button to set the time one minute earlier
  • While the motor is rotating, use the reset button to make fine adjustments.
  • The hour hand can be adjusted directly by hand (by friction)

Step 10: Smaller Version (Optional)

  • For smaller 3D printers (such as Prusa mini, 180x180cm), the author also prepared an 85% scaled version.

Source: https://www.instructables.com/Hollow-Clock-3/ Author: shiura


Add WeChat and reply " join group"

Invite you to join the technical exchange group!

Domestic chips|Automotive electronics|Internet of Things|New energy|Power supply|Industry|Embedded...

Reply to any content you want to search in the official , such as problem keywords, technical terms, bug codes, etc., and you can easily get relevant professional technical content feedback . Go and try it!


If you want to see our articles more often, you can go to our homepage, click the "three dots" in the upper right corner of the screen, and click "Set as Star".

Welcome to scan the QR code to follow us


Featured Posts


Latest articlesabout

 
EEWorld WeChat Subscription

 
EEWorld WeChat Service Number

 
AutoDevelopers

About Us About Us Service Contact us Device Index Site Map Latest Updates Mobile Version

Site Related: TI Training

Room 1530, Zhongguancun MOOC Times Building,Block B, 18 Zhongguancun Street, Haidian District,Beijing, China Tel:(010)82350740 Postcode:100190

EEWORLD all rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2021 EEWORLD.com.cn, Inc. All rights reserved