In the previous Instructable I shared how you can get started with NodeMCU (ESP8266) and program it using Arduino IDE, Check it out here. In this Instructable I will show you how to control appliances from anywhere across the globe using Blynk. It can be used for home automation and various other applications.
Here for demonstration I have used LEDs, You can replace LEDs with Relays to use other high power appliances.
So lets get started...
Step 1: GATHERING COMPONENTS :-
Step 2: MAKING CONNECTIONS :-
First make the connection as shown in the picture above.
- Connect 1st LED to pin D0.
- Connect 2nd LED to pin D1.
- Use 1k Ohm resistors each in series with the LED's.
That's all you have to do. Now move on to the next step.
Step 3: MAKING BLYNK APP :-
First install Blynk application on your device. Once you have installed the application Sign-in with Google account. Now follow the steps below :-
- Open "New Project".
- Give a name to the project.
- Open "Choose Device".
- Scroll down and select "NodeMCU" and hit "Create"
An authentication token will be sent to you via Gmail. Now press "OK".
- Goto the add button on top right (+).
- Select button. (You will need two, to control both LEDs).
- Now you will see two buttons on the screen which you can touch and hold to drag around.
- Select button. this will open button settings.
- Give a name to the button. Here I have named it "LED 1".
- Now select a pin. Here I have selected "D0" because one LED is attached to D0.
- Now toggle the Mode to "SWITCH".
Do the same things with the Second button. Just give a different name and different pin. Here "D1".
With that been done we can move on to the next step. uploading Code to NodeMCU...
Step 4: PROGRAMMING THE NODE MCU :-
In this step you will have to set up the Arduino IDE to program NodeMCU (ESP8266). I have already shared it in the previous instructable. You can check out the video tutorial here.
Once the IDE is all setup you have to add the Blynk Libraries and Tools. For that follows the following steps :-
- Download and Extract the Zip provided below.
- Open the libraries folder and copy all the content.
- Open the folder where Arduino IDE is installed, Usually it is in C drive by default in "Program Files (x86)" folder.
- In the arduino folder, open the libraries and paste all the content .
- Now goto tools folder in of the unzipped package and Copy all its content and Paste it in the "tools" folder in Arduino.
That will load all the Blynk tools and examples in the Arduino IDE. Now open the IDE :-
- Goto >> File >> Examples >> Blynk >> Boards_WiFi >> ESP8266_Standalone.
- Add the authentication token received in the mail to the "auth".
- Add the name of your WiFi where SSID is asked.
- And add your WiFi password .
That's all now connect your NodeMCU to the PC , Select the right com port, Select the right board type and upload the code.
Refer to the pics above for better understanding.
Step 5: TESTING :-
Once everything is setup and NodeMCU is programmed you can move on to test the setup. First power up the board and make sure the WiFi is on. The Board will automatically get connected to the WiFi network.
Next open the blink app hit the play button on the top right corner. It will take a few seconds and the app will be connected to the blink server.
Now just hit the buttons to turn on/off the LEDs.
That is all for this instructable. In next Intractable I will share more advance home automation.
I hope this tutorial helps you get started. If you have any questions feel free to ask in the comments and I will try to answer it as soon as possible.