首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >如何手动养成一只「咖啡女仆」?丨全套攻略+材料清单

如何手动养成一只「咖啡女仆」?丨全套攻略+材料清单

作者头像
量子位
发布2019-04-24 18:27:18
3710
发布2019-04-24 18:27:18
举报
文章被收录于专栏:量子位量子位量子位
原作者 Valentin Fg 郭一璞 编译 量子位 出品 | 公众号 QbitAI

“两杯美式,谢谢。”

“主人的两杯咖啡好啦,欢迎品尝~”

醒醒,你不是在看日漫,你家里也没有咖啡女仆。

不过,作为万能的工程师,自己DIY也不是不可以。硬件爱好者Valentin Fg就把家里的咖啡机改装成了“咖啡女仆”,只要一句话,不用跑去咖啡机旁自己动手做,TA就乖乖地开始给你做咖啡。

后来,他还整理了一份DIY咖啡女仆攻略,只要7步就可完成。

Step 1:剁手一些物料

首先,你需要一台咖啡机。作者选用的是德龙的Delonghi Ecam 22.140B型号,国内电商也有这个牌子。

然后,你需要买五块控制器,分别是:

树莓派3B+主板,亲测某宝可购。

ReSpeaker 2-Mics Pi HAT,适配树莓派的双麦克风扩展板,可以拿来做AI语音应用。

Arduino nano,一款基于ATmega328P(Arduino Nano 3.x)的小型主板。

8通道继电器板

步进电机+控制板

另外还需要充电器、microSDHC卡、USB 2.0转接线、8x8耦合器、一些18AWG导线(最好是红黑的)、2xM3x15螺丝钉、2xM3x45螺丝钉。

然后准备一些工具,包括一个热熔胶枪、不同尺寸的一套钻头、一台电磨机、一些热缩套管、一个电烙铁、一个飞利浦螺丝刀、一个Torx TS 20螺丝刀,另外最好有3D打印机,没有的话就去万能的某宝找人帮你做。

Step 2:拆咖啡机

现在,可以把买来的咖啡机大卸八块了(别哭,后面我们还会装回去)。

先把后面的这五个螺丝拧下来,注意螺丝钉不要丢。

然后可以吧咖啡机的“左脸”和“右脸”悄咪咪往后滑动拖下来。

现在把固定“头盖骨”的两个螺丝拧下来,先不要着急掀起咖啡机的头盖骨。

这个时候,你会发现咖啡机的“右脸颊”有一个用于固定“头盖骨”的螺丝钉,把它拧下来。“左脸颊”也有一个,同样拧下来。

然后把蒸汽主开关拉向你站立的方向,取下来。

现在可以掀起咖啡机的“头盖骨”啦!

掀完之后,可以“面对”你的咖啡机正脸,把左右两侧的两个螺丝拧下来。

再把面板背面的4个螺钉拧下来。面板左右两侧有两个灰色的塑料卡,取下面板的时候轻一点不要弄坏它们,不然就装不回去了。

面板下面的PCB板右上角有个连接处,轻轻地把它拔出来。

完美,现在你的咖啡机成功被大卸八块了。

Step 3:前面板焊接

现在,你可以把咖啡机正脸上的面板拿下来,准备加工它了。

先在面板上戳5个洞,位置如下图。注意洞的大小,需要保证两根18AWG导线通过。

现在,拿起你的电烙铁,开始把导线焊道面板按钮下面的引脚处,面板上7个按钮分别连一对红黑导线。

Step 4:把咖啡机的脸再装回去

先装按钮和透明壳,注意导线的站位,不要卡住。

不过,考虑到反正你要用语音控制咖啡机了,不装按钮也不会怎样,略略略略略~

这块面板的背壳也要和面板一样,戳一些洞洞,方便导线通过。

现在,在咖啡机外壳正脸的最上方中央戳个半圆的洞,也是为了过导线。

另外,作者还3D打印了一个部件,这个部件的下边中央是另外一个半圆。

两个半圆的位置如下图红色大圆圈所示,而两个红色小圆圈的位置需要打直径2.8毫米的孔。

