驴友花雕 发表于 2025-5-27 17:18:05

【Arduino 动手做】制作一个简单的 3D 空心时钟(V4版本)

本帖最后由 驴友花雕 于 2025-6-7 06:35 编辑





驴友花雕 发表于 2025-5-27 17:23:53

【Arduino 动手做】制作一个简单的 3D 空心时钟(V4版本)

大家好,在这个项目中,我将向大家展示如何制作这款外观精美的3D打印镂空时钟。几天前我在 Thingiverse上看到了这个项目 ,觉得非常有趣,所以我制作了一个视频,展示了我如何使用3D打印机打印和组装所有部件。








驴友花雕 发表于 2025-5-27 17:55:07

【Arduino 动手做】制作一个简单的 3D 空心时钟(V4版本)

步骤1:打印和组装零件

按照提供的姿势打印所有零件。无需支撑。“washer1.stl”和“washer2.stl”是可选零件,用于调整齿轮的间隙。

在此设计中,时针和分针的角度由磁力控制,而非机械控制。设置时间非常容易。用一定长度的螺丝固定时针和分针。插入磁铁并测试它们如何与重力对齐。组装前,请确保所有轴都能正常旋转。



































驴友花雕 发表于 2025-5-27 17:57:42

【Arduino 动手做】制作一个简单的 3D 空心时钟(V4版本)

步骤2:电路元件和印刷电路板

我们需要一个 Arduino Nano、一个步进电机、一个驱动器和一些电线。但在这种情况下,电路可能有点复杂,我想让它看起来更专业、更简洁。所以 我设计了一块定制的印刷电路板,创建了一个 Gerber 文件,并从 PCBWay订购了它。

所需组件:
三个 8mm x 3mm 钕磁铁
28BYJ-48步进电机及驱动板(ULN2003)
Arduino Nano 板
BOM 清单和 Gerber 文件可在 PCBWay 项目页面上找到。

为了有效利用空间,请拆下步进电机头并按照所示的颜色顺序将电线焊接到电路板上。













驴友花雕 发表于 2025-5-27 18:03:07

【Arduino 动手做】制作一个简单的 3D 空心时钟(V4版本)

步骤3:源代码

打开共享源代码,选择Arduino Nano开发板上传代码。如果电机转动方向相反,请修改代码中的电机连接顺序。

// 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 * 90 / 12 = 30720
#define STEPS_PER_ROTATION 30720 // 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 = {7, 6, 5, 4};

// sequence of stepper motor control
int seq = {
{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, seq);
    }
    delay(dt);
    if(dt > delaytime) dt--;
}
// power cut
for(i = 0; i < 4; i++) {
    digitalWrite(port, LOW);
}
}

void setup() {
pinMode(port, OUTPUT);
pinMode(port, OUTPUT);
pinMode(port, OUTPUT);
pinMode(port, 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
if(pos - prev_pos > 0) {
    rotate(pos - prev_pos);
}
prev_pos = pos;
}



驴友花雕 发表于 2025-5-27 18:04:27

【Arduino 动手做】制作一个简单的 3D 空心时钟(V4版本)

板上的跳线接头用于通过 Type-C USB 端口为 Arduino Nano 和电机提供 5 伏电源。














又一个项目结束了,首先感谢PCBWay的支持。如果您喜欢这个项目,可以关注并点赞。感谢您的阅读。

驴友花雕 发表于 2025-5-27 18:11:20

【Arduino 动手做】制作一个简单的 3D 空心时钟(V4版本)

本帖最后由 驴友花雕 于 2025-6-7 06:35 编辑

附录
项目链接:https://www.pcbway.com/project/s ... river_9507c8ea.html
项目作者:土耳其 梅尔特·基利奇 MertArduino
项目视频(2分钟):https://www.youtube.com/watch?v=0vr2Qu_AF7U
https://www.youtube.com/watch?v=hRpLiRoMx34&t=2s
项目代码:https://pcbwayfile.s3.us-west-2. ... 8/0037494941168.ino
3D文件:https://www.thingiverse.com/thing:5636482





驴友花雕 发表于 昨天 06:36

【Arduino 动手做】制作一个简单的 3D 空心时钟(V4版本)






页: [1]
查看完整版本: 【Arduino 动手做】制作一个简单的 3D 空心时钟(V4版本)