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.
- ESP8266 NodeMCU v1.0
- Micro-USB to USB cable
- 3x Male to female jumper wires
- Light bulb
- 3.3V relay module
If you want to build your own relay module (optional):
- 3.3V Relay (SRD-03VDC-SL-C)
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).
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”