- Set up io.adafruit.com to control LEDs on the NodeMCU
- Set up IFTTT to link Google Assistant with io.adafruit.com
- Use Google Assistant to control LEDs connected to NodeMCU
- NodeMCU board (quantity: 1 no.)
- Micro USB cable A to B (quantity: 1 no.)
- Breadboard (quantity: 1 no.)
- RGB LED module (quantity: 1 no.)
- Jumper wire – male to male (quantity: 4 no.)
- io.adafruit.com account
- ifttt.com account
- Google Assistant on phone
- Adafruit MQTT library
- Arduino IDE on your computer
It is possible to use IFTTT and io.adafruit.com to control any components connected to a NodeMCU. In this experiment, we will control LEDs connected to NodeMCU. Potentially, we can connect relays connected to various components like bulb and fan to make a voice controlled home automation system.
Install Google Assistant on phone
Google Assistant on phone
Create an Adafruit account
Step 1: Open a browser and go to io.adafruit.com. Click on Get Started for Free.
Step 2: Fill in your details and click on Create Account. Note that the site would have navigated to accounts.adafruit.com
Step 3: Once you’ve successfully logged in, this page will be displayed. You can change your details if you wish to.
Set up your Adafruit dashboard to control the NodeMCU
Set up an IFTTT account and link Google Assistant with Adafruit
Interfacing RGB LED to NodeMCU
You will need to install Adafruit MQTT library. Go to Sketch -> Include Library -> Manage libraries. Search for Adafruit MQTT and click Install.
Change the following lines in the code:
Add your WiFi credentials
#define WLAN_SSID "Your_SSID" #define WLAN_PASS "Your_Password"
Add your Adafruit username
#define AIO_USERNAME "xxxxxxxxxx"
Add your AIO key
#define AIO_KEY "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
To copy the code, right click on view raw at the bottom of the code, click on open link in new tab and then copy the code.
Uploading the code
Step 1: Enter the final code in the Arduino IDE window.
- When you click on New to open a new blank code in the Arduino IDE, you will get a new window with two functions: void setup() and void loop()
- You can either type commands as shown in the final code under void setup() and void loop() functions or
- delete the contents of this window. Then copy and paste the final code in the Arduino IDE window.
Step 2: Compile/ verify the code by clicking on the verify button.
- Make sure the board is connected to your computer
- Check if the correct board and port is selected.
Step 3: Upload the code by clicking on the upload button, which is right next to the verify button.
- The Arduino IDE provides a progress bar when it’s uploading.
- After it is done, you will see “Done uploading” on the bottom left of your IDE.
- If you encounter any errors, you need to go back to the code and fix the errors.