Intro: DIY Voice/Internet Controlled Home Automation and Monitoring Using ESP8266 and Google Home Mini
Hey!! After a long break I'm here as we all have to do something boring(job) to earn.
After all the HOME AUTOMATION articles I have written from BLUETOOTH, IR, Local WIFI, Cloud i.e. the difficult ones, *NOW* comes the easiest but the most efficient HOME AUTOMATION solution. T
his project needs less hardware, circuit unlike my previous projects. The utilization of services from different software companies is mostly seen in this with a little bit of Arduino and circuitry knowledge. Let's not bore you. Enjoy LAZINESS!!!
NOTE: Please read the whole document it will take 9minutes, otherwise if you damage your components I will not be responsible!!This is the third time I'm uploading the project as there are some date issues with the site.
Step 1: Components Required
Five components actually needed but we can break it down for the second one like I happened to do earlier as I didn't want to spend money then!!
- ESP8266 Nodemcu wifi development board - Maybe LOLIN, AMICA, ADAFRUIT anything
- 5V relay board as a whole or break up as follows
- RELAY 5VULN2003 or ULN2003A
- Diode for relay protection(that I missed in earlier projects)
- Jumpers or (Wire and soldering iron)
- Any mobile charger or adapter of 5V (spare charger, don't destroy your parent's mobile charger)
- GOOGLE HOME MINI
So we can buy relay board of 2/4/8/16 relays intact in a prebuilt circuit or we can make one, please refer to my previous articles like this one to make relay board on your own.
Step 2: Blynk App
Install Blynk app in your android phone or apple phone
After installing, signup using email id or facebook(I dont prefer facebook). And be sure that you know the used email id's password, or else you will not get the Blynk Auth Token (is project specific) that is not only sent to your registered email id but also can be obtained from project settings in Blynk! Was kidding!
- select new projectUse the + button to add widget
- Add button as many as you wish (TILL YOU FINISH YOUR FREE 2000 ENERGY and then buy energy)
- Configure button by clicking on the added button
- Select the output pin(Digital) like D1,D2,D3,__,__,__,__ (FILL IN THE BLANKS) (pins can be digital, analog,virtual)
- See the pictures, I have put the lower state as 1 and upper state of button as 0.
Reason behind this is that relay board input are connected to ICs like ULN2003 or relay driving ICs those act as NOT gate.
Step 3: Programming ESP8266 in Arduino IDE
In Arduino IDE, first of all we need to select the development board we will be programming as I have told in my earlier projects. Arduino IDE>Tools>Boards>Nodemcu 12E and choose the usb port we connected it to like COM3/4/5/6/...
Now we need to install the Blynk library in Arduino that we can easily do nothing and have every code!!
SKETCH -> INCLUDE LIBRARY -> MANAGE LIBRARIES -> SEARCH FOR "Blynk" -> INSTALL THE LIBRARY
Connect the Nodemcu ESP8266 to laptop. Ofcourse with USB cables!!
For the ease of non-coders and myself :
Go to FILE > EXAMPLES > Blynk > Board's Wifi > select Standalone
Now nothing is needed except Blynk Auth Token(project specific) and wifi credentials. UPLOAD the sketch in ESP8266 and open SERIAL MONITOR.
You can see the "IP", note down that IP, it may differ according to server zones. Mine is as you can see "184.108.40.206".
80 is the port normally for http.
Step 4: IFTTT (If This Then That)
Its a platform that helps us to create custom applets that can help us get notified for a specific event or can do some specific task. As the name suggests : everything surrounds"this" and "that".
HERE : If "specific phrase said to google assistant" then "that ping will be made"
So as said we need to click on -- My applets > create new > click on this > search for and select google assistant> select simple phrase > follow pictures > create trigger
Click on that > search for webhooks > select it > choose Make a web request > There will be fields as follows :
- URL (https://IP/YourAuthToken/update/PIN?value=1) (digital 1/0 .... 1 for OFF and 0 for ON cause is written in this article please read that)
- Method (GET)Content type (nothing)
- Body (nothing)
After filling all of this click on Create trigger
Note: PIN here corresponds to Arduino pins so like what we see on ESP8266 as D1 is GPIO5 i.e. D5 for Arduino which we have to write here not D1.
Example: https://IP/YourAuthToken/update/D5?value=1 this means D1 pin of ESP8266 will be OFF. USE THE PIN DIAGRAM OF ESP8266 FOR KNOWING CORRESPONDING D? TO GPIO?
Step 5: Circuitry
For this project circuitry is very simple. Components as discussed before that are used here:
5V adapter; ESP8266 Nodemcu; relay board; jumpers. I have used two relays but we can use as many as ESP8266 pins are there!!!
- The 5V supply will be fed to ESP8266 and Relay board.
- ESP8266 Nodemcu will have 5V supply through micro USB or Vin pin and Ground (As I have done it).
- Relay board has Vcc and GND pin designated for supply. Please follow the image don't insert the supply on the other side of Relay board it is for some other purpose. (I will not tell it find it that's a easy task!!)
- So our IoT MODULE is set to go, what is left? Connecting it to appliances.. :)
- That's the easiest task but be careful as ITS 220V AC OR 110V AC..... Put the main switches down or else if you die I don't know who wrote this article.
- CONNECT THE "NO" (Normally open) pin of relay and COM(common) pin of relay to appliance switches in parallelor if there is no switch for appliances, connect relay pins in series to any of the wire (LIVE or NEUTRAL) that connect with the appliance.
NOTE: I have said to connect relay's to NO pin and COM pin so that appliances are normally in OFF state. One can use NC pin (Normally closed) if he/she wants appliance in ON state as default. ON and OFF state depends on 2 FACTORS : 1) Relay's NO and NC pin 2) 0 and 1 logic in IFTTT/Blynk app
Step 6: Monitoring From Anywhere on MOBILE (IFTTT App)
One can easily monitor what's going in their home from anywhere in this world only if Internet is available.
So the thing necessary for this is the IFTTT app which is available in Google Play Store for Android users.
IoS User can also get it from their App Store.
For both the cases remember to login from the same account linked with GOOGLE HOME MINI and IFTTT account where you made the applets. So what's important is the gmail account or facebook account which should be same throughout.
In this app you can create applets in the same way we do in IFTTT web application.
When we create applet there is always a option to receive notification when applet runs, by default it's ON.
So now monitor when any of your appliance is tickled.
ENJOY LAZINESS!! Innovate!! make favorite this project to show your support and if you want more like this DIY easy projects...