当前位置:网站首页>Intelligent bin (9) - vibration sensor (raspberries pie pico implementation)
Intelligent bin (9) - vibration sensor (raspberries pie pico implementation)
2022-07-31 16:27:00 【light chases rain】
一、模块展示
二、模块说明
此传感器有3个引脚,其中VCC需要接3.3-5V的电压,中间引脚接地,DO引脚是信号输出引脚,我们通过其进行倾斜感应.如上图所示,此传感器自带电源和开关两个LED灯,接通电源后,电源LED灯发光,当传感器触发倾斜时,开关LED灯发光.对于DO引脚,当开关LED发光时,其输出低电平,表示开关打开,当开关LED灯不亮时,其输出高电平,表示开关断开.用其我们可以很方便的实现倾斜断电保护功能.如上图中,此传感器还提供了一个灵敏度的电位调节单元,其工作原理电路图如下所示:
2.1 使用说明
1、产品不震动时,震动开关呈闭合导通状态,输出端输出低电平,绿色指示灯亮;
2、产品震动时,震动开关瞬间断开,输出端输出高电平,绿色指示灯不亮;
三、代码展示
Thanks to the shock sensor onboardLEDflashes too fast,so that it cannot be recognized by the naked eye,So this part callspico上自带的LEDDelay display,make the effect more obvious,But the delay time is too long,It will cause the sensitivity of the shock sensor to decrease,So this test uses 50ms延时
from machine import Pin
import utime
key = Pin(0, Pin.IN)
led_onboard = Pin(25, Pin.OUT)
while True:
while key.value() == 0:
print("no vibration")
led_onboard.value(0)
utime.sleep(0.05)
while key.value() == 1:
print("Vibration is sensed")
led_onboard.value(1)
utime.sleep(0.05)
四、效果展示
4.1 实物展示
emmm……Sensitivity is really bad,But the delay is lowered again,pico上LEDcan't see,Check it out soon,When using it anyway,There will be no delay,The delay is only added here to make the experimental phenomenon more obvious
4.2 代码效果展示
边栏推荐
猜你喜欢
Tencent Cloud Deployment----DevOps
What is the difference between BI software in the domestic market?
仿生毛毛虫机器人源码
LevelSequence源码分析
[Meetup Preview] OpenMLDB+OneFlow: Link feature engineering to model training to accelerate machine learning model development
6-22 Vulnerability exploit - postgresql database password cracking
Unity 之 图集属性详解和代码示例 -- 拓展一键自动打包图集工具
Foreign media right, apple on May be true in inventory
智能垃圾桶(九)——震动传感器(树莓派pico实现)
苹果官网样式调整 结账时产品图片“巨大化”
随机推荐
How does automated testing create business value?
基于ABP实现DDD
npm安装时卡在sill idealTree buildDeps,npm安装速度慢,npm安装卡在一个地方不动
MySQL multi-table union query
Baidu cloud web speed playback (is there any website available)
How Redis handles concurrent access
Oracle dynamically registers non-1521 ports
研发过程中的文档管理与工具
二分查找的细节坑
Qt practical cases (54) - using transparency QPixmap design pictures
arm按键控制led灯闪烁(嵌入式按键实验报告)
Single-cell sequencing workflow (single-cell RNA sequencing)
GP 6 overall architecture study notes
【pytorch】1.7 pytorch与numpy,tensor与array的转换
长得很怪的箱图
LevelSequence源码分析
Delete table data or clear table
BGP综合实验(建立对等体、路由反射器、联邦、路由宣告及聚合)
6-22漏洞利用-postgresql数据库密码破解
苹果官网样式调整 结账时产品图片“巨大化”