现在,可以把正面的PCB板、外壳等连在一起了。电线留20厘米左右的长度。

用M3x15螺丝钉将步进电机固定到3D打印部件上。

在步进机的尖端添加耦合器(暂不夹紧)。使用M3X45螺钉将3D部件固定到正面外壳上。

现在,把所有电线顺到咖啡机右侧,把整个咖啡机正面装回卡飞机上,注意现在也不要夹住耦合器。

Step 5:原理和安装

下面是整体的电路图,可以按照这个来连接导线。

连好之后,可以把所有器件一股脑儿塞在咖啡机的右侧,当然要保证里面没有短路的情况,然后找个合适的位置,拿热熔胶固定好。

Step 6:写代码和安装程序

可以直接复制这段声控代码

  1#include <Wire.h>
  2#include <Stepper.h>
  3
  4#define STEPS 64
  5#define REVOLUTION 2048
  6#define SLAVE_ADDRESS 0x04
  7
  8//naming Arduino pin
  9int ONOFF = 2;
 10int x1short = 3; // button for 1 short coffee
 11int x2short = 4; // button for 1 short coffee
 12int clean = 5; // button clean
 13int vape = 6; // button vape
 14int x1long = 7; // button for 1 long coffee
 15int x2long = 8; // button for 2 long coffee
 16
 17int count = 0;
 18int number = 0;
 19int state = 0;
 20int steps = 0;
 21int max_step = (int)(250.0 / 180.0 * (float)REVOLUTION / 2.0);
 22int nb_step = 330;
 23Stepper stepper(STEPS, 9, 11, 10, 12);
 24
 25int servo_pos = 0;
 26
 27void setup() {
 28  // start serial for output
 29  Serial.begin(9600);
 30  Serial.println("Ready!");
 31
 32  // setup pin Mode
 33  pinMode(ONOFF, OUTPUT);
 34  pinMode(x1short, OUTPUT);
 35  pinMode(x2short, OUTPUT);
 36  pinMode(x1long, OUTPUT);
 37  pinMode(x2long, OUTPUT);
 38  pinMode(vape, OUTPUT);
 39  pinMode(clean, OUTPUT);
 40
 41  //set default status
 42  digitalWrite(ONOFF, HIGH);
 43  digitalWrite(x1short, HIGH);
 44  digitalWrite(x2short, HIGH);
 45  digitalWrite(x1long, HIGH);
 46  digitalWrite(x2long, HIGH);
 47  digitalWrite(vape, HIGH);
 48  digitalWrite(clean, HIGH);
 49  stepper.setSpeed(200);
 50  stepper.step(0);
 51  turn_right(1);
 52  turn_left(1);
 53}
 54
 55/*
 56 * Run undefinitly
 57 */
 58void loop() {
 59  if (Serial.available() > 0) {
 60    // read the incoming byte:
 61    int incomingByte = Serial.read();
 62    if (incomingByte == 'B') {
 63      // command have to start with 'B'
 64      number = 0;
 65      count = 0;
 66    } else if (incomingByte == 'E') {
 67      // command have to end with 'E'
 68      start_coffee(number);
 69      number = 0;
 70      count = 0;
 71    }
 72    else if (incomingByte >= '0' && incomingByte <= '9') {
 73      // save as an int all the character coming from Serial
 74      int tmp = incomingByte - '0';
 75      number *= 10;
 76      number += tmp;
 77      count++;
 78    }
 79  }
 80}
 81
 82/*
 83 * Utils 
 84 */
 85
 86/*
 87 * turn the stepper motor to the left
 88 */
 89void turn_left(int v) {
 90  Serial.println("turn left\n");
 91  if (v == 0)
 92    return;
 93  if (v == 1) {
 94    stepper.step(400);
 95    return;
 96  }
 97  if (v == 2) {
 98    stepper.step(800);
 99    return;
100  }
101  if (v == 3) {
102    stepper.step(1300);
103    return;
104  }
105}
106/*
107 * turn the stepper motor to the right
108 */
109void turn_right(int v) {
110  Serial.println("turn right\n");
111  if (v == 0)
112    return;
113  if (v == 1) {
114    stepper.step(-400);
115    return;
116  }
117  if (v == 2) {
118    stepper.step(-800);
119    return;
120  }
121  if (v == 3) {
122    stepper.step(-1300);
123    return;
124  }
125}
126
127/*
128 * simulate push a button
129 */
130void touch_button(int pin) {
131  digitalWrite(pin, LOW);
132  Serial.print(" touchdown\n");
133  delay(500);
134  digitalWrite(pin, HIGH);
135}
136
137/*
138 * simulate push button for 2 short coffees
139 */
140void touch_x2() {
141  Serial.println("touch x2\n");
142  touch_button(x2short);
143}
144/*
145 * simulate push button for 2 long coffees
146 */
147void touch_x2_long() {
148  Serial.println("touch x2 long\n");
149  touch_button(x2long);
150}
151/*
152 * simulate push button for 1 short coffee
153 */
154void touch_x1() {
155  Serial.println("touch x1\n");
156  touch_button(x1short);
157}
158/*
159 * simulate push button for 1 long coffee
160 */
161void touch_x1_long() {
162  Serial.println("touch x1 long\n");
163  touch_button(x1long);
164}
165
166/*
167 * simulate push button for cleaning
168 */
169void touch_clean() {
170  Serial.println("touch rince\n");
171  touch_button(clean);
172}
173
174/*
175 * simulate push button for on and off
176 */
177void onoff() {
178  Serial.println("turn on/off\n");
179  touch_button(ONOFF);
180}
181
182/*
183 * Select the intensity fort the coffee by moving the stepper motor
184 * 0 -> mild
185 * 1 -> standard
186 * 2 -> strong
187 * 3 -> extra strong
188 */
189void select_intensity(int intensity) {
190  turn_right(intensity);
191}
192
193/*
194 * Set the stepper motor to its default position
195 */
196void default_intensity(int intensity) {
197  turn_left(intensity);
198}
199
200/*
201 * compute int into order
202 */
203void start_coffee(unsigned int type) {
204  int number = type % 10;
205  int coffee_type = type / 10 % 10;
206  int coffee_size = type / 100 % 10;
207  int intensity = type / 1000 % 10;
208  int special = type / 10000 % 10;
209  Serial.print(type);
210  if (special != 0) {
211    switch (special) {
212      case 1:
213        onoff();
214        return;
215    }
216  } else if (coffee_type == 9) {
217    select_intensity(intensity);
218    if (number == 1)
219      if (coffee_size == 1)
220        touch_x1();
221      else
222        touch_x1_long();
223    else if (coffee_size == 1)
224      touch_x2();
225    else
226      touch_x2_long();
227    delay(20000);
228    default_intensity(intensity);
229  }
230}

