鱼儿很美,摸鱼儿快乐 
朝九晚五的长时间工作容易让效率变低,我们需要适当“微休息”,上班时间摸鱼就是一种 “微休息行为”,是一种针对心理资源的管理策略。劳逸结合,调节心态,通过短暂的微休息行为来恢复我们整个工作中消耗的心理资源,并获得更多的积极情绪,所以,我认为一定能促进工作效率呢。
但是,大多数领导们对于这种上班行为当然是看不惯,因为很可能不能按时完成工作任务啊。
所以“摸鱼”时,我们的内心一定不可能安定!
为此,这里推荐用“微波运动传感器”来检测我的周围环境动态,做到提前预警,随时切换到工作状态!
查阅到微波运动传感器的优点如下 ~ 微波探测方式与其它探测方式相比:
非接触探测;
不受温度、湿度、噪声、气流、尘埃、光线等影响,适合恶劣环境;
抗射频干扰能力强;
输出功率小,对人体构不成危害;
探测距离远(本模块2-16米);
支持对非生命类物体的检测;
微波的方向性很好,能够穿透任何非金属物体(很容易隐藏它),速度等于光速;
寿命长,大于100000小时,高可靠性、稳定性。
遮蔽物用于隐藏
检测预警灯(红、黄)
接线图(与下面程序相关)
隐藏模块
两个模块配合检测角度更广

- /***********Notice and Trouble shooting***************
- 1.Connection and Diagram can be found here
- <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>
- 2.This code is tested on Arduino Uno, Leonardo, Mega boards.
- 3.arduino Timer library is created by jonoxer.
- See <https://www.dfrobot.com.cn/images/upload/File/SEN0192/20160112134309yy5nus.zip arduino Timer library> for details.
- ****************************************************/
- #include <MsTimer2.h> //Timer interrupt function
- int pbfIn = 0; // Define the interrupt PIN is 0, that is, digital pins 2
- int pbbIn = 1;
- int ledfOut = 10;
- int ledbOut = 11;
- int countf = 0;
- int countb = 0;
- volatile int statef = LOW; //Define ledOut, default is off
- volatile int stateb = LOW;
-
- void setup()
- {
- Serial.begin(9600);
- pinMode(ledfOut, OUTPUT);
- pinMode(ledbOut, OUTPUT);
- attachInterrupt(pbfIn, statefChange, FALLING); // Sets the interrupt function, falling edge triggered interrupts.
- attachInterrupt(pbbIn, statebChange, FALLING);
- MsTimer2::set(100, process); // Set the timer interrupt time 1000ms
- MsTimer2::start();//Timer interrupt start
-
- }
-
- void loop()
- {
- // Serial.println(count); // Printing times of 1000ms suspension
- delay(1);
- if (statef == HIGH ||stateb == HIGH) //When moving objects are detected later, 2s shut down automatically after the ledout light is convenient.
- {
- delay(100); //2000
- if(statef == HIGH){
- statef = LOW;
- digitalWrite(ledfOut, statef); //Turn off led
- }
- if(stateb == HIGH){
- stateb = LOW;
- digitalWrite(ledbOut, stateb); //Turn off led
- }
- }
-
- }
-
-
- void statefChange() //Interrupt function
- {
- countf++;
-
- }
- void statebChange() //Interrupt function
- {
- countb++;
-
- }
-
- void process() //Timer handler
- {
- 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)
- {
- statef = HIGH;
- digitalWrite(ledfOut, statef); //Lighting led
- countf = 0; //Count zero
- }
- 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)
- {
- stateb = HIGH;
- digitalWrite(ledbOut, stateb); //Lighting led
- countb = 0; //Count zero
-
- }
- // else
- // 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.
- }
复制代码
实测
后记:
添加其它传感器,如PIR,就会只检测人员;
由先前运动检测进而人脸识别或走姿识别就可以更准确;
...
|