当前位置:网站首页>Stm32f1 and stm32subeide programming example - ultrasonic distance sensor drive
Stm32f1 and stm32subeide programming example - ultrasonic distance sensor drive
2022-06-29 10:49:00 【Visual intelligence】
Ultrasonic distance sensor drive
Ultrasonic ranging module HC-SR04 Provide 2cm-400cm Non contact measurement function , The ranging accuracy can reach 3mm. The module includes an ultrasonic transmitter 、 Receiver and control circuit .

HC-SR04 My work is very simple and direct . The module sends out 40 KHz Ultrasonic wave of , After being reflected by obstacles , Reflect back to module . By using the propagation time and the speed of sound , We can calculate the distance between the sensor and the obstacle .
HC-SR04 The sequence diagram of the work is as follows :

Combined with the working sequence diagram , We can get HC-SR04 The driving steps are as follows :
- Trig The pin remains high at least 10us
- The module will now send 8 Period 40 kHz The ultrasonic pulse train is used to detect whether there is pulse signal return
- If the signal returns , The module will output a high pulse , Its width will be proportional to the extent of the object .
- The distance can be calculated using the following formula : distance = High pulse time * Speed (340m/s) / 2
- Calculate the formula in centimeters : distance = us / 58
- Calculate the formula in inches : distance = us / 148
- It is recommended to wait at least 60ms Then start the next round of operation .
1、 Ultrasonic distance sensor configuration
Development environment construction 、 System clock configuration 、 Debugging configuration and serial port configuration , Please refer to :
边栏推荐
- BUUCTF--reverse1
- Print prime numbers between 100 and 200 (C language)
- Free books! The best-selling book "Introduction and practice of OpenCV image processing" has been completed
- [200 opencv routines] 214 Detailed explanation of drawing ellipse parameters
- BUUCTF--reverse2
- 高薪程序员&面试题精讲系列117之怎么保证Redis缓存与数据库的数据一致性?
- What happened during the MySQL installation?
- 【C语言进阶】字符串和内存函数(一)
- UserWarning: Usage of dash-separated ‘script-dir‘ will not be supported in future versions. 笔记
- With this tool, automatic identification and verification code is no longer a problem
猜你喜欢

ssh密钥泄露(B模块赛题)——应用服务漏洞扫描与利用

Does your project need automated testing?

Downloading and installing VMware (basic idea + detailed process)

Vmware的下载与安装(基本思路+详细过程)

【评论送书】适合初学者的 6 个有趣的 R 语言项目

BUUCTF--reverse2

AQS之BlockingQueue源码解析

攻防世界-Re-insfsay

Report card of regional industrial Internet market, the second place of Baidu intelligent yunkaiwu

打印100~200之间的素数(C语言)
随机推荐
这个mySQL安装的时候怎么搞去了?
免费送书啦!畅销书《 OpenCV图像处理入门与实践》一本全搞定
arcgis创建postgre企业级数据库
By asp Net core downloading files according to the path
C language printf family
&和&&的区别
BUUCTF--reverse1
How can I get the stock account opening discount? Also, is it safe to open an account online?
BUUCTF RE-easyre
BUUCTF--reverse2
Does anyone encounter this problem when flinkcdc synchronizes MySQL?
js post下载文件
【C语言进阶】文件操作(一)
Comprehensive understanding of synchronized
flink sql cdc 并行度 会不会影响顺序呀,是不是数据同步的话一般只能设置1。
【C语言进阶】自定义类型
AGCTFb部分题解
每日刷题记录 (七)
智能组卷系统设计
Hystrix fuse: Service fusing and service degradation