NodeMCU_sensor
IOT project using NodeMCU, raspiberry pi, MQTT and more!
Feauture:
When the door sensor is triggered, send mail to notify me.
Hardware:
NodeMCU -- a firmware based on ESP8266 wifi-soc Raspberry pi
Software:
Arduino IDE
Deploy:
- Install mqtt on Raspberry pi
sudo apt-get install mosquitto mosquitto-clients
- Test MQTT on Raspberry pi
mosquitto_pub -t "ESP8266/sensor/door" -m "{LED: OFF}"
- Install MQTT package for python3
sudo pip3 install paho-mqtt
-
Change the connection info accordingly, such as ssid password... Flash
esp8266_door_sensor.ino
into NodeMCU -
Back to Raspberry pi, run the script
python3 mqtt_sensor_sub.py
- On NodeMCU, connect
D1 (GPIO5)
toGND
to simulate the door closed status and disconnect to simulate the opened status.