回到首页 返回首页
回到顶部 回到顶部
返回上一页 返回上一页

【看见未来】DF回到未来鞋 简单

头像 Anders项勇 2020.07.29 1144 3

步骤1 【项目介绍】

能够自动系紧鞋带的鞋子,是电影《回到未来》中成功预言的产品之一,男主下车穿鞋子那一刻,瞬间惊呆。耐克前几年成功把它商品化,又一个科幻变现实的经典案例。 耐克的这个鞋能按钮控制、手机控制鞋带松紧,看起来很酷,但价格要快3k了。那么能不能改进下,变成更便宜、更酷、更方便的未来鞋?有DF准备的各种神奇传感器怕啥,只要打开你的想象力就好了,让我们来开始DF回到未来鞋的诞生之旅:)

project-image
project-image
project-image
project-image

步骤2 【解决方案】

1.控制方式:耐克的按钮控制、手机控制看起来很酷,但对于使用场景是不是不太适合?蹲下找按钮?打开手机app找控制?太繁琐了吧,开动想象力,啥也不要,手挥两下不行吗?让我们来用DF最新的PAJ7620U2 手势识别传感器,绝对挥一挥手,不带走一丁点鞋臭:)

2.主板:因为要控制体积,控制芯片我们采用小巧的Beetle-ESP32控制器,由于带wifi、蓝牙功能,结合blynk app也能能快速实现手机的智能控制,但我们这个项目不使用手机控制,感觉不方便,把简单的事情搞复杂了反人类。

3.控制电机:用TB6612FNG微型双路直流电机驱动模块来控制电机,如果要进一步缩小体积,可以省掉这个,主板直接接360度舵机。

4.电机:使用小型乐高电机。

整个方案就是:手势传感器检测手部动作控制电机的启动(手快速挥动)、关闭(手下压)、鞋带松(手逆时针转动)、鞋带紧(手顺时针转动)

步骤3 【作品演示】

1.成品演示:

2.原型测试:

步骤4 【制作过程】--材料清单

材料清单

  • Beetle-ESP32控制器 X1 链接
  • PAJ7620U2 手势识别传感器 X1 链接
  • TB6612FNG微型双路直流电机驱动模块 X1 链接
  • 3.7V电池 新型锂子化学聚合充电锂电池 X1 链接
  • 乐高电机 X1
  • DF包装盒 X1
  • 杜邦线若干 X1
  • 乐高小结构件穿鞋带用 X1

步骤5 【制作过程】--搭建连接

设计:

project-image
project-image

组装:

project-image
project-image
project-image
project-image
project-image
project-image
project-image

鞋带注意穿过乐高的小结构件绑起来。把所有连接好后塞入DF的小盒子,大盒子很多人用来做作品,小盒子还没人用过:),刚好还有个DF的logo,黑色看起来也很酷。


步骤6 【制作过程】--编程

这里用arduino编程,思路简单:获得手势传感器返回的手势对应编号来控制电机动作。

代码
/*!
 * @file GestureRecognize_HighRate.ino
 * @brief Present the 9 built-in gestures data the sensor supports.
 * @n Wave your hand above the sensor (within 0~20cm), it can recognize 9 kinds of gestures: move up, down, left, right, forward,
 * @n backward, clockwise, anti-clockwise, wave.
 * @n For more usages of the sensor, refer to the description about setGestureHighRate in function setup.
 *
 * @copyright   Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
 * @licence     The MIT License (MIT)
 * @author      Alexander(ouki.wang@dfrobot.com)
 * @version  V1.0
 * @date  2019-07-16
 * @get from https://www.dfrobot.com
 * @url https://github.com/DFRobot/DFRobot_PAJ7620U2
 */

#include <DFRobot_PAJ7620U2.h>

DFRobot_PAJ7620U2 paj;

//设置通道 0
#define MOTOR_CHANNEL_0 0
//设置 13 位定时器
#define MOTOR_TIMER_13_BIT 13
//设置定时器频率位 5000Hz
#define MOTOR_BASE_FREQ 5000
//设置 MOTOR
#define MOTOR_PIN D2
#define DIR1 D3

int motor_move = 0; // how move the motor is
int fadeAmount = 5; // how many points to fade the motor by

//设置 motor的速度
void motorAnalogWrite(uint32_t value, uint32_t valueMax = 255) {
 //计算占空比
 uint32_t duty = (MOTOR_BASE_FREQ / valueMax) * min(value, valueMax);
 //设置占空比
 ledcWrite(MOTOR_CHANNEL_0, duty);
}

