in ,

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.

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.

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 from here or click on the image.

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.

MATRIX Voice Alexa Raspberry Pi Easy Setup

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.

Access Local Device without Port Forwarding – Ngrok Working & Setup

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

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.

MATRIX Alexa IFTTT Integration in Raspberry Pi Tutorial

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”.

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'

Select 'Make a web request.'

and enter the details as below

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.

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.

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. Feel free to

Rate the Project

Did you find this page useful? Help us to improve by rating this page.

Rating
MATRIX Alexa Home Automation - MATRIX Voice/Creator & Raspberry Pi Overall rating: 4.5 out of 5 based on 53 reviews.

edit the code. If you are stuck at somewhere, you can use the forum. We will get back to you.

 

What do you think?

0 points
Upvote Downvote

Total votes: 0

Upvotes: 0

Upvotes percentage: 0.000000%

Downvotes: 0

Downvotes percentage: 0.000000%

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading…

Comments

comments

Raspberry Pi B+ Model PoE HAT Features – Power Over Ethernet

SSH without Port Forwarding – Bypass Firewall