ESP8266 NodeMCU – Turn ON/OFF a Light Bulb

In this tutorial I will show you how to turn ON and OFF a light bulb using the previous tutorial “ESP8266 NodeMCU – Blinking a LED” and adding a relay module.

Parts Required

If you want to build your own relay module (optional):

Relay Module

The main goal here is to replace the LED used on the last tutorial by a 230V light bulb. In order to do that we will need a relay module. You can buy one from here or build your own module (see the last chapter of this tutorial).

3.3V relay module from Ebay.

Circuit and Schematic

Step 1: Start from connecting 3v3 from NodeMCU to VCC pin in relay module, GND from NodeMCU to GND from relay module and D1 from NodeMCU to In of relay module.

Code

Step 2: Upload the code from last tutorial “ESP8266 NodeMCU – Blinking a LED

Building your own relay module

Relay Module
Relay module schematic.
Relay module PCB designed on Eagle software.

Video

André Martins

Author: André Martins

Born in Azores. Electrical Engineer interested in Automation, Robotics and Embedded Systems subjects. With a degree in Electrical and Computer Engineering in the field of Energy and Automation. Currently in Master's degree in Electrical Engineering.

Leave a Reply

Your email address will not be published. Required fields are marked *