Paper— Designing, Building and Controlling of Home Appliances

— Smart home is a residential building that is usually new or modern equipped with necessary tools and wiring that enable its occupants to con-trol a number of electrical devices and several household appliances through a suitable software. Recently, the development of home automation systems is accelerating rapidly as a result of the rapid intersection of modern technologies. Here we are talking about systems for home communication networks as well as entertainment, security, convenience, etc. These systems are controlled by sending signals through wires distributed throughout the house or through wireless means to programmable keys or devices so that they understand these commands and deal with them as desired. In this paper, I will discuss how to design the circuit with appropriate components, build it in Printed Circuit Board and connect it with personal computer by using programmable language in order to control all home appliances by just one click.


Introduction
This paper will outline the design and implementation of a system that will control 8-relays using Personal Computer (PC), so the user can control any of these relays via a graphical user interface on his PC, and since the relay will just take a control signal from the pc on the coil side to close the contactor side, then any load can be controlled whether it is DC load or AC load [1,2].
The (GUI) graphical user interface will be designed on the VB.net ,although we know that there is a lot of free software on the net that support controlling the parallel port but we still want to make our own GUI to give the maximum controllability to the user and also to add our own feature to the software.

History of home automation
In 1970s several reasons affect the appearing of home automation due to expensive economic life and high prices of the products and installation which conflicts with its creation [3].In Japan 1995 A specialized company (Welfare Techno-Houses) was established to take care of elderly and the disabled people in homes using the latest medical devices to maintain their healthy lives [4].
The MavHome project (Managing an Adaptive Versatile Home) was managed and supervised by the university of Texas at Arlington to use sensors to control the environment of home with suitable diction [5].SAP laboratories in Canada with researches from the University of McGill presented the new technique of wireless to receive signals through a wireless network using internet protocols to use for medical assistance [6].

Aims
• To build small room that can be controlled by using software or program in computer which gives signals to electronic components of the circuit deals with the various devices. These responses are device dependent. Such responses include status, open, close, turn on/off, lock, and unlock to save time and energy. • To design user interface system that will take the commands from the user.
• To control light switches, electric sockets and TV.

Benefits
Every one now a days looking for the conformability in everywhere whether in his home, company or the factory, and since there are electric devices such as home appliances, air conditions heater and pumps, it becomes a big target to control all of those appliances while sitting on your laptop, so the user can turn on/off any load like turning the lights on in certain room in his home or turn off the heater if he forgot to switch it off before leaving the office.
In addition, when the load is connecting to the PC then any program can be used to control them starting from the normal on/off operation one to the more complicated that can be controlled by time or using the internet. At the time you interface the electric device to work from a signal coming from the PC then any future expansion can be done easily by just edit the computer code.

Hardware Implementation
As mentioned in our aim is to design a system that will control real AC or DC load using the personal computer and in order to explain the work process we will divide this chapter into three sections: • Block diagram of the hardware: To describe the connection between the main blocks is described and also the advantage and disadvantage of each block will be introduced.
• Schematic diagram: To illustrate all the wires connection will be introduced and the pin out of each element will be explained. • Software implementation: In this section the software of the PIC microcontroller and the flow chart of the system will be explained also the vb.net application and the user manual will be introduced.

Describe the system block diagram
As shown in Fig.1. the block diagram consists of the personal computer that will run the controlling application it can be desktop or laptop, the application will take the commands from the GUI and convert them to serial data to be sent to the serial port, but because we used a USB to serial converter then those data will be sent through the USB port using RS232 format. The second block is the USB to serial converter, this chip will communicate with the USB port to get the serial data that is sent from the application on the laptop and fed these data using 15 pin serial connector to the level shifter. The third block is the level shifter, since the computer protocol for the serial communication is 0V for logic one and +12V for logic zero then we have to convert those levels for the TTL level so we needs the level shifter. PIC microcontroller which acts as the brain of the whole hardware system, it will receive the incoming serial data and save this command in an 8-bit register then it will take the appropriate action to close or open the desired relay. The drive circuit takes the command signal from PIC microcontroller and amplify the current to drive the relay.

