ESPHow ToIoT HardwaresIoT PlatformsTutorials/DIY

Controlled LED by Google voice assistant

In this tutorial we learn How To Controlled LED by Google voice assistant with help of Adafruit IoT Platform and IFTTT.  Adafruit Industries is an open-source hardware company based in New York City. IFTTT is a free platform that helps you do more with all your apps and devices

Adafruit was founded in 2005 by MIT hacker & engineer, Limor “Ladyada” Fried. Her goal was to create the best place online for learning electronics and making the best designed products for makers of all ages and skill levels. Adafruit has grown to over 100+ employees in the heart of NYC with a 50,000+ sq ft. factory. Adafruit has expanded offerings to include tools, equipment, and electronics that Limor personally selects, tests, and approves before going in to the Adafruit store. Adafruit is a 100% woman owned company. –By

IFTTT is the free way to get all your apps and devices talking to each other. Not everything on the internet plays nice, so we’re on a mission to build a more connected world.

Controlled LED by Google voice assistant

Things used in this tutorial

  • NODEMCU -ESP8266
  • White LED bulb
  • Two Connecting wires

1 – Setup Adafruit IO account

Visit and sign up. Now create a Feed and dashboard. You can give any name for feed and dashboard.

Click on dashboard and create a new block by clink on plus sign button for configuration. Select a toggle and select feed what you create. Now click on next step. Here you can give any name for block, fill ON in the button on text and fill OFF in the button off text.

Note your AIO key, username and feed name for Led Program.

2 – Arduino Sktech

Flash this code in ESP8266 help of Arduino IDE.

#include "Adafruit_MQTT.h" // Adafruit APIs for MQTT server talks
#include "Adafruit_MQTT_Client.h" // Board Specification APIs are defined inside this one
#include <ESP8266WiFi.h>

WiFiClient client1;
* Arguments:
* 1. Address of WiFiClient Object
* 2. Port Address : 1883 or 8883
* 3. Username of the Adafruit A/c (String)
* 4. API Key value from the A/c (String)
char NAME[]="Your adafruit username";    // replace
char API_KEY[]=" Your AIO key";               // repalce
char URL[]="";
Adafruit_MQTT_Client mqtt(&client1,URL,1883,NAME,API_KEY);

* Arguments
* 1. Address of the Adafruit_MQTT_Client
* 2. Adafruit Username
* 3. link of the 'Feeds' we have cretaed in Adafruit
* 4. MQTT_QoS_0/1/2 => Quality of Service (Optional)
Adafruit_MQTT_Publish mypub=Adafruit_MQTT_Publish(&mqtt,"ADAfruitusername/feeds/adafruitfeedname");   //replace

Adafruit_MQTT_Subscribe mysub=Adafruit_MQTT_Subscribe(&mqtt,"DAfruitusername/feeds/adafruitfeedname");  //replace

void setup() {
// put your setup code here, to run once:

WiFi.begin("wifi hotspot name","password");    //replace

while(WiFi.status() != WL_CONNECTED)

* String Pool Note
* Serail.println(F("")) will be stored in Flash memory

//Printg the Local IP

//Subcsribe to topic Feed


void loop() {
// put your main code here, to run repeatedly:

* publisher code:
* 5 Max subscription
* To change goto HEader file
* "#define MAXSUBSCRIBE 5"
Serial.println("MQTT Connected");
else if(mqtt.connect()==0)
Serial.println("Connecting to the MQTT....");
Serial.println("MQTT Connected");
Adafruit_MQTT_Subscribe *sub;
if(strcmp((char *)mysub.lastread,"ON")==0)

Serial.println("LED is on");
Serial.println("LED off");

3 – Setup IFTTT App

Download IFTTT android app and create two applets. First applet for ON LED and second applet for OFF LED. Open IFTTT app and select google voice assistant and adafruit for creating applet. Remember – write ON in the DATA TO SAVE field in adafruit section.

Circuit diagram



Now You can control LED bulb by Google voice assistant using your smartphone.

I hope you like this post “Controlled LED by Google voice assistant”. Do you have any questions? Leave a comment down below!

Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog.

We have other tutorials with ESP32 that you may find useful:

You may like also:

Upvote on Reddit

Harshvardhan Mishra

Hi, I'm Harshvardhan Mishra. Tech enthusiast and IT professional with a B.Tech in IT, PG Diploma in IoT from CDAC, and 6 years of industry experience. Founder of HVM Smart Solutions, blending technology for real-world solutions. As a passionate technical author, I simplify complex concepts for diverse audiences. Let's connect and explore the tech world together! If you want to help support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning! Linkedin

11 thoughts on “Controlled LED by Google voice assistant

Leave a Reply

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