Introduction: SiriControl: Add Siri Voice Control to Any Raspberry Pi Project
SiriControl is an open source python framework designed with developers in mind. It provides a simple way of using Siri commands, by dynamically loading modules created by the user. This means that you can add voice controlled capability to any Raspberry Pi project, with Siri. Whether it is turning on an LED to controlling your TV with infrared, the possibilities are endless!
The idea of using Siri to control my Raspberry Pi sounded very cool to me so I searched on the internet to find SiriProxy, which redirects the Siri commands through the Raspberry Pi, which is then intercepted. However, this was too much of a hassle and with the update of iOS 7, it stopped working. So SirControl was born, implementing an ingenious hack which is outlined in my blog post.
For more information on how it works, please visit my blog post. Or carry on setting up SiriControl below.
Step 1: Configuring Your Gmail Account
1) A Gmail account is required for SiriControl. For security reasons, I suggest creating a new Gmail account as you will have to enter your username and password in a python script. This won’t matter as you won’t be using this for personal everyday use – just for speaking commands.
2) Then, access for less secure apps needs to be turned on, which can be done here. This is because Google identifies the connection between the python script and mail servers as less secure.
3) As the script uses the IMAP protocol to fetch new Notes, IMAP needs to be enabled, under the Gmail settings.
Step 2: Preparing Your IOS Device
1) Now, navigate to the following, in your Settings and add your newly created Gmail account:
Settings > Notes > Accounts > Add Account
2) Turn on Notes for that account.
3) Ensure that the default account for creating Notes with Siri is your new Gmail account.
That’s it! Now, just tell Siri to create a Note like this:
“Note this is awesome”
The new note should appear under the Notes label in your Gmail account. If not, please follow the above steps again.
Step 3: Setting Up SiriControl
1) Firstly, clone or download the scripts from here.
2) Then, open up siricontrol.py and add your username and password of your new Gmail account. This should be self-explanatory.
3) Now, run the script and say to Siri:
“Note the meaning of life”
The answer should be printed out, because of the ‘life’ module in the modules folder. The setup is now complete.
Step 4: Creating Your Own Modules
The above module is the default module, which comes with SiriControl. This can be found under the modules folder. Also, a template module is included for reference.
moduleName – This is the name of the module which can be anything you want.
commandWords – This array will have the words which need to be said in order to call the execute() function.
execute(command) – This function is called when all the words in the commandWords array are said. The ‘command’ parameter is the command said by the user, to Siri.
Keep in mind that all modules that you create must be placed under the modules folder or else they won't be found.
Step 5: Enjoy!
Thats it! Now, you can control whatever you want and add fantastic voice control to any project, by creating your own modules. Anything is possible, with the power of Siri behind it!
It opens up many options such as IoT and home automation, as you can command Siri, from anywhere in the world, as long as you have an internet connection. Although it is a one way connection, you can program to send an email back to you etc. - the possibilities are endless!
If you thought SiriControl was awesome, please like and share my blog post. Also, please VOTE for me, if you found SiriControl cool.
For more cool stuff, visit my website. Enjoy commanding Siri!