0706-717-7450 || hello@nerdshed.com.ng

Control an A.C Light Bulb Over The Internet from a Smartphone

WARNING! WARNING! WARNING!

High voltage 240V. Exercise caution

In this article, we’ll control an AC light over the Internet using NodeMCU board and Blynk App.

Why do we use relay to control an A.C light bulb?

A.C the 220V supplied by utility (PHCN) cannot be controlled directly from the The NodeMCU board (which operates at 3V). The relay is an electromagnetic switch that electronically controls power applied to loads, in this case an AC bulb.

A relay has NO, NC and COM, what do they mean?

  • COM – Common, as the name suggests is common to both NC and NO terminals.
  • NO – Normally Open is normally open until power is applied to the relay’s coil, so current does not flow until the relay is activated.
  • NC – The Normally Closed terminal allows current to flow until the current is applied to the relay at which case it goes off.
                                       
                                                          Relay terminals

For the purpose of this tutorial, I’ll be using COM and NO.

You’ll need the following to carry out this project

Hardware

  • NodeMCU 12-E board, get here
  • 5V DC, 10A 250V AC relay module. get it here
  • 2N7000 MOSFET, get it here
  • 4.7k Ohm resistor.
  • An A.C light bulb.
  • 10 mm wires.

Software

  • Blynk app, refer to this article here if it’s your first time working with Blynk
  • Latest Arduino IDE, get it here

STEP 1: CIRCUITRY

Please note: The purpose of the transistor is to invert the output of the NodeMCU (The relay is coil is activated when logic 0 is sent in and vice versa). Also it shifts the voltage level to 5V-0V, the relay operates at 5V.

nodemcu relay circuit
                                                                        nodemcu relay circuit

STEP 2: Setting up BLYNK

We will be using Blynk app to control the A.C bulb over the internet. I showed you how to set up Blynk and create a button, if you missed it you can check it out here. For the purpose of this tutorial, we would be using the button we created. If you’ve set up Blynk successfully which entails getting your AUTH TOKEN, you can move to the next step.

(NOTE: SAVE THE TOKEN, IT CAN BE REUSED FOR OTHER PROJECTS)

STEP 3: NodeMCU code

I also showed you how to setup the NodeMCU board in the Arduino IDE, if you missed it, check it out here. After successfully setting up the board, upload this code.

NodeMCU relay code
NodeMCU relay code

When the IDE is done uploading the code to the NodeMCU board, fire up your serial monitor to debug the connection to your Wi-Fi connection. Open up your Blynk App and control your A.C light bulb!!!!

Results

If everything is done right, your A.C bulb should light up like this when you control it with the Blynk App

nodemcu blynk result
Node-Mcu Blynk result

Wanna Do More?

A setup such as this can be used to control water pumps, A.C/D.C fan, lights, garage doors.

Share This Post

Comments (4)

  • Marilynn Blunt Reply

    Are You interested in advertising that costs less than $40 monthly and delivers hundreds of people who are ready to buy directly to your website? Please send me a reply here: michael4621gre@gmail.com to find out how this works.

    November 11, 2019 at 7:57 pm
    • Abayomi Samuel Reply

      thank u

      November 25, 2020 at 2:49 pm
  • Shay Pittmann Reply

    Greetings, I was just checking out your website and filled out your contact form. The contact page on your site sends you messages like this to your email account which is why you’re reading through my message right now correct? This is the holy grail with any kind of advertising, getting people to actually READ your ad and I did that just now with you! If you have an ad message you would like to blast out to millions of websites via their contact forms in the US or to any country worldwide send me a quick note now, I can even focus on specific niches and my prices are super reasonable. Send a message to: harry2947har@gmail.com

    March 18, 2020 at 3:55 am
    • Abayomi Samuel Reply

      thank u

      November 25, 2020 at 2:48 pm

Leave a Reply

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

No products in the cart.