update: Sadly Sonos has acquired Snips.ai the platform I had used for creating personal voice assistant 😿
Note: This project is for fun purposes only. Not a commercial solution as a whole. © CC BY-NC-SA
Project14 | Being Lazy - Home Automation
What is Home Automation? It is a very big term meaning a lot of things nowadays. Literally, it is to automate your home. Like set timer for your devices, alarms and more. But it now means a method to communicate with your devices and also making it smart.
What is Home Automation? It is a very big term meaning a lot of things nowadays. Literally, it is to automate your home. Like set timer for your devices, alarms and more. But it now means a method to communicate with your devices and also making it smart. But it is just equivalent to "Being Lazy". You need a way to turn on/off the lights because you are lazy to get up. Same to control other appliances!
So, this project is intended to make your job easier by making it difficult (actually easy) to make and then enjoy your result (of code). In this project we will make our own assistant that listens to us and controls lights/fans/appliances; sets alarm for a specific task; answer some basic questions.
- Matrix Creator // A wonderful board, with sensors and microphone array(x8) and FPGA //Matrix Voice will also use the same code
- Raspberry Pi 3A + //Any RPi >2B will work
- A USB cable, Keyboard, Mouse, Computer, etc.
- Any WiFi connected board // for smart clock and alarm
- Relay / LED / Light
- Fan / Other Appliance
- Matrix Core //OS: Lib for Creator
- Raspbian Stretch Lite //OS of RPi
- Snips Voice Assistant API // Snips provides Private-By-Design, Decentralized Voice Assistant Technology and Solutions.
- NodeJS //Coding Language //MQTT required
- Coding IDE // I used Visual Studio
- Arduino IDE // for coding other connected devices (smart clock)
- Matrix Malos OS //mostly not required but voice recognition problem on new one OS, So?
You just need to connect Matrix board to RPi, other connection of Relay and LED, etc. is pretty simple on a breadboard. And other co-controllers will be on a network.
Features of Matrix Creator:
Explained in a video in extra brief: There are a lot more and more well documented. This is a short version>>
Snips is an offline assistant that you can make and then use. Recently it is gaining popularity and there are a lot of sources of information using it in the community.
It is pretty simple to use and the Website is also very great!
For setting alarm we can make a project like this with little tweaks to make it listen to our alarm request. It is getting NTP time so just add the local timezone and compare.
Smart Clock over Cloud - the project by F. Yao
For the rest, functionality follow.
The headphone (connecting speaker is recommended) My speaker did not have an amplifier so RPi signal was not heard at all.
From Hackster - Matrix Labs
If you haven't already, be sure to setup your Raspberry Pi with your MATRIX Device.
You can follow a guide here which walks through the whole setup, including flashing your micro SD card with our custom image (for this project), enabling ssh, and connecting to your Raspberry Pi remotely, in detail.
Enabling SSH allows the SAM CLI tool to connect to your Pi from your personal computer.
If you don't want to install our custom image, you will need to follow the steps below in order for Snips to work on your Raspberry Pi.
https://matrix-io.github.io/matrix-documentation/matrix-core/getting-started/core-installation/ //Installation guide - 2
Probably the Matrix Core may give errors with Audio related things which based on my experience can be fixed with Matrix Malos Installation again.
Setting up snips is very simple:
Go to https://snips.ai/ and click on sign up (if new).
Fill in the required data
And log into the console. You will not see any assistants if new.
Select Create New and the fill the details and press Create
To fully configure the snips follow the images below.
See the original post for a series of images with descriptions 😥
After making the assistant you need to first set up snips on your RPi. So follow Configure Snips.ai
After installing and testing with the installation of snips cli you need to deploy your assistant.
Make sure SSH is enabled on your Pi.
Connect to the RPi on SAM CLI on a terminal of your computer with
sam connect <RPi IP>
You will need to enter your credentials.
Then check if all services are working with
You should see that all services are working. The "snips-analytics" may not work but that is fine as it just handles some errors. If not refer to https://docs.snips.ai/additional-resources/troubleshooting
It will take some time to configure and then ask for credentials i.e., API Key and local region etc for the Calculations and Weather_en app.
Go to https://openweathermap.org/ Click on sign up and then login. Go to API Keys and "Generate" a new one and take note of that or put it in SAM CTL when asked.
Credintials of Calculatations (Currency Conversion)
Go to https://www.exchangerate-api.com/ Select start now after putting your details and you will get the API Key
Take a note of that and enter into SAM CTL when asked.
Then you need to deploy your assistant.
Go to snips console and select your assistant on bottom right click on "Deploy Assistant"
You will get a cmmand like this, copy and paste in your terminal os SAM CLI
Now enter all the API keys and other information and your assistant is good to go.
to see how your assistant performs the job.
Take the code from Github repo and then paste it into RPi's specific folder.
Don't forget to change the username in assistant.js and pins in other code if using a different config.
Also, change the paths to intent if changed.
Look at Matrix Documentation for working of ZeroMQ and its core and more details.
After all, is done ssh into your Pi (with Putty) and "cd" to your folder and run assistant script with
And your assistant will be working
You can see the processing in SAM CTL and see the triggers in Putty.Code for Being Lazy
Demonstration and Live Example+Problems:
Satisfactory Slow Motion Footage of that everloop leds:
An earlier video with custom wake word on a simple task:
This project turned out to be better than I expected and that it works. The only problem with me is that Snips needs a lot of practice to understand Indian/Asian accent and when there is more than one intent it causes a lot of problems.
But what I learned is: Home Automation projects are fun. There are long and sometimes boring but when you have a deadline they turn out to be pretty awesome.
<<Thanks for Reading 😁>>