4.2
System components PIC microcontroller. PIC microcontrollers is a type of programmable microcontroller which produced by microchip, it can be programmed by many programming language.
All technical description in [7].It has many features: • Analog inputs.
• Any bin can be produced as output or input by the program.
• LCD can be connected.
• Cheap • Easy to program.
• Can be programmed 100 thousand times.
• Flash memory used RS232. It is used to connect between the port of PC and the electronics circuit board because it has a good feature of transmission data. Usually used in fact to connect PC with printer or modem.
Connector. It used to connect with RS232 in order to receive and send the signals. Serial Connector properties as in Table 1. Relays. It is an a contactor switch based in magnetic field produced in coil inside it .it is also called electromagnetic switch .It has five contacts N.C (Normally close ), N.O ( Normally Open ) ,Common pin and two pin for coil. Once the current moved to coil , it changes N.C to open contacts and N.O to close contacts. The ratings of the Relays used is 12 V-10 A. This means the coil voltage for relays is ~12 volts, and the current rating on relay contacts tells how much current can be passed through the contacts without damage them. As it is shown in the circuit the eight relays are con-nected to a transistor and a 3.3K! resistor. The resistor and the transistor collectively form what is known as the transistor switch which is needed to drive the relay.
NPN transistor. It is used for controlling 12v coil relay. in order to drive the transistor into saturation, we should adjust the base current through base resistor.to get 12 v with lowest power dissipation to transfer it to relay. As you can also see a power diode (1N4001) is connected across the relay coil, to protect the transistor from damage due to the back-EMF pulse generated in the relay coil's inductance when its turns off. Unconnected Collector of an NPN Transistor which is called an open collector. The transistor Emitter is connected to directly to ground which means that voltage is 0 or it is a negative voltage and the Base of the transistor is operated by a v+ via a resistor. Thus the transistor converts the low current low voltage output of a logic device to high current and voltage for some purpose of the transistor.
Voltage Regulator. In order to operate our circuit from a normal dc battery or from a transformer then we have to use the voltage regulator because it converts any dc voltage in the range of (7-24) volt to 5V, so the microcontroller will get its voltage without being afraid of that the voltage will go up and burn the microcontroller .The voltage regulator pin out 1 is the input voltage pin. 2 is the common ground pin. 3 is the output 5V pin. In our circuit we used a DC power supply so there is no need of the capacitor on the input of the regulator, but we attached a 1000uF capacitor on the output to stabilize a +5V on the output, the following Fig.2. shows how exactly I connect the regulator in the circuit. The final circuit diagram in Fig.3. describes the components used in circuit.

Software Implementation
As mentioned earlier, a PIC microcontroller which is the 16f876A was used. In order to create the code for the PIC a compiler called MikroBasic was used. MikroBasic is a rich development tool for PIC microcontrollers supplied by MikroElectronika®. It is designed to provide the easiest solutions for developing applications for embedded systems, without compromising performance or control [8].

Program Flow Chart
Program flow chart was created to explain the application's main code. The flow chart explains the logic of the code and how each component interacts with the others.
As shown in Fig.5. the simplified flow chart is illustrated, after switching the power on the PIC microcontroller will make the initialization i.e. (input pins and output pins) Then the microcontroller will turn off all the relays as starting point, then the microcontroller will wait until 1-byte is received , if 1-byte received successfully received then it will decide the action upon the received byte as follow in Table 2.

Virtual Basic.NET
Visual Studio .NET is an integrated development environment that helps you to quickly design, develop, debug, and deploy .NET-based solutions. You can access a common set of tools, designers, and editors from any Visual Studio.NET programming language. You can create Windows Forms and Web Forms applications that integrate data and business logic.

NET Framework
It is help the user to create new website application, desktop and run any devices or PC's. You can download the latest version from Microsoft website.

Visual basic graphical user interface
Finally, as shown in Fig 6. we have used the vb.net to build our GUI, there is a dedicated button for each relay (on, off) and also the user can choose the "all on " button to turn on all the relays or use the "all off" button to switch off all the load.  The next step is to print the circuit in to the Electronic board (PCB) and inserting the components in the correct position as shown in Fig. 8. and Fig.9. Copper track and component soldering. By clicking in R1 ON in graphical user interface from the PC, the Blue LED will light up which means that you can use AC or DC loads which can be connected in terminals and operated perfectly (see Fig.11).
The same procedures can be used for all relays either individually or by selecting relay you need to switch it ON (see Fig.12). Here I click in All ON button from PC. Conclusions and Recommendations

Conclusions
Since most of the objectives are fulfilled, a system work perfectly which provides the following services: • Turn ON/OFF in any of the eight loads using an intelligent graphical user interface.
• I used a unique code for the open and close command for the same relay, so if the user clicks relay 1 on two times it remain the same action ON. • I used indication LED's for each relay so if there is any relay is in ON position the corresponding led will be ON. • At the start of the system all the relays will be off by default.
• There is receiving command LED on the board so when the computer sends any byte this led will be turned ON. • When choosing all ON or all-OFF, the microcontroller will turn the relays in sequence with 500ms separation time to avoid starting all the loads at the same time so the inrush current will be very high causing the circuit breaker to trip if there is any.

Troubleshooting
If it is happen that someone tried to turn on any load and it doesn't respond the he has to follow the following procedure: • Check the serial connector if it is properly connected.
• Check the power supply.
• Try to send command from the PC, the receiving led should go on, otherwise the problem comes from the PC so try to reinstall the software. • Try to disconnect the power from the supply so the microcontroller will be restarted.

Recommendations
The application which is used in the visual basic.net can be modified to be used remotely via the global internet. So the user can choose any of the loads to be ON /OFF using the internet from any location and also the application can be added specific times and days in order to control relays. Moreover, you can control your PC from your mobile by downloading free application from many companies that can you access and remote PC without installing software to safe your money and time.