当前位置:网站首页>Arduino UNO通过电容的直接检测实现简易触摸开关
Arduino UNO通过电容的直接检测实现简易触摸开关
2022-06-27 21:41:00 【perseverance52】
Arduino 通过电容的直接检测实现简易触摸开关

Arduino除了接受数字端口的数字信号,唯一能检测的模拟物理量就是电压。任何模拟传感器的检测值几乎都是通过相关电路转化成电压值,再输入它的模拟端口进行模数转换的。电容值就需要相对更复杂和昂贵的电路转化为电压值,才能被Arduino检测,而对很多物理过程的检测,都可以很方便可靠地通过检测电容值来实现。
实现方法
把一个数字端口设成低电位,并打开arduino的内部上拉电阻,开始计算这个端口到达高电位所需要的时间。而这个时间与此端口的对地电容值有关,电容越大,时间越长。在硬件上只需要在一个端口上连一根导线即可。用手指触摸这段导线的裸露端,就会导致电容变化,arduino可以通过上述方法检测这个变化。如果要增加灵敏度,可以在导线上连一片锡箔。为防止你手上有强静电击穿芯片,可以在锡箔上盖一层薄纸。
示例代码
不需要第三方库
// readCapacitivePin
//输入:Arduino pin number边栏推荐
猜你喜欢

Sentinel
![[tinyriscv verilator] branch transplanted to Da Vinci development board of punctual atom](/img/a8/4786e82d0646b08c195dd0a17af227.png)
[tinyriscv verilator] branch transplanted to Da Vinci development board of punctual atom

【论文阅读|深读】SDNE:Structural Deep Network Embedding

Zero foundation self-study SQL course | case function

什么是cookie,以及v-htm的安全性隐患
![[PCL self study: segmentation4] point cloud segmentation based on Min cut](/img/af/a6c5abf357c1db0718df505499df70.png)
[PCL self study: segmentation4] point cloud segmentation based on Min cut
![用两个栈实现队列[两次先进后出便是先进先出]](/img/de/07297816f1a44d41389bb45d012c80.png)
用两个栈实现队列[两次先进后出便是先进先出]

Safe, fuel-efficient and environment-friendly camel AGM start stop battery is full of charm

炼金术(7): 何以解忧,唯有重构
![[PCL self study: Segmentation3] PCL based point cloud segmentation: region growth segmentation](/img/9e/f08ce0729c89b0205c0ac47c523ad7.png)
[PCL self study: Segmentation3] PCL based point cloud segmentation: region growth segmentation
随机推荐
赛尔笔记|视频文本预训练简述
什么是cookie,以及v-htm的安全性隐患
Halcon's region: features of multiple regions (6)
What are the ways to combine the points system with marketing activities
吴恩达《机器学习》课程总结(13)_聚类
Using two stacks to implement queues [two first in first out is first in first out]
【AI应用】NVIDIA Tesla V100S-PCIE-32GB的详情参数
NDSS 2022 received list
本地可视化工具连接阿里云centOS服务器的redis
现代编程语言:Rust (铁锈,一文掌握钢铁是怎样生锈的)
Smart wind power | Tupu software digital twin wind turbine equipment, 3D visual intelligent operation and maintenance
炼金术(7): 何以解忧,唯有重构
Zero foundation self-study SQL course | complete collection of date functions in SQL
搭建开源美观的数据库监控系统-Lepus
【PCL自学:PCLPlotter】PCLPlotter绘制数据分析图
Teach you how to transplant tinyriscv to FPGA
Sentinel
零基础自学SQL课程 | SQL基本函数大全
Build an open source and beautiful database monitoring system -lepus
Pat class B 1013