Skip to content

Latest commit

 

History

History
28 lines (24 loc) · 1.22 KB

File metadata and controls

28 lines (24 loc) · 1.22 KB

MQTT_DHT11_LED

In this lecture, you will learn to publish DHT11 readings from NodeMCU using MQTT, and control LED by listening to a published message.

Step1: Connect NodeMCU, DHT11 and LED

Please connect NodeMCU, DHT11 and LED as shown below.
* DHT11 - GPIO5
* LED - GPIO4
![IMG-8462](https://user-images.githubusercontent.com/11530521/54859738-8e79b800-4d43-11e9-8e4f-55dd2902818b.jpg)

Step2: Upload the code to your NodeMCU

Please change your SSID, password, pubTopic and subTopic as follows:
* pubTopicT = "GROUPNAME/temperature"
* pubTopicH ="GROUPNAME/humidity"
* subTopicLED = "GROUPNAME/LED"

Please use the following group names: * vCANTEEN * LOCKER * PARKING * CUMAP * HYPERBORA * MONKOL

Step3: Connect your MQTT broker and subscribe to the messages

* Please subscribe to your published temperature/humidity topics. You should see the message appearing on the MQTT broker
* Please publish a control message from your MQTT broker to your LED. Your LED should be turned ON/OFF accordingly.
![Screen Shot 2019-03-23 at 8 17 55 AM](https://user-images.githubusercontent.com/11530521/54859849-bc133100-4d44-11e9-9d00-39e5078ab262.png)