How to Turn ON/OFF a Light Bulb with ESP8266

esp8266_lightbulb

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 in the last tutorial with 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 by connecting 3v3 from NodeMCU to VCC pin in relay module, GND from NodeMCU to GND from the relay module and D1 from NodeMCU to In of the 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.

1 thought on “How to Turn ON/OFF a Light Bulb with ESP8266

  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,

    Andjel

Leave a Reply

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

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock