NODEMCU 1.0 (ESP8266) CONTROLLED RELAY USING BLYNK (OVER THE WEB)

21,457

77

22

About: MY NAME IS P.STEVEN LYLE JYOTHI AND I AM 17 YEARS OLD.

HI GUYS MY NAME IS P STEVEN LYLE JYOTHI AND THIS IS MY FIRST INSTRUCTABLE ON HOW TO CONTROLL RELAYS BY NODEMCU ESP8266-12E VIA BLYNK THROUGH THE INTERNET

SO LETS GET STARTED

SORRY FOR MY BAD ENGLISH

Step 1: THE THINGS YOU WILL NEED

1. NODEMCU ESP8266-12E (http://www.ebay.in/itm/Amica-NodeMcu-Lua-ESP8266-C...)

2. 4CH RELAY (http://www.ebay.in/itm/4-Channel-Relay-Board-Modul...)

3. SOME WIRES

4. 5V POWER SUPPLY 1AMP

5.SOLDERING IRON

6.ANDROID DEVICE WITH INTERNET

7.PC WITH INTERNET

8.BLYNK APP (https://play.google.com/store/apps/details?id=cc.b...)

Step 2: THE BLYNK APP

OPEN THE BLYNK APP

1. CLICK ON CREATE NEW PROJECT

2.NOW SELECT BOARD NODEMCU =>CONNECTION WIFI (YOU WILL GET A AUTH TOKEN TO YOUR EMAIL COPY THE TOKEN AND KEEP ASIDE YOU WILL NEED THE TOKEN WHILE WRITING THE CODE IN ARDUINO)

3.NOW CLICK ON THE (+) ICON

4.NOW SELECT BUTTON

5.ADD UPTO FOUR BUTTONS

6. NOW SELECT EACH BUTTON AND CHANGE PIN TO THE FOLLOWING

BUTTON 1 (D1) / BUTTON 2 (D2) /BUTTON 3 (D3) / BUTTON 4 (D4)

Step 3: PROGRAMMING THE NODE MCU

DOWNLOAD ARDUINO

STEP1.OPEN ARDUINO

STEP2. GO TO FILE=>PREFERNCES=>ADDITIONAL BOARD MANAGERS URL=>PASTE THIS LINK(http://arduino.esp8266.com/stable/package_esp8266c...)

STEP3.GO TO TOOLS=>BOARDS=>BOARD MANAGER

NOW IN BOARD MANAGER SEARCH "ESP8266"

YOU WILL GET "esp8266 by ESP8266 COMMUNITY" IN THE LIST

INSTALL THE LATEST VERSION IN MY CASE V2.3.0

STEP4. 1.GO TO SKETCH=>INCLUDE LIBRARIES=>MANAGE LIBRARIES

2.NOW IN MANAGE LIBRARY SEARCH "BLYNK"

3.AND INSTALL THE "Blynk by volodysmr shymansky"

STEP5. NOW GO TO TOOLS=>BOARD=>NODEMCU V1.0 (ESP8266-12E)

NOW GO TO TOOLS=>PROGRAMMER=.ARDUINO ISP

STEP6. UPLOAD THIS (https://github.com/stevenchanti/P.STEVEN-LYLE-JYOT...) CODE TO YOUR NODEMCU

===================================================================================

YOU HAVE TO CHANGE SOME THINGS IN CODE LIKE SSID AND PASSWORD OF YOUR NETWORK AND PASTE YOUR AUTHENTICATION TOKEN WHICH YOU GOT IN EMAIL

Step 4: SOLDERING THE WIRES

SOLDER THE VIN OF THE NODEMCU TO THE VCC OF THE RELAY BOARD

SOLDER THE GND OF THE NODEMCU TO THE GND OF THE RELAY BOARD

SOLDER THE D1 OF THE NODEMCU TO THE IN1 OF THE RELAY BOARD

SOLDER THE D2 OF THE NODEMCU TO THE IN2 OF THE RELAY BOARD

SOLDER THE D3 OF THE NODEMCU TO THE IN3 OF THE RELAY BOARD

SOLDER THE D4 OF THE NODEMCU TO THE IN4 OF THE RELAY BOARD

Step 5:

Share

    Recommendations

    • PCB Contest

      PCB Contest
    • Make it Glow Contest 2018

      Make it Glow Contest 2018
    • Toys Contest

      Toys Contest

    22 Discussions

    0
    None
    bill1959parker

    1 hour ago

    Hi Thank you this is a very easy tutorial and the very first BLYNK tutorial I have managed to follow and it work. You put it in very simple steps I will definitely be following you keep up the good work. Thanks again.

    0
    None
    dishaparkhi

    Question 2 months ago on Introduction

    hi I am getting error on blynk app on mobile phone that "your device wasnt online"

    and also invalid library for rfid-master in arduino IDE

    0
    None
    KegRaiderMazharS6

    Answer 6 months ago

    Hi MazharS5,

    I'm not sure if you have already worked it out, but here goes. I needed the exact same thing, but with my 8 channel relay board. The NodeMCU naturally brings the outputs high unless you are using pullup resistors. Now you can go and solder in some resistors, or do what I did and just modify the code a bit. Add this below the "Serial.begin" bit.

    [code]
    pinMode(D0,OUTPUT); // Relay 1
    pinMode(D1,OUTPUT); // Relay 2
    pinMode(D2,OUTPUT); // Relay 3
    pinMode(D3,OUTPUT); // Relay 4
    pinMode(D4,OUTPUT); // Relay 5
    pinMode(D5,OUTPUT); // Relay 6
    pinMode(D6,OUTPUT); // Relay 7
    pinMode(D7,OUTPUT); // Relay 8
    pinMode(D8,OUTPUT); // Unused
    digitalWrite(D0,HIGH); // Relay 1
    digitalWrite(D1,HIGH); // Relay 2
    digitalWrite(D2,HIGH); // Relay 3
    digitalWrite(D3,HIGH); // Relay 4
    digitalWrite(D4,HIGH); // Relay 5
    digitalWrite(D5,HIGH); // Relay 6
    digitalWrite(D6,HIGH); // Relay 7
    digitalWrite(D7,HIGH); // Relay 8
    digitalWrite(D8,HIGH); // Unused
    [/code]

    Now, in your BLYNK code, the following mappings need to be in place:
    Relay1 = GP16
    Relay2 = GP5
    Relay3 = GP4
    Relay4 = GP0
    Relay5 = GP2
    Relay6 = GP14
    Relay7 = GP12
    Relay8 = GP13

    I have every button mapping set to "Switch" mode, and the output of every GP output as 1 in the first box, and 0 in the second.

    Upon rebooting or removing power to the NodeMCU, the next startup the relays all click for a microsecond, then are in the off state. You can use Blynk to turn them on at will then. Hope this helps you, and others.

    0
    None
    yoyostevenMazharS6

    Answer 8 months ago

    Cuz there is no power to hold the switch , as the magnetic property will be not there

    0
    None
    SourojitM

    10 months ago

    Will it work as soon as the nodemcu is powered on
    Means will it automatically connect over the internet?

    0
    None
    PiyushB5

    10 months ago

    i think relay should not work bcz relay is 5v and output of nodemcu is 3.3v...

    Let me know if i am wrong..

    1 reply
    0
    None
    yoyostevenPiyushB5

    Reply 10 months ago

    It has a 5v out put , so it works for me

    0
    None
    ErickFloorZ

    1 year ago

    hi why this is not work on relay 1 channel? but work normally on 4ch relay..can you have trik?

    2 replies
    0
    None
    Hafiz Ray

    1 year ago

    works perfectly, this is how tutorial should be, thanks!!

    2 replies
    0
    None
    vinode13

    1 year ago

    The easiest coding and straight forward usage of the nodeMCU. Thanks a lot buddy!

    1 reply