What's New:

Tuesday 24 May 2016

PC Based Home Automation

 Authors: Babalola Oluwadamilola, Anumbor Ogor

 
house


Introduction

The switching of bulbs in homes has always been done using mechanical switches but with this project the switches would be interfaced with GUI (Graphic User Interface) and the switching will now be done by tapping of buttons on PCs(Desktop) anywhere in the house which would reduce the stress of moving around the house to flip switches.

The main objective of this project is to interface house on PC using a simple GUI for switching.

The GUI was built using C# which was connected to the Arduino micro-controller (MCU) unit using Serial port and then relays being controlled by the micro-controller unit were used for switching.

Components used:

       Quantity                Component
             1               Arduino UNO R3 MCU with USB cord
             3               BC548 NPN Transistors
             3               1k Resistors
             3               12v DC Relays
             3               60W AC Bulbs
             1               12v DC power source
             1               220-240v AC power source


The Block diagram
 
block diagram


Hardware Implementation

There are three outputs from the Arduino which are supposed to drive the relays used for switching but the source-driving current from the micro-controller unit is not enough and the Arduino micro-controller source voltage is 5V DC. Each relay requires a 12V DC for functional operation and thus a need to augment for that correct voltage supply using a transistor device.


schematic diagram

 1k resistors are each connected to the base of the transistors which are used to bias the transistor, that is, the transistor are used to keep the transistors in ‘ON’ and operating state condition, Q , and to prevent them from reaching saturation. The transistors used in the project are NPN transistors with part numbers BC548.

The three BC548 NPN transistors are connected in common-emitter configuration in other to amplify the voltage to drive the relays because the 5v coming from the Arduino cannot drive the relays.

The relays are connected in series between the transistor and the 12v DC power source because of the configuration of the transistor.

 
Schematic diagram 
 
A terminal from the AC power source to power the bulbs is connected to the common of the relay  which is connected to the N/C (Normally closed) and the other terminal is connected to one terminals of each bulbs and the other terminals of each bulbs are connected to the N/O (Normally open) of the relay so that when each of the output from the relay gives a HIGH, the transistor will amplify the incoming 5V and drive the relay which will in turn cause the common of the relay to be connected to the N/O, then the AC circuit is now close and then the Bulb comes on.

Originally for the project, a mock house was implemented and a mini construction of the house was made using thick card-board sheets as shown in the figure above, all AC light bulbs and motors were interfaced successfully. But for this article only the light bulbs are shown to be connected.

But all of these was done by just tapping a button on the GUI on a PC which was the aim of the project and it was achieved by sending command from the PC through the serial port to the MCU.


GUI Implementation

The Visual C# interface was implemented on the Microsoft Visual Studio IDE (Integrated Development Environment) which is a robust development environment complete with tool set and software debugger tools that increases productivity of application developers with minimal effort.
 
To design the GUI interface for the home automation interface, the IDE provides a toolbox pane where you can select a variety of controls; buttons, textbox, labels, and other advanced tools like the serial port component object which easily handles everything a developer would need to communicate with other devices connected to their PC.

The design began by selecting a new project and selecting C# as development language. Note that the Visual studio 2010 version was used for implementing the interface. The source codes used for implementation can easily be ported to higher versions easily without any hassles. .Net framework 4 was used and a windows form project was named and selected. Afterwards a form which is like a backdrop for adding other controls would appear.

For the project, buttons, labels, menu controls, serial-port control, and group boxes were selected. Note that the serial port control object can be found under components section in the tool box pane which can then be dragged and dropped on the Windows Form. The interface is shown below although the serial port was dragged on the Form but it doesn't show on the form which is not in any way a problem.

 
GUI main interface

 Wiring the Mock House

The next step after GUI design is to attach events or functionalities to the different buttons. To do so you would need to double-click on each button which would automatically take you to a code editor view and position your cursor inside an empty button-click event where you can now enter the different logic behaviour for your buttons.

Further the project has a serial port interface which can be set before using the above interface which is shown below. It's important to set the COM port that would be used to communicate with other devices as well as the COM Port speed. The figure below shows the interface.

GUI interface: selecting the com port

Wiring the mock house

 

Future Work

In the future we intend to extend the project to utilize a GPRS/GSM module (the SIM-900 GPRS shield) which would provide a way of communicating with our house remotely.
 
This is just a sample project to show that complete interface of a home is possible, from controlling lighting to controlling the doors and windows, sprinkler, Air conditioning systems or any system in homes and this could be used in homes that has already been built and the ones that are yet to be built and it is so affordable and durable.
All source code for GUI implementation can be downloaded.

Mock house

 DOWNLOAD Source Codes for implementation below:

* click here for Arduino code for house automation
* click here for code for GUI main interface
* click here for code for GUI selecting available ports interface

 
Reference:

The Common-Emitter Amplifier:http://www.allaboutcircuits.com/textbook/semiconductors/chpt-4/common-emitter-amplifier/


Project License
 
This project is released under creative common license (http://creativecommons.org/licenses/) type - Attribution CC BY - which allow others to distribute, remix, tweak, and build upon the authors work, even commercially, as long as they credit the author for the original creation.

Please note further, that different projects published on this blog use different licensing type, so readers of the blog are encouraged to read and understand the type of licenses projects are published and released under, and to adhere strictly to the authors licensing specifications for each projects.



Disclaimer/Caveat

Please note that the authors do not and would not take responsibility for using this project in critical applications. The project was published for learning purposes and is especially targeted to those new to electronics. The above system is far from perfect, in terms of performance, and may/may-not be reliable, and so the reason for the advise to not feature in a real life application. You may need to contact a professional whose system has been tested and trusted by certified standard organizations. For shorts, if you are going to use this design in real life, you will be doing that at your own risk.

 


3 comments:

  1. 3. Wow!! Really a nice Article. Thank you so much for your efforts. Definitely. it
    Will be helpful for others. I would like to follow your blog. share more like this.
    Thanks Again.

    Next page

    ReplyDelete
  2. I just clear my concept about backlinks you’re brilliant
    more help

    ReplyDelete
  3. Nice blog thank you sharing really nice and interesting
    try this

    ReplyDelete