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
Step 1) Install NodeMCU photoresistor project as per following tutorial:
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
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)
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.
DownLoad Url osoyoo.com