Smart Home Solution

About the project

A solution for home automation with PSOC 6 WiFi-BT pioneer kit. There are multiple ways to interact, example : an android application, voice commands for Amazon Alexa and Google assistant, touch. All the smart devices of your home will be controlled on a single interface which makes it more user friendly and fun.

Project info

Items used in this project

Hardware components

Cy8ckit-062-wifi-bt Psoc 6 Pioneer Kit Cy8ckit-062-wifi-bt Psoc 6 Pioneer Kit x 1
5v Relay 5v Relay Use as many as relay to control home appliances x 2
Metallized Polyester Fan Regulator Capacitors Metallized Polyester Fan Regulator Capacitors 1.1k, 2.2k, 3.3k uF x 1
Schottky Diode 100V 3 A Schottky Diode 100V 3 A For prevent PSOC from relay back current x 2
moc3063 moc3063 To control fan speed x 4
BT136-600v-4a-triac BT136-600v-4a-triac For operating capacitor x 4

Software apps and online services

Modus Toolbox Modus Toolbox To program PSOC 6 KIT
Mosquitto Broker Mosquitto Broker CloudMQTT (you can use any one of available in the internet)
Amazon Web Service Amazon Web Service Lambda is used for handle alexa request (Python)
Amazon Alexa Amazon Alexa Alexa developer, create a skill for smart home control
Google Action Google Action Create a action for smart home control
Android studio Android studio Using JAVA and paho mqtt service create an android application

Hand tools and fabrication machines

Soldering Iron and wire Soldering Iron and wire x 1

Story

Home automation is building automation for a home, called a smart home. A home automation system will monitor and/or control home attributes such as lighting, climate, entertainment systems, and appliances. It may also include home security such as access control and alarm systems. A home automation system typically connects controlled devices to a central hub or "gateway". The user interface for control of the system uses either wall-mounted terminals, tablet or desktop computers, a mobile phone application, or a Web interface that may also be accessible off-site through the Internet. Home automation has high potential for sharing data between family members or trusted individuals for personal security and could lead to energy saving measures with a positive environmental impact in the future.

After looking at the psoc6 cypress boards and features, I decided to create smart home automation system. It has CAPSENSE functionality, Wi-Fi enabled and much more related to IoT and luckily I got selected for "The Great PSoC 6 Design Challenge".

Now I am going to give overview of the project.

How to start ?

1. Modus toolbox : Write Psoc6 program to handle MQTT, Cap Sense and GPIOs

2. Alexa and  Google Action : To enable voice command

What you need ?

1. PSoC 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) : Kit is main brain for whole project. It will handle MQTT messages come from smart phone or alexa or google action and react for the same. Detect touch and control relay using GPIOs.

2. 5v Relay : Relay will control electrical appliances to turn on and turn off. So relay is a switch which controls (open and close) circuits electromechanically. The main operation of this device is to make or break contact with the help of a signal without any human involvement in order to switch it ON or OFF. It is mainly used to control a high powered circuit using a low power signal.

3. Diode : Diode is used here to prevent PSOC6. 

4. Optocoupler IC (moc3063) : A current is first applied to the Optocoupler, which makes the infrared LED emit a light that's proportional to the current. When the light hits the photosensitive device, it switches on and starts to conduct a current as any ordinary transistor might.

5. Triac (BT136-600v-4a-triac) : Triacs are electronic components that are widely used in AC power control applications. They are able to switch high voltages and high levels of current, and over both parts of an AC waveform. This makes triac circuits ideal for use in a variety of applications where power switching is needed.

6. Metallized Polyester Fan Regulator Capacitors : Capacitor is used for controlling fan speed. 

Connection of Projects :

1. Controlling Electronics appliances : 

2. Controlling Fan Speed 

MQTT topic and message description : 

Kit have two Capsense button. I used that as two switches.

Capsense 1 --> Topic : cap1 --> Message : TURNON/TURNOFF

Capsense 2 --> Topic : cap2 --> Message : TURNON/TURNOFF   

1. PSOC6 Modus toolbox :

To get started with psoc 6 wifi-bt pioneer kit install Modus toolbox. Install all packages for psoc 6 wifi-bt pioneer kit which is around 554 mega bytes. As per my tool kit, I got with update fw-loader version 2. To upload code upgrade fw-loader.

To update kitprog : 

Go to : /ModusToolbox/tools_2.2/fw-loader/bin 

To update kit prog press sw3 button to select mode.

Open power shell (windows) : ./fw-loader --device-list 

It will show list of kit prog. Now to update copy kitprog number and type : ./fw-loader --update-kp3 KitProg2-xxxxxxxxxxxxxxxxxxx. Kit is successfully updated.

Now to upload example code open modus toolbox create a workspace. Go to file-->new-->ModusToolbox application.

Note : SW3 button is for mode

Code Link : https://github.com/ddmakadia1699/SHA_Electromaker_io_PSOC6

2. Amazon Alexa :

To create Amazon Alexa smart home skill follow the steps given below in the video. Make sure create a rule which will allow lambda function to read data from dynamodb to get live status of switch in amazon alexa application and google home application.

Role : 

Also change runtime setting in lambda function. Edit handler lambda_function to only lambda (if you copy paste my code).

If any doubt, feel free to contact : androotguru@gmail.com

3. Google action :

Account linking and setup for google action :

4. Android application :

Edit MQTT credential in code which is provided on github to create an Android Application.

Schematics, diagrams and documents

Controlling Fan Speed

To control fan speed used metallized polyester capacitors, triac and Optocoupler IC

Controlling Electronics appliances

5v Relay connection with psoc 6 gpio pins

Code

Google Action

Lambda(python 3.6) Dynamodb API Gateway Google Smart Home

Android App

Amazon Alexa Skill

Lambda (python 3.6) Dynamodb Amazon Smart Home

Modus Toolbox

Smart home automation using Psoc 6 wifi-bt pioneer kit

Credits

Leave your feedback...