1 Star 1 Fork 1

Walkline/Distance Relay Wifi

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

超声波测距模块控制继电器

项目介绍

使用 ESP8266 控制超声波测距模块和继电器模块 自动/手动/远程 控制小家电

物料说明

  • MCU使用的是带有ESP8266模块的NodeMCU
  • 超声波测距模块为HC-SR04 模块,驱动电压5V
  • 继电器模块为低电平触发,驱动电压5V

使用说明

在上传代码文件到NodeMCU的时候,务必排除以下文件/文件夹,以节省存储空间

.gitignore
README.md
/images
/web/images

接线图

接线图

使用客户端访问NodeMCU模块

  1. 按照接线示意图连接好所有模块
  2. NodeMCU模块上电
  3. 稍等片刻,蓝色Led灯会闪烁,表示Wifi热点已建立,等待客户端连接
  4. 使用手机或电脑作为客户端连接Wifi热点,热点名称Walkline,密码12345678
  5. 客户端连接成功后蓝色Led灯会停止闪烁
  6. 打开浏览器访问网址http://192.168.4.1:8266,网页内容如图所示
网页内容

如果使用串口工具连接NodeMCU模块,会显示如下调试信息

Wifi access point intialized:
    ssid: Walkline
    password: 12345678

Server started and listening on ('0.0.0.0', 8266)

client connected from ('192.168.4.2', 47566)

- client request: GET / HTTP/1.1
- request file: /
-- file name: /web/index.html
-- file size: 4697
- send response header
- send response file
- file send ok
client connection closed manually

client connected from ('192.168.4.2', 47569)

- client request: GET /js/main.js HTTP/1.1
- request file: /js/main.js
-- file name: /web/js/main.js
-- file size: 18927
- send response header
- send response file
- file send ok
client connection closed manually

client connected from ('192.168.4.2', 47572)

- client request: GET /?query_command=get_status HTTP/1.1
- send js response header
- send js response data
- js response send ok
client connection closed manually

使用客户端控制NodeMCU模块

控制NodeMCU模块主要是使用它控制超声波测距模块和继电器模块,实现远程 / 自动控制继电器模块的目的

远程控制

直接点击页面中的Turn On / Turn Off按钮,就可以实现远程控制继电器

自动控制

点击页面中的Auto按钮,直到Manual按钮变为蓝色,就可以实现自动控制继电器

  • 当人体靠近超声波测距模块30cm位置时,等待约2秒钟,继电器自动激活工作
  • 当人体离开后,等待约3秒钟,继电器将停止工作

手动控制NodeMCU模块

直接使用面包板上的按钮,就可以实现手动控制继电器

MIT License Copyright (c) 2018 Walkline Wang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

使用ESP8266控制超声波测距仪和继电器自动/远程控制小电器 展开 收起
README
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/walkline/Distance_Delay_Wifi-Python.git
git@gitee.com:walkline/Distance_Delay_Wifi-Python.git
walkline
Distance_Delay_Wifi-Python
Distance Relay Wifi
master

搜索帮助