Building a light-activated relay
Now that we know how to build M2M projects using the ESP8266, we are going to apply it to a simple project, in which you won't even have to press a push button at all. We are going to build a light-activated relay that will control a relay connected to one ESP8266 module depending on the light level measured by another ESP8266. This project will simulate a part of a home automation system, where you automatically want to switch the lights on when it's getting dark outside.
First, we need to assemble both boards. Let's start with the board that will host the relay, as it is the easiest one to assemble:
Simply connect the VCC pin of the relay to the VCC pin of the ESP8266
GND to GND
SIG or EN pin of the relay to pin 5 of the ESP8266
This is the result for this board:
For the board that will host the photocell, first place the ESP8266 on the breadboard, and then the 10K Ohm resistor in series with the photocell on the breadboard as well. Then, connect the common pin...