Controlling LED using voice assistant

Here is our plan to make a voice control LED or any kind of light switching system. So Here Also We Are Going To Make A Device Which Will Follow Our Instructions And Do As Our Commands.

in this project we will take help of google assistant to send our voice commands to our device.

We are heading towards the 21st century with more technologies and past up-gradation according to generation. Technology has already made our life easier but yet humans are not fulfilled with it.

we still have more powerful gadgets and more effortless work. Building a machine means building a slave for our needs.


Talking about the brief plan of our project: A simple and basic system we will build, which will listen to our voice(Google assistant) “TURN ON LIGHT” and will turn on the light and if we say “TURN OFF LIGHT”.

it will turn off the light. We are going to use very simple and basic hardware components to build this wonderful project and a worldwide server(IFTTT) which will connect our project to google assistant to execute our said command.

HARDWARE components

  1. Node MCU
  2. USB DATA CABLE(to program NODE MCU)
  3. CONNECTING WIRES

SOFTWARE components

  1. ARDUINO IDE
  2. IFTTT (server)
  3. GOOGLE ASSISTANT
  4. WEBHOOKS
  5. Blynk server as well as application(mobile application)

wORKING pRINCIPLE USING LED

Learning through steps we first have to install specific software to program or code NODEMCU as per our needs. For that, we just have to simply write ARDUINO IDE in google or can access the website using this link and download the software as per your system OS(Windows 7,8,10).

The interface is very simple to use don’t worry about that. To begin with coding, we have to install some libraries for our code to compile and run perfectly in nodeMCU. 

The very first library will be <ESP8266wifi.h>, and 2nd one will be <BlynkSimpleEsp8266.h>, a download link will be available at Arduino IDE official site, and we also have to install our NODEMCU board library for coding the device you can do this by clicking on SKETCH>INCLUDE LIBRARIES> MANAGE LIBRARIES.

There you have to search for esp8266 and download and install the driver so the nodeMCU board support your computer. Next, we have to upload our source code to our NODEMCU.

it will be automatically available in FILE>EXAMPLES>BLYNK>BOARDS_wifi>ESP8266-Standalone. though you can simply copy and paste the source code from image below.


Just copy and paste the given program and you have to make a simple change.

in the code that is in the place of “char auth[ ] = “(you have to give your auth token which you will get into your email through creating your wireless button-through BLYNK app. it is very easy just take a reference from youtube or google or simply download from play store and while creating new project there you must select the NODEMCU, not ESP8266) and before that connect your NODEMCU.

make sure you have selected the right com port and board, then click on compile and run. You complete 30% now.

The remaining 70% includes the website connecting part of your device, simply google for IFTTT or click on the text. log in there before use after we have to create an applet by simply clicking on “create applet”.

click on If This, a new tab will appear and search for GOOGLE ASSISTANT.

 after that select the very first tab “Say a phrase” then just simply type the message which we want to say. make the device work( also we can add optional phrase there).

After this click on submit and it will automatically redirect to the main page of (IF this then that). so here we need to click on then and search for WEBHOOKS(a server which will send on or off signals to our device).

simply apply the settings as shown in the image.

Okay we are done with  70% of the project, now we just have to repeat the above process for the off command by clicking again on creating new applet> Search for Google assistant> say a simple phrase> write “turn of light”> done (if previously you set Google assistant as on). just make these changes in webhooks click on then from the applet > search for webhooks>.

write the same in the picture above(just change the last line from “0” to “1”) to turn off the light.

Make sure the email you used for logging into IFTTT the same Email should be log in to your mobile phone also so that Google Assistant can Recognize that.

Okay, we completed now with the software part successfully, now the circuit connection needs to done for that we should take a look at the pin configuration of nodeMCU. Below we can see the digital pin D3 also GPIO0 needs to be connected with the positive end of our LED and a wire from the ground pin of nodeMCU (Gnd) to the negative end of the LED.

The simple working function will be when we say “Turn on light” to google assistant the IFTTT server will send a signal to WEBHOOKS and further the signal will be transferred to NODEMCU to digital pin D3 to pass a voltage of 3-5v which will turn on the LED. The second applet will be for turning off the LED which will work as the same just we have to write “1” in WEBHOOKS.

so, it’s completion with our project, and it’s time to test for the final OUTPUT. For that simply connect your NODEMCU to any USB power cable to turn it on. Now you can control your LED by your mobile Blynk app or through voice just by saying “turn on light” and also by saying “turn of light”

You can turn off.

Try doing this project to yourself and hope we will earn great knowledge.

Reference images:

a). Unsplash.com

b). Pixels.com

c). Node MCU Image is taken from this link Wikimedia Commons.

d). Arduino IDE image is taken from this link Wikimedia Commons.

Written by: Ankan Ghosh

Reviewed by: Batta Pruthvi

If you are Interested In Machine Learning You Can Check Machine Learning Internship Program
Also Check Other Technical And Non Technical Internship Programs

Leave a Comment

Your email address will not be published. Required fields are marked *