Git Product home page Git Product logo

nodemcu-air-monitor's Introduction

AirMonitor

该项目用于NodeMCU和攀藤的PTQS1005传感器(PM2.5,TVOC,甲醛,CO2,温度和湿度)网页显示和连接乐为物联显示的简单实例

使用教程

  • 上电后打开手机或者带wifi的pc 搜索 wifi;ssid为 ESP8266_*,password是12345678
  • 连接后,网页代开192.168.4.1
  • 网页上配置本地要连接的wifi的ssid和passwd,乐为物联的gateWay和uesrKey(如果不需要乐为物联可以不填)
  • 手机或者带wifi的pc切换到本地wifi。可以直接网页打开nodemcu的IP地址(可以通过路由器网页获得)查看AirMonitor的状态, 也可以直接登录乐为物联来查看AirMonitor的状态(有图表统计还优化手机网页端)
  • 乐为物联教程

已经实现功能

  • 掉电重启后能保存住配置好的wifi的ssid和passwd,乐为物联的gateWay和uesrKey,不需要重新配置,既可以继续工作

  • 按flash键,能重置

未实现的功能

  • 每3min采样传感器,其余时间让传感器休眠

文件列表

  • init.lua nodemcu入口
  • ConfigWeb.lua 网页配置wifi和乐为物联的网关和userkey
  • Sensor.lua 与PTQS1005串口通信,并定时调用LeweiMqtt上传传感器信息
  • LeweiMqtt.lua 连接乐为物联上传传感器信息 参考github工程
  • telent_srv.lua 可以通过luatool.py上传lua代码到nodemcu
  • luatool.py 使用TCP/IP的方式上传代码到nodeMCU: github原工程

wget https://raw.githubusercontent.com/4refr0nt/luatool/master/luatool/luatool.py 使用该命令下载luatool.py到本地

写code坑点

  • 虽然串口有01两个,但是1串口不能接收数据

    • 0被使用时,1串口能否被print函数使用做debug?
  • 要考虑程序突然异常挂了,重启后能连接wifi和服务,所以要保存wifi的ssid和passwd等到flash上

  • flash按键删除wifi的ssid和passwd等其他信息可以重置wifi或者服务

IO index ESP8266 pin IO index ESP8266 pin
0 [*] GPIO16 7 GPIO13
1 GPIO5 8 GPIO15
2 GPIO4 9 GPIO3
3 GPIO0 10 GPIO1
4 GPIO2 11 GPIO9
5 GPIO14 12 GPIO10
6 GPIO12

from https://nodemcu.readthedocs.io/en/master/en/modules/gpio/

nodemcu-air-monitor's People

Contributors

xiaohaoliang avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.