【造物笔记】会自己动手写字的钟

前两期向大家推荐了
3D打印机和航模
这两个东西相对比较复杂
一般新手都只能在网上买套件做
所以这一期向大家介绍的
是一个比较简单的东西
叫做"plotclock"
如果直译过来
应该是“绘图钟”
但是它往往被叫做“小贱钟”
原因就是它工作的样子有点贱贱的感觉
大家体会一下:

大家不难看出
它的驱动元件就是上期介绍的舵机
其实舵机虽然顾名思义
是用来驱动舵面的
但实际上很多小型机器人也在使用

究其原因
主要是舵机运动精度高
控制方便而且成本低
plotclock一共用到了三个舵机
其中两个用于控制臂的运动
一个用于提笔

除了舵机以外
它的机械部分十分简单
使用板材切割就可以加工
这个东西在网上也可以买到套件
但是笔者今天想给大家分享的
是如何从源头开始做起
话不多说直接上教程
首先是准备工作
由于这个东西是一个开源项目
我们可以免费获取它的图纸
这个项目的网址是
https://www.thingiverse.com/thing:248009
上去后可以看到这样一个页面

我们点击蓝色的

会下载一个plotclock.zip文件

解压后目录下有这几个文件

我们打开files文件夹
可以看到有几个文件

第一个PDF文件就是加工图纸
但是我们采用激光切割时
一般需要提供CAD格式的文件
我们需要进行格式转换
我们打开迅捷PDF转换器
https://app.xunjiepdf.com/
点击下面的PDF转CAD

然后点击选择文件并上传
选中刚才的PDF文件
下面参数保持默认

转换完成后点“立即下载”
即可得到一份.dwg文件
然后在淘宝搜索亚克力定做
将dwg文件发给商家
厚度选择3mm
与商家谈好价格即可
根据笔者经验
这个价格应该在20-50元左右
如果报价太高可以货比三家
不同商家差价可能有几倍

后面说说舵机选型
前面航模篇讲过
舵机要和安装孔尺寸相匹配
在模型中安装孔尺寸为23*12.8
所以选用SG-90 9g舵机


舵机选好以后
剩下的就只有电路了
电路板采用的是
3d打印篇介绍的arduino
本次采用的是arduino UNO

值得注意的是
arduino分国产和意大利原产的
价格差5倍左右
所以我们一般买国产的
但是国产的用的是CH340串口芯片
所以要安装CH340芯片驱动
我们进入该芯片官网
http://www.wch.cn/products/CH340.html
点击下载驱动并安装


前面提到的几个文件中
有一个后缀名为.ino的文件
这个就是arduino的源代码文件
要打开这个文件我们需要安装
arduino的集成开发环境(IDE)
我们进arduino官网下载
https://www.arduino.cc/en/main/software
由于是境外网站速度可能有点慢
但是可以正常使用
下载完一路next安装即可


安装好以后先接上开发板
打开plotclock_v1_03.ino就能进入软件
进入软件以后
我们首先更改开发板类型
然后再更改端口
如果有多个端口
可以在“我的电脑”右键“管理”
选择设备管理器->端口
有ch340那个就是



设置完成以后
我们点击左上角那个向右的箭头
IDE会自动帮我们编译和上传
所有步骤完成以后
我们就可以开始组装了
在组装时我们会发现少一个零件
就是擦掉字的白板擦
这个零件作者给了一个stl文件
意思是需要我们自己3d打印
如果没有打印机可以淘宝
但是可能成本较高
大家可以用形状相似的物体代替

关于安装过程
作者在images目录下有几张特写
由于零件较少,安装简单
相信大家能够意会
进阶教程
在完成以后我们发现
虽然plotclock可以正常写时间了
但是它在断电以后是不能继续走时的
所以我们要加一个实时时钟(RTC)
这里我们选用ds1307模块

注意大家不要买成ds1302了
两者接口是不兼容的
然后我们打开之前的.ino文件
大家注意这两行代码

第一行里面有一个网址
是教你怎么使用RTC库的
大家按照网页说明安装
然后连接好硬件后
需要将
//#define REALTIMECLOCK
前面的注释符去掉
然后再重新编译上传
这样就完成了实时时钟的添加
高级教程
如果大家真的
把前面的步骤都实践了
相信大家已经有一定的
嵌入式开发能力了
如果你想把plotclock
作为一个特别的礼物
让它写出你想要的字
我们可以修改代码
写字的代码是这样

在此做简单解释
drawTo函数就是直线移动到某一点
bogenGZS函数用于画圆
lift函数用于提笔
参数1是提笔,0是放笔
有了这些知识
剩下的就是笔画怎么排布了
大家可以利用坐标纸规划路径
然后修改loop()函数
就可以让小贱钟
替你说出你想说的话了
尾声
由于这次是教大家从头做起
所以虽然东西简单
做起来难度还是有的
不过我保证
如果真的动手做完了
一定会有收获
如果想动手但囿于能力有限
需要一定技术支持的
可以在评论区联系笔者
我们会为有兴趣的人提供帮助

资料来自于网络,如有侵权请告知
- END -
文字&排版 | 李家靖
审核 | 李莎

推荐阅读
科学研究方法论坛:跨越巅峰,展望未来
研科协《科学研究方法论坛》品牌讲座十二年总结回顾

【GAST科普】朋友,要来一杯咖啡吗?
看了这篇推送可能会上瘾......

【GAST科普】又到换电脑的季节了
买电脑前必看的tips

--end--
声明:本文章由网友投稿作为教育分享用途,如有侵权原作者可通过邮件及时和我们联系删除:freemanzk@qq.com