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 ...

Get Internet of Things with ESP8266 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.