Home Automation with 8-Channel Relay Output

NodeMCU ESP8266

To get started we need to download the Arduino IDE and some necessary drivers.
The Arduino IDE can be downloaded via this link – www.arduino.cc

After downloading the Arduino IDE navigate to File => Preferences and in the additional boards URLs add the below URL

http://arduino.esp8266.com/versions/2.3.0/package…

After that navigate to the Tools>Boards>Board Manager and scroll down the list until you do not find ESP8266 click on it and then hit install. Now you have setup the Arduino IDE to work along with the node MCU.

Additionally you need to install the drivers if you are on a windows based computer. The drivers can be downloaded and install from the below link.

Once the driver is installed, it is time to program the NodeMCU, for this select the NodeMCU 1.0 board from the Tools => Boards menu of the Arduino IDE.

Now need to find the specific port to which the NodeMCU is connected to the computer. This can be found in device manager. In Tools => Ports, make sure you select the right port

 

Blynk Server

Getting Started with Blynk

IN ORDER TO USE BLYNK APP YOU WOULD NEED:

  • Hardware that works with Blynk.
  • If your hardware does not have connectivity on board, you can use shields like Ethernet, WI-Fi, GPRS and many others. Blynk also works over Bluetooth and USB
  1. DOWNLOAD BLYNK APP FOR ANDROID OR IOS

https://play.google.com/store/apps/details?id=cc.blynk  -Android

https://itunes.apple.com/us/app/blynk-control-arduino-raspberry/id808760481?ls=1&mt=8  -IOS

 

2. GET THE AUTH TOKEN

In order to connect Blynk App and your hardware, you need an Auth Token.

  1. Create a new account in Blynk App.
  2. Create a New Project. Then choose the board and connection you will use.
  3. After the project was created, we will send you Auth Token over email.
  4. Check your email inbox and find the Auth. Token.
  1. INSTALL BLYNK LIBRARY

https://github.com/blynkkk/blynk-library/releases/tag/v0.5.3

️ Blynk library should be installed manually. Follow the instructions:

  1. Download the latest release .zip file.
  2. Unzip it. You will notice that archive contains several folders and several libraries.
  3. Copy all these libraries to your_sketchbook_folder of Arduino IDE. To find the location of your_sketchbook_folder, go to top menu in Arduino IDE: File -> Preferences (if you are using Mac OS – go to Arduino → Preferences)

The structure of your your_sketchbook_folder should now look like this, along with your other sketches (if you have them):

your_sketchbook_folder/libraries/Blynkyour_sketchbook_folder/libraries/BlynkESP8266_Lib…your_sketchbook_folder/tools/BlynkUpdateryour_sketchbook_folder/tools/BlynkUsbScript…

☝️ Note that libraries should go to libraries and tools to toolsIf you don’t have tools folder you can create it by yourself. 

 

3. CREATE YOUR FIRST EXAMPLE SKETCH CODE

Blynk works with hundreds of hardware models and connection types. We prepared Blynk Examples Sketch Builder that allows you to create example code for your hardware.

 

  1. Choose Your board (for example: Arduino UNO, NodeMCU)
  2. Choose your connection (WiFi, Ethernet, Bluetooth, USB…)

4. PASTE THE AUTH TOKEN

  • In the example sketch, find this line:

char auth[] = “YourAuthToken”;

 

  • Change it with your Auth Token (it should be in your email inbox after you created the Project in the Blynk app. Now it should exactly like this (☝️ don’t forget the ” “):

char auth[] = “53e4da8793764b6197fc44a673ce4e21”;

                   

                      Steps to open the source code in Arduino IDE 

      paste the Character token here in above space

      SSID: Name of your Wifi connection

        (Can be Mobile Hotspot)

Password: Wifi password

In addition, after completing all the above-mentioned process upload the code in your NODEMCU

By selecting the right Board

After doing all the steps
add buttons to your project screen and assign them the pins as D1, D2; as per our requirment for the functioning of the relays

WhatsApp us whatsapp