void setup()
{
  pinMode(DIR1, OUTPUT);
  Serial.begin(115200);
  delay(300);
  Serial.println("Gesture recognition system base on PAJ7620U2");
  while(paj.begin() != 0){
    Serial.println("initial PAJ7620U2 failure! Please check if all the connections are fine, or if the wire sequence is correct?");
    delay(500);
  }
  Serial.println("PAJ7620U2 init completed, start to test the gesture recognition function");

  /*Set fast detection mode
   *If the parameter is set to false, the module enters slow detection mode, and it detects one gesture every 2s. We have integrated
   *some gestures inside the module to make it convenient for beginners.
   *The slow mode can recognize 9  basic gestures and 4 expanded gestures: move left, right, up, down, forward, backward, clockwise,
   *counter-clockwise, wave, slowly move left and right, slowly move up and down, slowly move forward and backward,
   *wave slowly and randomly.
   *
   *
   *
   *If the parameter is set to true, the module enters fast detection mode.
   *The fast mode can recognize 9 gestures: move left, right, up, down, forward, backward, clockwise, counter-clockwise, wave
   *To detect the combination of these gestures, like wave left, right and left quickly, users needs to design their own algorithms logic.
   *Since users only use limited gestures in this mode, we are not going to integrate too much expanded gestures in the library.
   *If necessary, you can complete the algorithm logic in the ino file by yourself.
   */
  paj.setGestureHighRate(true);

  ledcSetup(MOTOR_CHANNEL_0, MOTOR_BASE_FREQ, MOTOR_TIMER_13_BIT);
  ledcAttachPin(MOTOR_PIN, MOTOR_CHANNEL_0);

}

void loop()
{
  /* Read gesture number(return eGesture_t enumerated type)
   * eGestureNone  eGestureRight  eGestureLeft  eGestureUp  eGestureDown  eGestureForward
   * eGestureBackward  eGestureClockwise  eGestureAntiClockwise  eGestureWave  eGestureWaveSlowlyDisorder
   * eGestureWaveSlowlyLeftRight  eGestureWaveSlowlyUpDown  eGestureWaveSlowlyForwardBackward
   */
  DFRobot_PAJ7620U2::eGesture_t gesture = paj.getGesture();
  if(gesture != paj.eGestureNone ){
   /* Get the string descritpion corresponding to the gesture number.
    * The string description could be
    * "None","Right","Left", "Up", "Down", "Forward", "Backward", "Clockwise", "Anti-Clockwise", "Wave",
    * "WaveSlowlyDisorder", "WaveSlowlyLeftRight", "WaveSlowlyUpDown", "WaveSlowlyForwardBackward"
    */
    String description  = paj.gestureDescription(gesture);//Convert gesture number into string description
    Serial.println("--------------Gesture Recognition System---------------------------");
    Serial.print("gesture code        = ");Serial.println(gesture);
    Serial.print("gesture description  = ");Serial.println(description);
    Serial.println();
    if  (gesture == 64) { //顺时针紧鞋带
      digitalWrite(DIR1, LOW);
      }
    else if (gesture == 128) {  //逆时针松鞋带
      digitalWrite(DIR1, HIGH); 
      }
    else if (gesture == 256) { //快速挥手启动
      motor_move = 255; 
      }
    else if (gesture == 16) { //下压停止
      motor_move = 0; 
      }
  }

  
  motorAnalogWrite(motor_move);
  
  delay(30);

    
}

步骤7 【项目总结】

本项目实现了手势控制鞋带的功能,日常使用起来比原版的按钮和手机方式交互操作更方便,更进一步走向未来:)我们再重点分析下还能加上哪些可行的自动功能。 

 头脑风暴一下后续还可以加上一些自动功能,如: 

 1.喜欢手机控制的可以加上手机控制,具体只要在代码里改改,可参考我上一个水冷背包的项目。 

2.增加压力传感器,脚底、脚面布设,根据脚底的探测穿入了鞋,启动电机松开。脚面的回馈压力实时根据运动自动调整松紧。 

3.无线充电,这个加入DF的充电模块就可以。 

4.后续把芯片传感器、线路、绕鞋带机构再小型化,完全可以挖个小坑,塞入到鞋子底下。 

5.加上音乐功能。

6.加上LED灯,没啥,就是酷。代码加上判断时间,晚上自动亮起,晚上走路也安全。灯的形状就显示成DF形状吧:)

 ......

 小伙伴们,开动想象力动起来,继续看见未来、回到未来!

评论

user-avatar
  • DFHJM_IpFmV

    DFHJM_IpFmV2020.07.31

    超赞的作品👍

    0
    • gray6666

      gray66662020.07.29

      很赞。。。。。。

      1
      • DFHJM_IpFmV

        DFHJM_IpFmV2020.07.31

        既然很赞,那你为什么不收藏一个呢?🤭