快捷搜索:  手机  明星

arduino无时钟模块怎么做时钟(用Arduino自制一个只有表针)

arduino无时钟模块怎么做时钟(用Arduino自制一个只有表针)将代码闪到Arduino上。把代码上传到Arduino IDE 上。然后用两个2毫米的自攻螺钉来组装起来。文中所有的涉及的STL文件可以到文末下载。相关STL文件可以到文末下载。如果你想把整个电路封闭起来放到盒子里,可以打印零件做个盒子(相关文件放在文末)。

arduino无时钟模块怎么做时钟(用Arduino自制一个只有表针)(1)

arduino无时钟模块怎么做时钟(用Arduino自制一个只有表针)(2)

这周我们来一起看看如何用Arduino自制一个只有表针,没有表盘的“空心时钟”。

看起来还是挺炫酷的,再放几张网友们参照教程做的图欣赏一下:

arduino无时钟模块怎么做时钟(用Arduino自制一个只有表针)(3)

arduino无时钟模块怎么做时钟(用Arduino自制一个只有表针)(4)

材料准备
  • 步进电机28BYJ-48和驱动板包括
  • 用于控制步进电机的微控制器(比如Arduino nano)
  • 2mm x 10mm自攻螺钉 * 8
  • 润滑脂(高粘性)

这个时钟可以用大多数常见的200 x 200mm打印机打印,除了装饰部分(index.stl,203 x 203mm)。

文章最后还有一个缩小小的版本(85%)。

文中所有的涉及的STL文件可以到文末下载

第1步:打印零件

arduino无时钟模块怎么做时钟(用Arduino自制一个只有表针)(5)

  • 打印零件
  • 有些零件需要支撑
  • 好好去毛刺,特别是几个非常小的齿轮(时钟中心的蜗轮和小齿轮)

相关STL文件可以到文末下载。

第2步:组装蜗杆传动系统

arduino无时钟模块怎么做时钟(用Arduino自制一个只有表针)(6)

  • 用烙铁进行塑料焊接,对于连接gear.stl、axis.stl和worm-gear.stl相互之间是很有用的。
  • 你也可以使用一些安全的胶水,如双组分环氧胶。
  • 在中央齿轮中注入一点油脂。不仅可以减少摩擦,而且可以减少齿隙。
  • 中央齿轮的齿隙对时钟的精确性影响很大。h-gear1.1x.stl比原来的h-gear.stl要大一点,以抑制齿隙。中央齿轮的齿隙对时钟的精确性影响很大。从两个候选中选择更好的小齿轮。h-gear1.1x.stl比原来的h-gear.stl大一点。
第3步:组装电机驱动器

arduino无时钟模块怎么做时钟(用Arduino自制一个只有表针)(7)

  • 如果2毫米自攻螺钉的头部比步进电机的孔小,请使用垫圈或换更大的螺钉。
第4步:啮合分钟旋转器和时钟的主体

arduino无时钟模块怎么做时钟(用Arduino自制一个只有表针)(8)

  • 为了避免齿轮脱落,我们可以翻转机身一侧(上图中的绿色部分),然后把顶部的钩子钩住。
  • 需要使用三颗自攻螺钉安装分钟盖。
第5步:安装时针

arduino无时钟模块怎么做时钟(用Arduino自制一个只有表针)(9)

  • 注意使用自攻螺丝安装时针的时候不要拧太紧了,当你调整时钟时,它应该是会滑动的
  • 固定好其他部分
第6步:准备电路

arduino无时钟模块怎么做时钟(用Arduino自制一个只有表针)(10)

arduino无时钟模块怎么做时钟(用Arduino自制一个只有表针)(11)

arduino无时钟模块怎么做时钟(用Arduino自制一个只有表针)(12)

arduino无时钟模块怎么做时钟(用Arduino自制一个只有表针)(13)

  • 将Nano的端口4、5、6和7连接到步进电机驱动器
  • 连接VCC( 5V)和GND

如果你想把整个电路封闭起来放到盒子里,可以打印零件做个盒子(相关文件放在文末)。

然后用两个2毫米的自攻螺钉来组装起来。

第7步:程序

将代码闪到Arduino上。把代码上传到Arduino IDE 上。

如果你的电机跑错了方向,请修改代码中的数字顺序:

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

改为

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

这上面的数字和Arduino Nano的针脚有关(D4-D7)。

完整代码如下:

// 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] = {4 5 6 7}; // 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; }第8步:测试和调整

arduino无时钟模块怎么做时钟(用Arduino自制一个只有表针)(14)

  • 由于齿轮组有一定的齿隙,因此时针的位置会在左右两边出现偏差。为了解决这个问题,可以在那里插入一些柔软的材料,比如毛毡或海绵,来提供一点摩擦。
  • 在指针上涂上油漆可以提高能见度。颜料型涂料比染料型油墨好,后者会有毛细扩散现象。

你还可以在https://www.thingiverse.com/thing:5142739 的评论中找到一些有用的信息。

第9步:调整时间
  • 用Nano的复位按钮把时间设置提前一分钟
  • 在电机旋转时,再用复位按钮进行精调
  • 时针可以直接用手调整(靠摩擦)
第10步:较小版本(可选)

arduino无时钟模块怎么做时钟(用Arduino自制一个只有表针)(15)

  • 对于较小的3D打印机(如Prusa mini,180x180cm),作者还准备了85%的缩放版本。

STL文件同样打包好了放在下面的链接里。

原文链接:https://www.instructables.com/Hollow-Clock-3/

原项目作者: shiura

译文首发:DF创客社区

https://mc.dfrobot.com.cn/thread-313354-1-1.html?fromuid=830836

开源项目,转载请务必注明项目出处与原作者信息

猜您喜欢: