Hackernoon logoBuilding Cool IoT Lamp That Can Be Controlled via Google Assistant by@TheHardwaron

Building Cool IoT Lamp That Can Be Controlled via Google Assistant

Author profile picture

@TheHardwaronThe_Hardwaron

Tech enthu | YouTube| Blogger |Curious

You can also refer to my video tutorial:
There are many IoT projects available on Youtube and on the internet.Here is a very cool project based on IoT.It is actually a lamp which can be controlled through Google Assistant.So,lets get started…..

Hardware:

  • Wemos(or any board like Node MCU)
  • Plug
  • Wires
  • Relay(10 amps or higher)
  • jumper wires
  • Bulb
  • Bulb holder
  • Lamp(optional)

Software:

  • Google Assistant
  • IFTTT
  • Adafruit io
Circuit:
Instead of the power plug(near the bottom left)we can use the plugs like the ones of our mobile chargers.
Schematics:
Do the connections as shown above.
Now,go to adafruit.io website and create an account.
after that go to the feeds section>>Actions>>Create a new feed.
Then in the name section type any name of your choice for eg:light,bulb,etc…. and then click on create.
After that go to the dashboards section>>Actions>>Create a new dashboard.
Then in the name section type any name of your choice.
After that click on the name of the created dashboard>>click on the plus sign>>click on the toggle option(first option).
Select the feed that you had created earlier>>next step>>Create block(do not modify anything).

This part might look a little complicated just follow the instruction 👇👇

Install the IFTTT app from play store >>open the IFTTT app>>make an account>>go to my applets section>>click on the plus sign(on the top right)>>tap on ‘this’>>select google assistant >>say a simple phrase.
Under the “What do you want to say?” section, write the phrase that you want to say to Google Assistant like turn on the light.And under the ‘What do you want Assistant to say’ section type the thing that you want the Assistant to say to you in response like ‘ok’ and then tap create trigger.
Now go to that section and select Adafruit>>Send data to Adafruit IO>>Select the correct feed and under the data to save section type ‘ON’>>Create Action>>Finish.
Now our first action is completed now we can turn on the bulb,but now we have to set another action to turn off the bulb.
Repeat the same procedure as above only replace the text under “what do you want to say” with turn off the light and under the data to save section in Adafruit to ‘OFF’.
Open the Arduino IDE>>File >>Preferences>>under the additional boards manager type: http://arduino.esp8266.com//versions//2.4.2//package_esp8266com_index.json
then go to sketch>>include library>>manage libraries>>in the search box type Adafruit MQTT and install that library.
Finally go to tools>>board>>boards manager>>in the search box type esp8266 and install that library.

Note:

If you are using Wemos then you have to install this driver 👇 👇

Code:

https://drive.google.com/file/d/1_P0QcBW4iYrZRLJnvB6M5bDyMd8tpBse/view

In the above code replace your wlan ssid ,your wlan password ,your adafruit username ,your adafruit AIO key with your wlan ssid,password,adafruit username,and AIO key(You will find your AIO key and username in the ‘view AIO key’ section on adafruit.io website)
Select the correct board and port ,in my case it was Wemos D1. Set the upload speed and baud rate of your serial monitor to 115200.Insert the plug into the socket
AND THEN UPLOAD THE CODE!!!!!!!!

Tags

The Noonification banner

Subscribe to get your daily round-up of top tech stories!