IOT example: use NodeMCU to connect two devices through internet

Objective:

In this project, we will use NodeMCU boards to connect a light sensor(photoresistor) and a remote LED. When a local photoresistor detects light, NodeMCU will send signal to a remote NodeMCU through MQTT IOT protocol and turn a LED.

Parts and devices:
2 x NodeMCU boards
1 x LED

1 x photoresistor

2 x 1k ohm resistor

Tutorial:

Step 1) Install NodeMCU photoresistor project as per following tutorial:

http://osoyoo.com/2016/12/02/nodemcu-light-sensor-mqtt/

In order to adjust photoresistor sensitivity, you might need to change the value of variable "threhod" in line 26 of nodemcu-Photoresistor Arduino code file

Step 2)Install NodeMCU LED project as per following tutorial

http://osoyoo.com/2016/11/25/remotely-control-led-with-nodemcu-through-mqtt-iot-broker/

Make sure you have set up correct wifi password and hotspot name in above two projects (line 16 and line 17 in arduino code file)

 

Result:

If your photoresistor detects lights, the remote LED will be turned off. If you put a hand to block light over photoresistor, the LED will turned on.

Posted in Arduino Parts & Projects, Tutorial & eBook

Leave a Reply

WordPress spam blocked by CleanTalk.

Meta