Skip to content

Lua and C++ Code for reading temperature sensor from Node MCU, triggering an e-mail and controlling actuator if an event happens.

License

Notifications You must be signed in to change notification settings

MishraShivendra/node_mcu_control_temperature

Repository files navigation

Notice: This repository is protected with license, corporate/commercial use is restricted.

Interfacing Node MCU with LMT84LP temperature sensor and controlling Actuator

What does it do?

Following objective is achieved:

  1. For monitoring temperature sensor readings on Graphite:
No. Operation File name
1. a) Read temperature readings from LMT84 temperature sensor. read_sensor_update_server.lua
2. a) Read temperature sensor data from HTTP server (Node MCU).
b) Trigger an E-mail if event happens
read_sensor_trigger_email.py
3. a) Push Data to Graphite feed_data_tographite.sh
  1. For storing temperature readings in SQL and controlling actuator:
No. Operation File name
1. a) Read temperature readings from LMT84 temperature sensor.
b) Allow access of temperature with the help of REST APIs
c) Allow control of actuators through Rest APIs
rest_api_control.lua
2. a) Read temperature sensor data from HTTP server (Node MCU).
b) Trigger an E-mail if event happens
read_sensor_trigger_email.py
3. a) Push temperature Data to SQL (And control actuators on web app, plus plot the data) push_pull_app.cpp

How to use?

  1. Load .lua file to node MCU.
  2. Compile .py file in terminal.
  3. Do "make all" in repository folder. It will generate pull_push_app binary, which have to be started at system boot time (wrap this binary with a script kept in init.d).

Supported REST APIs

No. HTTP Method REST APIs Description
1. POST http://nodemcu/power/{PowerLevel} Sets power level of actuator.
Valid Power levels are: on, off, one, two and three.
2. GET http://nodemcu/temp?sensor={SensorNo} Gets temperature from sensor.
Valid sensor numbers for this project are: 1, 2, 3 and 4.

Block Diagram of circuit

Block Diagram

Environment

  1. Node MCU v0.9 and Python 2.7.3
  2. GCC 5.4

Demo Video

Following is a demo video, shows temperature sensor data plotted on Graphite:

IMAGE ALT TEXT HERE