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:

Use NodeMCU to publish light sensor value to internet through 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

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)



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.

Leave a Reply

WordPress spam blocked by CleanTalk.
Bombax Theme designed by itx