{"id":106432,"date":"2024-10-06T14:48:10","date_gmt":"2024-10-06T06:48:10","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=106432"},"modified":"2024-10-06T14:48:10","modified_gmt":"2024-10-06T06:48:10","slug":"diy-plotter-arduino","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/diy-plotter-arduino.html","title":{"rendered":"\u4f7f\u7528 Arduino \u5236\u4f5c\u4e00\u4e2a\u7ed8\u56fe\u4eea"},"content":{"rendered":"
\u4f7f\u7528\u5f00\u6e90\u786c\u4ef6\u548c\u8f6f\u4ef6\u7684 DIY \u7ed8\u56fe\u4eea\u53ef\u4ee5\u81ea\u52a8\u5730\u7ed8\u5236\u3001\u96d5\u523b\u3002<\/p>\n
<\/p>\n
\u5728\u4e0a\u5b66\u65f6\uff0c\u79d1\u5b66\u7cfb\u7684\u58c1\u6a71\u91cc\u85cf\u7740\u4e00\u53f0\u60e0\u666e\u7ed8\u56fe\u4eea\u3002\u867d\u7136\u6211\u5728\u4e0a\u5b66\u7684\u671f\u95f4\u53ef\u4ee5\u7ecf\u5e38\u4f7f\u7528\u5b83\uff0c\u4f46\u6211\u8fd8\u662f\u60f3\u62e5\u6709\u4e00\u53f0\u5c5e\u4e8e\u81ea\u5df1\u7684\u7ed8\u56fe\u4eea\u3002\u8bb8\u591a\u5e74\u4e4b\u540e\uff0c\u6b65\u8fdb\u7535\u673a\u5df2\u7ecf\u5f88\u5bb9\u6613\u83b7\u5f97\u4e86\uff0c\u6211\u53c8\u5728\u4ece\u4e8b\u7535\u5b50\u4ea7\u54c1\u548c\u5fae\u63a7\u5236\u5668\u65b9\u9762\u7684\u5de5\u4f5c\uff0c\u6700\u8fd1\uff0c\u6211\u770b\u5230\u6709\u4eba\u7528\u4e19\u70ef\u9178\u5851\u6599\uff08acrylic\uff09\u5236\u4f5c\u4e86\u4e00\u4e2a\u663e\u793a\u5668\u3002\u8fd9\u4ef6\u4e8b\u542f\u53d1\u4e86\u6211\uff0c\u5e76\u6700\u7ec8\u5236\u4f5c\u4e86\u6211\u81ea\u5df1\u7684\u7ed8\u56fe\u4eea\u3002<\/p>\n
<\/p>\n
\u6211 DIY \u7684\u7ed8\u56fe\u4eea\uff1b\u5728\u8fd9\u91cc\u770b\u5b83\u5de5\u4f5c\u7684\u89c6\u9891<\/a>[1]<\/span>\u3002<\/em><\/p>\n \u7531\u4e8e\u6211\u662f\u4e00\u4e2a\u5f88\u6000\u65e7\u7684\u4eba\uff0c\u6211\u771f\u7684\u5f88\u559c\u6b22\u6700\u521d\u7684\u00a0Arduino Uno<\/a>[2]<\/span>\u3002\u4e0b\u9762\u662f\u6211\u7528\u5230\u7684\u5176\u5b83\u4e1c\u897f\u7684\u4e00\u4e2a\u6e05\u5355\uff08\u4ec5\u4f9b\u53c2\u8003\uff0c\u5176\u4e2d\u4e00\u4e9b\u6211\u4e5f\u4e0d\u662f\u5f88\u6ee1\u610f\uff09\uff1a<\/p>\n \u8fd9\u662f\u6211\u4f5c\u4e3a\u4e2a\u4eba\u9879\u76ee\u800c\u8bbe\u8ba1\u7684\u3002\u5982\u679c\u4f60\u60f3\u627e\u5230\u4e00\u4e2a\u73b0\u6210\u7684\u5de5\u5177\u5957\u4ef6\uff0c\u4f60\u53ef\u4ee5\u4ece German Make \u6742\u5fd7\u4e0a\u627e\u5230\u00a0MaXYposi<\/a>[10]<\/span>\u3002<\/p>\n \u6b63\u5982\u4f60\u6240\u770b\u5230\u7684\uff0c\u6211\u521a\u5f00\u59cb\u505a\u7684\u592a\u5927\u4e86\u3002\u8fd9\u4e2a\u7ed8\u56fe\u4eea\u5e76\u4e0d\u5408\u9002\u653e\u5728\u6211\u7684\u684c\u5b50\u4e0a\u3002\u4f46\u662f\uff0c\u6ca1\u6709\u5173\u7cfb\uff0c\u6211\u53ea\u662f\u4e3a\u4e86\u5b66\u4e60\u5b83\uff08\u5e76\u4e14\uff0c\u6211\u4e5f\u5c06\u4e00\u4e9b\u4e1c\u897f\u8fdb\u884c\u91cd\u65b0\u5236\u4f5c\uff0c\u4e0b\u6b21\u6211\u5c06\u4f7f\u7528\u4e00\u4e2a\u66f4\u5c0f\u7684\u6a2a\u6881\uff09\u3002<\/p>\n <\/p>\n \u5e26 X \u8f74\u548c Y \u8f74\u8f68\u9053\u7684\u7ed8\u56fe\u4eea\u57fa\u677f<\/em><\/p>\n \u76ae\u5e26\u5b89\u88c5\u5728\u8f68\u9053\u7684\u4fa7\u9762\uff0c\u5e76\u4e14\u7528\u5b83\u5c06\u4e00\u4e9b\u8f85\u52a9\u8f6e\u548c\u7535\u673a\u6302\u5728\u4e00\u8d77\uff1a<\/p>\n <\/p>\n \u7535\u673a\u4e0a\u7684\u76ae\u5e26\u8def\u7531<\/em><\/p>\n \u6211\u5728 Arduino \u4e0a\u5806\u53e0\u4e86\u51e0\u4e2a\u7ec4\u4ef6\u3002Arduino \u5728\u6700\u4e0b\u9762\uff0c\u5b83\u4e4b\u4e0a\u662f FabScan shield\uff0c\u63a5\u7740\u662f\u4e00\u4e2a\u5b89\u88c5\u5728 1 \u548c 2 \u53f7\u7535\u673a\u69fd\u4e0a\u7684 StepStick \u4fdd\u62a4\u88c5\u7f6e\uff0cSilentStepStick \u5728\u6700\u4e0a\u9762\u3002\u6ce8\u610f\uff0cSCK \u548c SDI \u9488\u811a\u6ca1\u6709\u8fde\u63a5\u3002<\/p>\n <\/p>\n Arduino \u5806\u53e0\u914d\u7f6e\uff08\u9ad8\u6e05\u5927\u56fe<\/a>[11]<\/span>\uff09<\/em><\/p>\n \u6ce8\u610f\u5c06\u7535\u673a\u7684\u8fde\u63a5\u7ebf\u63a5\u5230\u6b63\u786e\u7684\u9488\u811a\u4e0a\u3002\u5982\u679c\u6709\u7591\u95ee\uff0c\u5c31\u53bb\u67e5\u770b\u5b83\u7684\u6570\u636e\u8868\uff0c\u6216\u8005\u4f7f\u7528\u6b27\u59c6\u8868\u53bb\u627e\u51fa\u54ea\u4e00\u5bf9\u7ebf\u662f\u6b63\u786e\u7684\u3002<\/p>\n \u867d\u7136\u50cf\u00a0grbl<\/a>[12]<\/span>\u00a0\u8fd9\u6837\u7684\u8f6f\u4ef6\u53ef\u4ee5\u89e3\u91ca\u8bf8\u5982\u50cf\u88c5\u7f6e\u79fb\u52a8\u548c\u5176\u5b83\u4e00\u4e9b\u52a8\u4f5c\u7684 G-codes\uff0c\u5e76\u4e14\uff0c\u6211\u4e5f\u53ef\u4ee5\u5c06\u5b83\u5237\u8fdb Arduino \u4e2d\uff0c\u4f46\u662f\u6211\u5f88\u597d\u5947\uff0c\u60f3\u66f4\u597d\u5730\u7406\u89e3\u5b83\u662f\u5982\u4f55\u5de5\u4f5c\u7684\u3002\uff08\u6211\u7684 X-Y \u7ed8\u56fe\u4eea\u8f6f\u4ef6\u53ef\u4ee5\u5728\u00a0GitHub<\/a>[13]<\/span>\u00a0\u4e0a\u627e\u5230\uff0c\u4e0d\u8fc7\u6211\u4e0d\u63d0\u4f9b\u4efb\u4f55\u4fdd\u4fee\u3002\uff09<\/p>\n \u4f7f\u7528 StepStick\uff08\u6216\u8005\u5176\u5b83\u517c\u5bb9\u7684\uff09\u9a71\u52a8\u5668\u53bb\u9a71\u52a8\u6b65\u8fdb\u7535\u673a\uff0c\u57fa\u672c\u4e0a\u53ea\u9700\u8981\u53d1\u9001\u4e00\u4e2a\u9ad8\u7535\u5e73\u4fe1\u53f7\u6216\u8005\u4f4e\u7535\u5e73\u4fe1\u53f7\u5230\u5404\u81ea\u7684\u9488\u811a\u5373\u53ef\u3002\u6216\u8005\u4f7f\u7528 Arduino \u7684\u672f\u8bed\uff1a<\/p>\n \u5728\u00a0stepPin<\/span>\u00a0\u7684\u4f4d\u7f6e\u4e0a\u662f\u6b65\u8fdb\u7535\u673a\u7684\u9488\u811a\u7f16\u53f7\uff1a3 \u662f 1 \u53f7\u7535\u673a\uff0c\u800c 6 \u662f 2 \u53f7\u7535\u673a\u3002<\/p>\n \u5728\u6b65\u8fdb\u7535\u673a\u80fd\u591f\u5de5\u4f5c\u4e4b\u524d\uff0c\u5b83\u5fc5\u987b\u5148\u88ab\u542f\u7528\u3002<\/p>\n \u5b9e\u9645\u4e0a\uff0cStepStick \u80fd\u591f\u7406\u89e3\u9488\u811a\u7684\u4e09\u4e2a\u72b6\u6001\uff1a<\/p>\n \u7535\u673a\u542f\u7528\u540e\uff0c\u5b83\u7684\u7ebf\u5708\u5df2\u7ecf\u6709\u4e86\u529b\u91cf\u5e76\u7528\u6765\u4fdd\u6301\u4f4d\u7f6e\u3002\u8fd9\u65f6\u5019\u51e0\u4e4e\u4e0d\u53ef\u80fd\u7528\u624b\u6765\u8f6c\u52a8\u5b83\u7684\u8f74\u3002\u8fd9\u6837\u53ef\u4ee5\u4fdd\u8bc1\u5f88\u597d\u7684\u7cbe\u5ea6\uff0c\u4f46\u662f\u4e5f\u610f\u5473\u7740\u7535\u673a\u548c\u9a71\u52a8\u5668\u82af\u7247\u90fd\u201c\u5145\u6ee1\u7740\u201d\u529b\u91cf\uff0c\u5e76\u4e14\u4e5f\u56e0\u6b64\u4f1a\u53d1\u70ed\u3002<\/p>\n \u6700\u540e\uff0c\u4e5f\u662f\u5f88\u91cd\u8981\u7684\uff0c\u6211\u4eec\u9700\u8981\u4e00\u4e2a\u51b3\u5b9a\u7ed8\u56fe\u4eea\u65b9\u5411\u7684\u65b9\u6cd5\uff1a<\/p>\n \u4e0b\u9762\u7684\u8868\u5217\u51fa\u4e86\u529f\u80fd\u548c\u9488\u811a\uff1a<\/p>\n\n
digitalWrite(stepPin, HIGH);\r\ndelayMicroseconds(30);\r\ndigitalWrite(stepPin, LOW);\r\n<\/pre>\n
digitalWrite(enPin, LOW);\r\n<\/pre>\n
\n
digitalWrite(dirPin, direction);\r\n<\/pre>\n