MATRIX ALEXA HOME AUTOMATION – MATRIX VOICE/CREATOR & RASPBERRY PI

So what all things we have now? A A Raspberry Pi, A MATRIX Voice, Alexa configured to work with MATRIX Voice and IFTTT. What to do next? How about some home automation? In this post, I will show you how to set up a Matrix Alexa Home Automation system, that can turn on and off lights, fans or any electrical device in your home. Lets get started.

Components Needed

About Relay

Relays are switching circuits that can close and break circuits mechanically. That means it can control an electrical circuit by closing and breaking connections in that circuit.

s-l1000-768x591

relay

As you can see, there are mainly 5 terminals in a relay. Two for energizing the coil, one Common terminal, a Normally Closed terminal which will be connected to the Common terminal when the coil is not energized and a Normally Open terminal which will be in contact with the Common terminal when the coil is energized.

electromechanical-relay

images

This is how the relay works. In our case, we will be connecting

  • GPIO pins to One End of Coil
  • Ground to other End of Coil
  • Phase of Main Power Supply to The Common terminal or Pole
  • One Terminal of bulb (Or other electrical Appliance) to Normally Open Terminal
  • And the Other Terminal of Bulb to Neutral Point of Main Power Supply

 

Since the Output of Raspberry Pi GPIO pins are 3.3V, you will have to buy a 3.3V Relay. You can purchase the relay board of 4 relays that is compatible with Raspberry Pi .

151158~1

 

Matrix Alexa Home Automation

Steps

Step 1 – Setting Up Alexa

Below link will redirect you to an easy to understand simple tutorial which will help you to set up Alexa on your Raspberry Pi using MATRIX Voice.

Now, you should be able to tell the Wakeword “Alexa” and communicate with it. You can proceed to next step.

Step 2 – Setting Up Ngrok

Next thing you have to do is set up ngrok. ngrok is an awesome service that enable us to connect to any device (inside LAN or internet facing) through any network with out port forwarding. The below tutorial explain everything you need to know about ngrok and set up one yourself.

Repeat Step 1, 2, 3 and 4 of the above tutorial.

SCREEN~2

Now you will have a ngrok URL which can be accessed from anywhere around the world.

Step 3 – Setting Up IFTTT

IFTTT or If This Then That is simply a platform, that interlinks various devices, apps and services that allows us to do what we want to do. It helps us to automate and arrange various tasks and services in an efficient and a user friendly manner. The below tutorial explain everything you need to know about IFTTT and set up one yourself.

IFTTT communicates with Amazon Alexa by linking it with the developer account. When we say a specific phrase  to Alexa, it will be sent to IFTTT an action will be trigggered.

Follow this step and create an account in IFTTT.

Create an applet with Trigger ‘Alexa' as shown in the above tutorial. Click on ‘Say a specific phrase’ and enter “Light one on”.

SCREEN~3

 

This Trigger fires every time you say “Alexa trigger lights one on”. Now click on Create.

Now its time to create an Action. For that click ‘that’. Now select ‘Web hooks'

Screenshot-from-2018-03-22-04-07-36-e1521817275459

 

Select ‘Make a web request.'

SC9A56~1

 

and enter the details as below

SC02A7~1

 

URL : http://259325d1.ngrok.io/light_one_on (http://<ngrok_URL>/light_one_on)

Method : Get

Content Type : Text / Plain

Click on ‘Create Action' and then click Finish.

 

SC6AC9~1

Similarly create another applet to turn off the light and enter the below contents in webhook

URL : http://259325d1.ngrok.io/light_one_off (http://<ngrok_URL>/light_one_off)

Method : Get

Content Type : Text / Plain

For now, our work here is done.

 

Step 4 – The Code

Matrix Alexa Home Automation code is available on github. You can download using the below link.

[Download]

Make sure you have installed flask. If not, you can install it by

pip install flask

Step 5 – Connections

Shown below is the pinout diagram of MATRIX Voice to connect the relays in your Matrix Alexa Home Automation.

Connections

Use any of these GPIO pins and connect it to relay. That relay should be connected to light.

Start Home Automation

Once all the connections are complete, run the python code you downloaded from github.

Now your Matrix Alexa Home Automation is all set up and ready for action. You have Alexa running in your Pi with MATRIX Voice, ngrok running, and a flask server up and running. Now try saying.

Alexa, Trigger Light one ON

This should turn on your light that is connected to the relay.

Now try saying.

Alexa, Trigger Light one OFF

This should turn OFF the light.

Now you can add more devices i your Matrix Alexa Home Automation by adding some more applets in IFTTT and a little bit of tinkering in the code.

 

 

Read More Information….

MATRIX ALEXA HOME AUTOMATION – MATRIX VOICE/CREATOR & RASPBERRY PI


About The Author

Muhammad Bilal

I am highly skilled and motivated individual with a Master's degree in Computer Science. I have extensive experience in technical writing and a deep understanding of SEO practices.

Scroll to Top