Voice control with Google Home and Arduino (1/3)


After received my Google Home Mini from Walmart, my family and I are really enjoyed and satisfied with the voice features and sound quality. Voice control lighting is always on my Arduino DIY list. After I received all the components, I went ahead and made this project during my X'mas holiday. The Google Home Mini I bought came with a Chromecast in a Smart TV kit package at price of USD$45 during holiday sales. What a bargain! 

* Photo from Walmart

Here are the URL links about this tutorial, totaling 3 sections:


Simply say "Ok Google, turn Light One On or Off" to Google Home Mini and it does the job!  I intended to add "One" there, so I might have the 2nd or 3rd lights that I could control in...hope not in the distant future. :)

See the demo below:

How does it work?

Programming Steps to show you the working flow

  1. Your voice command send to IFTTT through Google Home Mini 
  2. IFTTT Applets engage Google assistance service and inteprete the voice command into text and send to Adfruit.IO MQTT service
  3. MQTT service received the message(from Google home to IFTTT) and based on the Adafruit "Feeds" setting to store the received message on the MQTT server.
  4. Adruino ESP8266 at home was programmed to subscribe new message from Adafruit. As soon as the Adafruit MQTT server has updated message, Adafruit server push the message back to Arduino ESP8226.
  5. ESP8226 recevie the message and act accordingly to either trigger the relay module.
  6. If the messae is "ON" then, ESP8226 turn on light by swith relay module on. Otherwise, the message is "OFF", then trun off light by swith relay module off.


SAFETY is first priority! This project involves 110V AC which it is quite dangerous if not handled carefully! Please turn the main power source off before all the AC related connections. Double and triple check for short and correct connections before turn back on AC! I'm just to show you how I made this project and not responsible for anything happened to you or your family and properties in case if there is an accident. 

Components Needed

  • NODEMCU ESP8226 * 1
  • 10A 110v/250v AC Relay * 1
  • Wall plug outlet * 1
  • Wires for Arduino connection * 4 or 5
  • Wires for Wall plug connection * 3


I drew this illustration below to show you how did I connected all components together.


  • ESP8226 D7 to Relay IN
  • ESP8226 GDN to Relay GDN
  • ESP8226 3.3V to Relay VCC
  • Relay NC(Normally Open) to AC Plug outlet top end (refer to above illustration)
  • Relay C(Common) to AC 110V 
  • AC Plug outlet bottom end to AC 110V GND
  • AC Plug ground (not used in this project, my old house does not have this)
That's all for this section. Next time, I will show you how to setup Adafruit and IFTTT. They are the most important parts of this project. Until next time, see you!

Please Continue to read: Setting software - Part 2 of this tutorial

Arduino + Google Home Mini 語音控制電燈


收到從美國Walmart寄來的Google Home Mini之後,我們全家都非常滿意的它的語音功能和音質。 語音控制照明一直是我想做的Arduino DIY項目之一。 在買齊了所有零件後,我利用了聖誕節假期期間完成了這個項目。我在假日銷售期間以價格45美元的價格購買了Samrt TV 套件 Chromecast 加 Google Home Mini,真是賺到了!

* 照片由 Walmart 提供



很簡單,只要對著Google Home Mini 說 “Ok Google,將Light One開啟或關閉” 即可完成任務! 我在 Light 後面加了 “One”,預留了將來的第二或第三個燈......希望很快能而成。:)  P.S: Google Home Mini 目前還不能以中文提問也不能回答...



  1. 語音命令透過 Google Home Mini 傳送到 IFTTT 伺服器
  2. IFTTT Applet 使用Google Assistant 服務並將語音命令轉成文字並傳送到Adfruit.IO MQTT服務
  3. Adafruit MQTT 收到訊息後(從Google Home Mini到IFTTT),並根據 Adafruit "Feeds" 設定將收到的文字存儲在MQTT服務器上。
  4. 家中的Adruino ESP8266 在程式中,設為訂閱Adafruit MQTT新訊息。只要Adafruit MQTT服務器得到了更新的資料,Adafruit服務器就會將消息傳回Arduino ESP8226。
  5. ESP8226接收新的資料並對應地動作觸發繼電器模組。
  6. 如果資料為“ON”,則ESP8226透過開繼電器模塊打開燈。 若資料為“OFF”,ESP8226則關閉繼電器模紅,進而關燈。


          安全是最重要的! 這個專案項目要使用到110V 交流電,如果不小心一點,可能會造成危險! 在所有直流電要實際連接之前,請一定要關閉主電源。 在重新啟用直流電之前,請檢查是否短路及是否連接正確! 這篇文章是教你如何完成這個專案項目,如果不幸發生意外,我個人是不需要對你或你的財產家人負責的。


          • NODEMCU-12E ESP8226 WiFi 模組 * 1 
          • 10A 110v/250v AC 繼電器 * 1
          • 插座 * 1
          • 杜邦線 4 ~ 5
          • 直流電專用線 * 3




          • ESP8226 D7 連到 繼電器 IN
          • ESP8226 GDN 連到 繼電器 GDN
          • ESP8226 3.3V 連到 繼電器 VCC
          • 繼電器 NC(常開) 連到 綠色插座頭 上方 (參考上方圖)
          • 繼電器 C(共用) 連到 110V 白線
          • 綠色插插座頭 下方 連到 110V 黑線 (參考上方圖)
          • 插座頭 第三支線綠色,在此沒有用到 
          這次先說明到此。 下一次,我會教你如何設置Adafruit MQTT 和 IFTTT。 它們此專案項目最重要的部分之一。


          1 comment:

          1. Nice information thanks for sharing | Now use these amazing extend kits to add voice control to other robots. Presenting this top educational Robot Kits for Kids that can be easily used with Hexbugs, Lego Robotics, Vex Robotics, racing cars, toys and more.
            Educational robotics kit
            Programming with voice control
            Alexa Voice Artificial Intelligence