要安心“摸鱼” ? 来试试检测微波

2021-07-162.2万
AI 快速预览详细 收起
本文介绍了一种利用微波运动传感器实现办公室摸鱼预警的方法。通过Arduino控制板和微波运动传感器,可以实现对周围环境的动态检测,并在检测到动静时提前预警。该传感器具有非接触探测、不受环境影响、探测距离远等优点,非常适合办公室场景。项目中还提供了详细的接线图和代码示例,方便用户快速上手。


要安心“摸鱼” ? 来试试检测微波图1
鱼儿很美,摸鱼儿快乐


要安心“摸鱼” ? 来试试检测微波图2
朝九晚五的长时间工作容易让效率变低,我们需要适当“微休息”,上班时间摸鱼就是一种 “微休息行为”,是一种针对心理资源的管理策略。劳逸结合,调节心态,通过短暂的微休息行为来恢复我们整个工作中消耗的心理资源,并获得更多的积极情绪,所以,我认为一定能促进工作效率呢。

但是,大多数领导们对于这种上班行为当然是看不惯,因为很可能不能按时完成工作任务啊。

所以“摸鱼”时,我们的内心一定不可能安定!

为此,这里推荐用“微波运动传感器”来检测我的周围环境动态,做到提前预警,随时切换到工作状态!

查阅到微波运动传感器的优点如下 ~
微波探测方式与其它探测方式相比:
非接触探测;
不受温度、湿度、噪声、气流、尘埃、光线等影响,适合恶劣环境;
抗射频干扰能力强;
输出功率小,对人体构不成危害;
探测距离远(本模块2-16米);
支持对非生命类物体的检测;
微波的方向性很好,能够穿透任何非金属物体(很容易隐藏它),速度等于光速;
寿命长,大于100000小时,高可靠性、稳定性。

要安心“摸鱼” ? 来试试检测微波图3

Arduino控制板
要安心“摸鱼” ? 来试试检测微波图5

遮蔽物用于隐藏
要安心“摸鱼” ? 来试试检测微波图4

检测预警灯(红、黄)
要安心“摸鱼” ? 来试试检测微波图6

接线图(与下面程序相关)
要安心“摸鱼” ? 来试试检测微波图8


隐藏模块
要安心“摸鱼” ? 来试试检测微波图7

两个模块配合检测角度更广

要安心“摸鱼” ? 来试试检测微波图9

  1. /***********Notice and Trouble shooting***************
  2.   1.Connection and Diagram can be found here
  3.   <https://wiki.dfrobot.com.cn/index.php?title=%28SKU:SEN0192%29_Microwave_sensor%E5%BE%AE%E6%B3%A2%E4%BC%A0%E6%84%9F%E5%99%A8%E6%A8%A1%E5%9D%97>
  4.   2.This code is tested on Arduino Uno, Leonardo, Mega boards.
  5.   3.arduino Timer library is created by jonoxer.
  6.   See <https://www.dfrobot.com.cn/images/upload/File/SEN0192/20160112134309yy5nus.zip arduino Timer library> for details.
  7. ****************************************************/
  8. #include <MsTimer2.h>           //Timer interrupt function
  9. int pbfIn = 0;  // Define the interrupt PIN is 0, that is, digital pins 2
  10. int pbbIn = 1;  
  11. int ledfOut = 10;
  12. int ledbOut = 11;
  13. int countf = 0;
  14. int countb = 0;
  15. volatile int statef = LOW;       //Define ledOut, default is off
  16. volatile int stateb = LOW;
  17. void setup()
  18. {
  19.   Serial.begin(9600);
  20.   pinMode(ledfOut, OUTPUT);
  21.   pinMode(ledbOut, OUTPUT);
  22.   attachInterrupt(pbfIn, statefChange, FALLING); // Sets the interrupt function, falling edge triggered interrupts.
  23.   attachInterrupt(pbbIn, statebChange, FALLING);
  24.   MsTimer2::set(100, process); // Set the timer interrupt time 1000ms
  25.   MsTimer2::start();//Timer interrupt start
  26. }
  27. void loop()
  28. {
  29. //  Serial.println(count); // Printing times of 1000ms suspension
  30.   delay(1);
  31.   if (statef == HIGH ||stateb == HIGH) //When moving objects are detected later, 2s shut down automatically after the ledout light is convenient.
  32.   {
  33.     delay(100); //2000
  34.     if(statef == HIGH){
  35.       statef = LOW;   
  36.       digitalWrite(ledfOut, statef);    //Turn off led
  37.     }
  38.     if(stateb == HIGH){
  39.       stateb = LOW;   
  40.       digitalWrite(ledbOut, stateb);    //Turn off led
  41.     }
  42.   }
  43. }
  44. void statefChange()  //Interrupt function
  45. {
  46.   countf++;
  47. }
  48. void statebChange()  //Interrupt function
  49. {
  50.   countb++;
  51. }
  52. void process()   //Timer handler
  53. {
  54.   if (countf > 10) //1000ms interrupt number greater than 1 is considered detected a moving object (this value can be adjusted according to the actual situation, equivalent to adjust the detection threshold of the speed of a moving object)
  55.   {
  56.     statef = HIGH;
  57.     digitalWrite(ledfOut, statef);    //Lighting led
  58.     countf = 0; //Count zero
  59.   }
  60.   if (countb > 10) //1000ms interrupt number greater than 1 is considered detected a moving object (this value can be adjusted according to the actual situation, equivalent to adjust the detection threshold of the speed of a moving object)
  61.   {
  62.     stateb = HIGH;
  63.     digitalWrite(ledbOut, stateb);    //Lighting led
  64.     countb = 0; //Count zero
  65.   }
  66. //  else
  67. //    count = 0; //In 1000ms, interrupts does not reach set threshold value is considered not detect moving objects, interrupt the count number is cleared to zero.
  68. }
复制代码
实测


后记:

添加其它传感器,如PIR,就会只检测人员;

由先前运动检测进而人脸识别或走姿识别就可以更准确;

...


image109.360doc.gif (64.83 KB, 下载次数: 3734)

微波运动传感器 · 办公室摸鱼预警系统_image_3.webp

创作许可协议

本项目采用 None(不开放任何权利,保留所有权利) 进行许可。

评论(7)
花生编程
花生编程
不错不错
花生编程
花生编程
厉害厉害
三春牛-创客
三春牛-创客
赞赞赞赞赞
三春牛-创客
三春牛-创客
哈哈,摸鱼神器
三春牛-创客
三春牛-创客
厉害厉害
糖醋花生
糖醋花生
《如果老板看见了》
KIKI
KIKI
为什么要包起来
许培享
许培享
作者
回复KIKI
减少暴露机会呀~全部放在盒子里也可以。
- 没有更多了 -