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.


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.


3 thoughts on “ESP8266 NodeMCU – Turn ON/OFF a Light Bulb

  1. Hey Andre,

    Awesome tutorial! Can you please share the values for resistor and transistor?

    I’m connecting my SRD-03VDC to 3.3v ESP 8266.

    Appreciate the answer,


Leave a Reply

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