当前位置:网站首页>智能垃圾桶(八)——红外对管传感器(树莓派pico)
智能垃圾桶(八)——红外对管传感器(树莓派pico)
2022-07-31 16:13:00 【光追雨】
一、模块展示

二、模块说明
该传感器模块对环境光线适应能力强,其具有一对红外线发射与接收管,发射管发射出一定频率的红外线,当检测方向遇到障碍物(反射面)时,红外线反射回来被接 收管接收,经过比较器电路处理之后,绿色指示灯会亮起,同时信号输出接口输出数字信号(一个低电平信号),可通过电位器旋钮调节检测距离,有效距离范围 2~30cm,工作电压为3.3V-5V。该传感器的探测距离可以通过电位器调节。
三、模块参数说明
- 当模块检测到前方障碍物信号时,电路板上绿色指示灯点亮电平,同时OUT端口持续输出低电平信号,该模块检测距离2~30cm,检测角度35°,检测距离可以通过电位器进行调节,顺时针调电位器,检测距离增加;逆时针调电位器,检测距离减少。
- 传感器主动红外线反射探测,因此目标的反射率和形状是探测距离的关键。其中黑色探测距离最小,白色最大;小面积物体距离小,大面积距离大。
- 传感器模块输出端口OUT可直接与单片机IO口连接即可,也可以直接驱动一个5V继电器;连接方式:VCC-VCC;GND-GND;OUT-IO。
- 可采用3-5V直流电源对模块进行供电。当电源接通时,红色电源指示灯点亮。
四、模块接口说明
1 VCC 外接3.3V-5V电压(可以直接与5v单片机和3.3v单片机相连)
2 GND 外接GND
3 OUT 小板数字量输出接口(0和1)
五、与树莓派的引脚对接
5.1 参照图

5.2 实物图

六、代码展示
from machine import Pin
import utime
key = Pin(0, Pin.IN)
# 配置按键
# key = machine.Pin(id, mode, pull)
# id:树莓派Pico引脚编号
# mode:输入输出方式,有Pin.IN(输入)和Pin.OUT(输出)两种
# pull:上下拉电阻配置,有None(无上下拉电阻)、Pin.PULL_UP(上拉电阻)和Pin.PULL_DOWN(下拉电阻)三种
while True:
while key.value() == 0:
print("somethings")
utime.sleep(1)
while key.value() == 1:
print("Nothing")
utime.sleep(1)
七、效果展示
7.1 实物展示

7.2 代码效果展示

边栏推荐
- 【7.29】Code Source - 【Arrangement】【Stone Game II】【Cow and Snacks】【Minimum Number of Spawns】【Sequence】
- Baidu cloud web speed playback (is there any website available)
- MySQL基础篇【单行函数】
- 11 pinia use
- 上传图片-微信小程序(那些年的坑记录2022.4)
- Grafana安装后web打开报错
- js的toString方法
- mongo enters error
- JVM parameter analysis Xmx, Xms, Xmn, NewRatio, SurvivorRatio, PermSize, PrintGC "recommended collection"
- 长得很怪的箱图
猜你喜欢

利用PHP开发具有注册、登陆、文件上传、发布动态功能的网站

C language - function

EF Core 2.2中将ORM框架生成的SQL语句输出到控制台

MySQL基础篇【单行函数】

外媒所言非虚,苹果降价或许是真的在清库存

After Grafana is installed, the web opens and reports an error

二分查找的细节坑
![[Meetup Preview] OpenMLDB+OneFlow: Link feature engineering to model training to accelerate machine learning model development](/img/f6/311d5a4c70993df6291250d2025d3f.jpg)
[Meetup Preview] OpenMLDB+OneFlow: Link feature engineering to model training to accelerate machine learning model development

t-sne 数据可视化网络中的部分参数+

The use of button controls
随机推荐
2.索引及调优篇【mysql高级】
牛客 HJ16 购物单
Doing things software development - the importance of law and understanding of reasonable conclusions
Single-cell sequencing workflow (single-cell RNA sequencing)
【Meetup预告】OpenMLDB+OneFlow:链接特征工程到模型训练,加速机器学习模型开发
【7.29】代码源 - 【排列】【石子游戏 II】【Cow and Snacks】【最小生成数】【数列】
After the form is submitted, the page does not jump [easy to understand]
ML.NET related resources
[7.28] Code Source - [Fence Painting] [Appropriate Pairs (Data Enhanced Version)]
t-sne 数据可视化网络中的部分参数+
what exactly is json (c# json)
Internet banking stolen?This article tells you how to use online banking safely
arm按键控制led灯闪烁(嵌入式按键实验报告)
Character pointer assignment [easy to understand]
牛客网刷题(一)
Unity 之 图集属性详解和代码示例 -- 拓展一键自动打包图集工具
"Autumn Recruitment Series" MySQL Interview Core 25 Questions (with answers)
The 2nd China PWA Developer Day
OPPO在FaaS领域的探索与思考
ansible学习笔记02