Introduction: Audio Controlled Home Using Esp8266
NodeMCU is a development board featuring the popular ESP8266 WiFi chip. As it turns out, you can program the ESP8266 just like any other microcontroller. Its obvious advantage over the Arduino or PIC is that it can readily connect to the Internet via WiFi. However, the ESP8266 breakout board has limited pins although the chip itself has a lot of output ports. The NodeMCU solves this problem by featuring 10 GPIO pins each capable of using PWM, I2C and 1-wire interface.
This ESP8266 development board really looks like an Arduino Nano. Speaking of Arduino, another advantage of this board is that you can connect it directly to your PC or Mac and program it like an Arduino.
Connecting NODEMCU to Computer:
You need a USB micro B cable to connect the board. Once you plugged it in, a blue LED will start flashing. If your computer is not able to detect the NodeMCU board, you may need to download the driver on
“Download the Universal Version”.
In Arduino IDE:
You need to have at least Arduino IDE version 1.6.4 to proceed with this.
Go to File > Preferences. In the "Additional Boards Manager URLs" field, type (or copy-paste) http://arduino.esp8266.com/stable/package_esp8266... Don't forget to click OK!
Then go to Tools > Board > Board Manager. Type "esp8266" in the search field. The entry "esp8266 by ESP8266 Community" should appear. Click that entry and look for the install button on the lower right.
Once the download is complete, you can start coding!
Setup ESP8266 Support:
When you’ve restarted, select NodeMCU 1.0 (or NodeMCU 0.9) from the Tools->Board dropdown Config the Board menu and choose the right Port for your device. CPU Frequency：80MHz,Flash Size：4M（3M SPIFFS）,Upload Speed：115200 Now just proceed as the Arduino: Start your sketching! Note: 115200 baud upload speed is a good place to start – later on you can try higher speeds but 115200 is a good safe place to start.
Step 1: Connect Nodemcu to Blynk
Blynk is a Platform with iOS and Android apps to control Arduino, Raspberry Pi and the likes over the Internet. Blynk was designed for the Internet of Things. It can control hardware remotely, it can display sensor data, it can store data, vizualize it and do many other cool things. It's a digital dashboard where you can build a graphic interface for your project by simply dragging and dropping widgets. It's really simple to set everything up and you'll start tinkering in less than 5 mins. Blynk is not tied to some specific board or shield. Instead, it's supporting hardware of your choice. Whether your Arduino or Raspberry Pi is linked to the Internet over Wi-Fi, Ethernet or this new ESP8266 chip, Blynk will get you online and ready for the Internet Of Your Things. GPIO Pinout: \ How It Works: There are three major components in the platform: Blynk App - allows to you create amazing interfaces for your projects using various widgets we provide. Blynk Server - responsible for all the communications between the smartphone and hardware. You can use our Blynk Cloud or run your private Blynk server locally. It’s open-source, could easily handle thousands of devices and can even be launched on a Raspberry Pi. Blynk Libraries - for all the popular hardware platforms - enable communication with the server and process all the incoming and outcoming commands. Its features: *Supports majority of development boards like Arduino ,RPI, esp8266 * Easy to use * Awesome widgets like LCD, push buttons, labelled value, graphs * Not restricted to local Wifi network *Direct pin manipulation with no code writing *Easy to integrate and add new functionality using virtual pins Setting Up Blynk: 2 More Images 1. First install the Blynk app from google play store and then sign in 2. After that Press on click on New Project and you will get a screen (Refer Screen shots) *Enter the name of your project, I have given it as led “*Then Select the Board as NODEMCU” and then you will see below the authentication token no. If you want it in your email you can send it through email also *And then Finally click on to the create button 3. Now you will get your dashboard screen. Just click on the the top most button "+" on the right corner to add widgets to your project. 4. In this project we add a simple button and then configure its settings as Digital GP13 pin.(Refer Screen Shots) 5. Its your choice you can either have the button set as push type or as a switch 6. Then label the Button as ON and OFF in the settings Note that since Blynk is free only to an extend, you have to choose your widgets wisely Include Example File: After uploading the code,start configuring the buttons for BLYNK app. Note: ● YourAuthToken will generate when you create you project in BLYNK app.
Step 2: NodeMCU Home Automation With Google Assistant
NODEMCU HOME AUTOMATION USING BLYNK AND IFTTT
Finally we reached our destination
First of all, you need a project on blynk with a button to control for example an LED or a Relay. Then download IFTTT from Google Play Store or from Apple Store . Steps:
● Open IFTTT, go to “My Applets” and tap on add on top right corner.
● Click on “this” and then find “Google Assistant” after that choose a trigger and complete all phrases on trigger chosen, click on the tick on the right corner.
● Now select “that”, find “Webhooks”, “make a web request” and now, in the URL you need to puthttp://YOUR_COUNTRY_BLYNK_IP/YOUR_TOKEN_HERE//D7 (D7 = digital 7, change it to turn on or off the pin you want)
● To find the blynk IP from your country just go to command line on PC and write: ping cloud.blynk.cc. ● For example ,for my country (Portugal) the IP is 126.96.36.199, then the link will look likehttp://188.8.131.52/545db7988exxxxxda8bae2506b9...
● After you have your link paste it into URL on IFTTT, choose the method to “PUT”, the “Content Type” to “application/json” and the body you put [“0”] to turn ON (if it is an relay). Now to turn off you need to make all the steps before, only changing the body to [“1”].
● Now save all, call your assistant and ask her for the phrase you choose, after that the pin you choose will turn ON or OFF. After that You can control your devices with Google Assistant.
Participated in the
Audio Challenge 2020