Control your Raspberry Pi using your Google Assistant
Using your Google Assistant, you can send voice instructions to this website (helloworld.co.in). IFTTT acts as a bridge between your Google Assistant and your account with this website. Copy and paste the following URL in your IFTTT applet to make this bridge. See setup instructions below.Test your connection
Once your IFTTT applet is configured correctly, try speaking to your Google Assistant with defined keyword followed by some text. The text should appear in the box below.
Setup Your IFTTT Applet
IFTTT allows you to connect two different web services in a simple manner. Sample configuration of IFTTT applet for this project is shown below.
Copy your URL and Paste it in 'Then' section as shown in the example above.
Setup Your Raspberry Pi and Online Remote
Configure the online remote for your Raspberry Pi. By doing this you are telling the helloworld.co.in website which GPIO pins of your Raspberry Pi you want to control.
Download the code for your Raspberry Pi from this Github link and prepare it to fetch remote data. Read more about setting up your online remote. The information with respect to your Raspberry Pi's GPIO pins and their state is maintained in your helloworld.co.in account. This information is fetched by your Raspberry Pi at regular interval of time and the action is performed.
You can change the Pin state in the cloud by pressing a button of your remote or by speaking to your Google Assistant. In order to use Google Assistant, you need to first bridge your Google Assistant with your helloworld.co.in account by using IFTTT as shown above.
Valid Commands
A valid command to control your Raspberry Pi through Google Assistant is: your keyword followed by GPIO pin number and its desired state.
For example, if your keyword is 'turn' and you configured pin number 21, 22 & 18 using your remote. Then you can speak any of the following statements to your Google Assistant:-
- turn 21 ON- turn 21 OFF
- turn 22 ON
- turn 22 OFF
- turn 18 ON
- turn 18 OFF
The above commands will toggle the respective pins only. However, you can turn ON or OFF all the pins at once by saying following statements to Google Assistant:-
- turn ON- turn OFF
Try it Yourself. Its Fun !!!
You can build your own smart home solutions with is technique and go beyond than what is offered by commercial smart switches. The whole process including setting up your online remote, IFTTT applet and Raspberry Pi code can be completed in a matter of minutes. You can implement this project without writing a single line of code and use it as out of the box solution for controlling your Raspberry Pi through a physical Google Home Assistant device or Google Assistant of your mobile phone.
I hope that you enjoy building this project.