之后需要设置一下你的树莓派主板,确保它安装了Raspbian Stretch Lite。

然后在树莓派主板上设置Snips语音平台,先连上网,然后启用SSH,安装SAM。

把Snips要安装在SAM上,重启即可启动,把上面的咖啡机程序装进Snips控制台。

Step 7:喝咖啡走起

现在大功告成啦,连上电源,打开树莓派程序,打开咖啡机,你就可以“点”一杯咖啡试试:

“Hey Snips,我要两杯咖啡,蟹蟹。”

传送门

作者原文: https://medium.com/snips-ai/your-personal-home-barista-comes-to-life-with-this-voice-enabled-coffee-machine-5fc333326f31

内附各种亚马逊链接,不过大家完全可以去(准备退休的)马爸爸那里剁手。

就酱,做手工愉快~

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2018-09-25,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 量子位 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Step 1:剁手一些物料
  • Step 2:拆咖啡机
  • Step 3:前面板焊接
  • Step 4:把咖啡机的脸再装回去
  • Step 5:原理和安装
  • Step 6:写代码和安装程序
  • Step 7:喝咖啡走起
  • 传送门
相关产品与服务
图像处理
图像处理基于腾讯云深度学习等人工智能技术,提供综合性的图像优化处理服务,包括图像质量评估、图像清晰度增强、图像智能裁剪等。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档