Contents
Technologies Used
Name | Description |
---|---|
Ionic Framework | Ionic is an open-source framework used for developing mobile applications. It provides tools and services for building Mobile UI with native look and feel. |
Angular | Angular is a TypeScript-based open-source web application framework. |
Raspberry Pi | The Raspberry Pi is a tiny credit-card-sized computer that has various GPIO pins which can be used to interface with other devices. |
Python | The Python programming language is used to write scripts that run on the Raspberry Pi and control the GPIO pins and the Bluetooth connection. |
Raspberry Pi
A Python script was created which helps the Raspberry Pi work with the Home Automation app to control your devices. This script uses the Python Modules provided for Raspberry Pi based devices to control the Bluetooth functions and the GPIO (General Purpose Input Output) pins.
How it works
The following image shows a sample connection between a garage door, a relay module, and a Raspberry Pi.

Here, the Raspberry Pi is connected to a relay module. A relay module is basically an electronic switch that can be controlled using the GPIO pins on a Raspberry Pi. The relay module can then be used to switch on/off any appliance and in this case, it is used to open a garage door.
Why this approach?
Smart home devices have recently gained popularity and some of the solutions such as Google Home devices, Apple Homekit devices, and Amazon Alexa-based devices are good and have great integrations with mobile devices. However, their solutions do not work with any existing home appliances and new appliances such as light bulbs, switches, fans, etc. have to be purchased in order to have the smart home experience. Additionally, as shown by the recent Google outage showed that if anything goes wrong with the servers of these tech giants, then smart homes may get affected.
The Raspberry Pi & Bluetooth based approach does not rely on any external servers and existing home appliances can be converted into smart devices at a fraction of the cost. This is why this approach was selected.
Mobile App
The mobile app was developed using the Ionic Framework. The Ionic Framework allows us to develop cross-platform applications and we can build apps for Android and iOS from the same codebase. The framework also provides pre-built packages that make it easy to access device features such as Bluetooth.
Home Page
The home page of the app shows a list of devices that have been added by the user along with the current state of the device (on/off). Additionally, if the app is not connected to a Raspberry Pi, a message is shown which lets the user know that no device is currently connected. The user can then click on the "Connect to a Device" button to open the device connection page.
The Home page also has a bottom navigation menu that contains links to the Home Page, the Help Page, and the Settings menu.

Settings Menu
The settings menu has the following main options:
-
Add a Button: The user can select this option to add a new button to the home page. This will take the user to a new page where they have to enter the name, type, and value of the button to be added. The following image shows the Add Button Page.
-
Edit Buttons: The user can select this option to enable editing mode. When this mode is activated, a bin icon is displayed next to all the buttons. The user can click this icon to delete a button from the Home Page. Once the user is satisfied with all the changes, they can select the tick icon to confirm their changes and exit editing mode. The following image shows what the home page looks like when the editing mode is activated.
-
Disconnect: The user can select this option to disconnect their phone from the Raspberry Pi.
Device Connection Page
The device connection page shows a list of paired devices and available devices. This page also has a refresh floating action button which refreshes the list with any new devices that are discovered in the Bluetooth scan. The user can select their Raspberry Pi (usually named raspberrypi by default) from this list and connect to it easily.

Help Page
This page opens the GitHub page for the Home Automation Scripts and displays it using the in-app browser. This page contains a full guide to configuring a Raspberry Pi or an Arduino Board along with an HC-06 Bluetooth module. The user can follow this guide to set up their Raspberry Pi and make the connections to the appliances that they want to control with the app.
