A MICROCONTROLLER FRAMEWORK FOR PC BASED ELECTRICAL APPLIANCE CONTROL SYSTEM
Electrical and Electronics Project by Ravi Devani
ABSTRACT
Personal computers are increasingly becoming the platform
of choice to design and implement control algorithms because it is simple to
write, modify and update software programs that implement control algorithms.
In this paper, the personal computer is used to control
the electrical appliances which includes turning high power alternating current
(AC) loads such as lights, fans, heaters etc ON or OFF. To successfully integrate
the interface box with the machine (laptop), an interface device is used within
the PC that can perform the necessary tasks. The interface box can be
controlled by the computer by connecting to the USB port and developed a program
in C-sharp(C#) programming language. The program will demonstrate the basic
idea of how to control devices and monitor events. With the program, the
computer can turn electric devices ON/OFF while disregarding the manual control
system. Moreover, the people who are physically disabled in homes and work places
are able to control the home appliances by interacting with the interface of
the developed appliance. It is a necessity to employ the service of Home
Appliances Control as it is more effective, efficient and stress-free.
Keywords: Personal
Computers, Home Control Appliance, Distribution Fuse Board (DFB), Graphical
User Interface (GUI), Interface Box, Internal Module, Enumeration, Local Area
Network (LAN).
INTRODUCTION
A Personal computer (PC) based home control appliance is
the use of control systems at homes, in the offices and in industries to reduce
human efforts. Home control appliances have greatly decreased the need for
human sensory and mental equipments and plays an important role in the world
economy and in daily experience. It is more efficient and stress-free (Coyle et
al 2007). Home and office appliances, including television, VCRs, stereo
equipment, refrigerators,, washing machines, thermostat, light switches,
telephones, copiers and factory equipment, have embedded computers and often
come with remote controls. However, the trend has been that as appliances get
more computerized with more features, their user interfaces get harder to use
(Dickey et al 2012). PCs are commonly used with better input-output capability
than the average home appliance, such as high-resolution screens, text-entry
technologies and speech capability. PC.s are likely to maintain this advantage over
appliances, because improved hardware is a key differentiator between PC and is
often marketed as an incentive to upgrade to a new PC. All PC has the ability
to communicate over the Local Area Network (LAN) and most have built-in short
range communication capabilities, such as Bluetooth, that could allow them to communicate
with and control appliance in their surrounding environment. PC laptops are
also personal devices, which allow them to provide interface that are
personalized (Koyuncu 1995, Nunes and Delgado 2000, Sriskanthan and Tan 2002).
The brain of the system
The brain of the system is actually a small computer
whose job is to close the switch that activates the switches that powers
sensing devices when ON or OFF. Home based PC differs mainly in Distribution
Fuse Board (DFB) and how various home appliances are wired in to the brain. The
brain and the DFB features may be wired into the control room, but they usually
have a back-up power source as well. The architecture of the PC home based appliances
control system is shown in Figure 1.
The system consists of two units (Swamy et al 2002,
Nichols and Myers, 2006):
(i) Control unit: The control unit is based on the use of
standard personal computer with Graphical User Interface (GUI) software to
control the electrical appliances.
(ii) Interface unit: The interface unit is for
interfacing the high power loads with the control unit.
Figure 1: Architecture of the PC home based
appliances control
Hardware Design of the Interface Box
The design of the interface box that is used to connect
high power load to the computer is discussed here.
Internal module
The internal circuitry of the interface box can be
divided into three main categories namely: relay driver circuit, relay and +6 V
DC power supply.
Computer Interfacing
The Universal Bus (USB) is one of the most common interfaces
used in electronic consumer product today, including PCS, cameras, GPS devices,
MP3 players, modems , printers and scanners, to mention a few. These are data
lines, control lines and status lines. The USB is a high-speed serial interface
that can provide power to device connected to it(Kim et al 2010, Lin and
Brogerg 2002, Neng-Shiiang et al, 2002). A USB bus supports up to 127 devices
(limited by the 7-bit address field noting that address 0 is not used as it has
a special purpose) connected through a four-wire serial cable of three to five
meters long. Many USB devices can be connected to the same bus with hubs, which
can have 4, 8, or even 16 ports. A device can be plugged into a hub which is plugged
into another hub and so on. The maximum number of tiers permitted is six.
According to the specification, the maximum distance of a device from its host
is about thirty meters, accomplished by using five hubs. For longer-distance
bus communications, other methods such as use of Ethernet are recommended. The
USB bus specification comes in two versions: the version USB 1.1, supporting
11Mbps, while the version,
USB 2.0 supports up to 480Mbps. The USB specification
defines three data speeds(Al-Ali and Al-Rousan 2004, Kobatake et al 1989).:
i. Low speed ---- 1.5Mb/sec.
ii. Full speed------ 12Mb/sec.
iii. High speed ----- 480Mb/sec.
The maximum power available to an external device is
limited to about 100mA at 5.0V. USB is a four- wire interface implemented using
a four-core shielded cable. Two types of connectors are specified and used,
Table 1 shows typical USB connectors and Table 2 shows the pin-out of the USB
connectors. The signal wire colors are specified. The specification also
defines a mini-B connector, mainly used in smaller portable electronic devices such
as cameras and other handheld devices. This connector has a fifth pin called
ID, though this pin is not used. The pin assignment and wire colors of a mini-B
connector are given. Two of the pins, Data + and Data -, form a twisted pair
and differential data signals and some single- ended data states.
Electrical and Electronics Project by Ravi Devani
Table 1: USB pin configuration
Table 2: USB pin assignment
Enumeration
When a device is plugged into a USB bus, it becomes known
to the host through a process called enumeration.
The steps of enumeration are (Anamal and Kamruzzaman
2006, Casimiro et al 2004):
i. When a device is plugged in, the host becomes aware of
it because one of the data line voltages (Dp or D) becomes logic high.
ii. The host sends a USB reset signal to the device to
place the device in a known state. The reset device responds to address 0.
iii. The host sends a request on address 0 to the device
to find out its maximum packet size using a Get Descriptor command.
iv. The device responds by sending a small portion of the
device descriptor.
v. The host sends a USB reset again.
vi. The host assigns a unique address to the device and
sends a Set Address request to the device.
MATERIALS AND METHOD
The design demonstrates a system that allows one to
control home appliance and turns ON or OFF any appliance that is connected to a
computer. The appliances are connected to the computer via a microcontroller.
The power supply for each appliance is through an electromechanical relay. A
number of relays are used depending on the number of appliances to be
controlled. All the relays are controlled by a microcontroller. The
microcontroller is connected to the computer via a USB to RS232 Converter. The
diagram below in Figure 2 shows the block diagram of the system.
Figure.2: Block Diagram of the designed
system
Approach to Development of the Framework
The basis of the hardware design is mainly the PICI6F876A
microcontroller using micro C pro compiler. Two circuit diagrams were
developed. These are:
i. Power supply regulation circuit
ii. Main component circuit
Power Supply Regulation Circuit
The a.c. power supply to the circuit has to be regulated
to a reasonable amount for the workability and durability of the circuit
components. The power supply regulation circuit is shown in Figure 3.The power
supply regulation process is accomplished by following the four stages listed
below:
i Transformer
ii Rectification
iii. Filtering
iv. Voltage regulation
Transformer
The a.c. supply gives out 220V or above and the supply is
stepped down by the transformer to a reasonable amount of 12V which is needed
for the operation of the circuit.
Rectification
There is the need for the conversion of the a.c. voltage
to d.c. voltage. Diodes help in this conversion process.
However, in the conversion process the voltage drop
across the diode which is greater than 1V is added to the already stepped down
12V and making the total voltage in the rectification to be 13V or greater.
Filtering
The capacitor removes or filters the ripples generated
and produced alongside the rectification process.
Voltage Regulation
Voltage regulator are devices that produce constant d.c.
voltage regardless of the variation in the input load. Two voltage regulators
are used in this stage. These are:
i LM7812 voltage regulator
ii LM7805 voltage regulator
Figure 3: Power supply regulation circuit
Main component Circuit Analysis
The USB cable is fed to the DB-9 which is actually a
serial connector. This serial connector allows for bidirectional communication
between the system and the hardware (I.e it sends signals to and receives
signals from the PC.) The DB-9 though stabbed at pin 5 is fed to the MAX232
which is the level converter. The level converter does and undoes the signal by
generating a total of 12V supply and reversing it to 5V d.c. supply. It is fed
to the PIC16F876A microcontroller from the level converter. A d.c. voltage of
5V is needed for the operation of the PIC. It processes the signal according to
instruction. Attached to the microcontroller is the clock pulse which generates
clock frequency for the microcontroller. The clock pulse is the heart of the
microcontroller as the microcontroller fails to work in the absence of those
clock frequencies. A d.c voltage of 12V is needed for the operation of the
relay. A total of seven relays were used as each relay demands a transistor for
amplification. One kilo ohms resistor was also introduced to restrict and
oppose the amount of current that flows to the base of the transistor. The
signal is finally executed as the relay opens up to socket to be controlled.
The main component circuit analysis is shown in Figure 4.
Figure 4:Main component circuit analysis
Electrical and Electronics Project by Ravi Devani
Electrical and Electronics Project by Ravi Devani
Software Interface
The layout of the software used for controlling various
home appliance is shown in Figure 5 .As an experimental basis, the following
layouts are present in the software interface:
i Seven rooms with their corresponding ON and OFF
buttons.
ii Selection of communication port
iii. All ON button
iv. All OFF button
v. ROM status interface which consists of check status
and clear report.
At first, a port number is set in the Selection Com Port
field of the layout to activate connection
between computer and microcontroller. If the connection
is successful, then it is possible to control the appliances from the computer.
Each device can be controlled either as an ON or OFF mode by pressing ON or OFF
button on the layout. The “check status” reports the state (ON or OFF) of the
electrical control l appliances by displaying information that the appliance is
ON. The clear report command gets rid of the information reported in the room
status interface. Although, only seven rooms have been shown, but any number of
devices can be controlled from a computer with a slight modification in the
designed system. The software layout interface is shown in Figure 5.
Figure 5: Software Interface layout
PIC-GUI Communication
The hardware uses RS232 converter to communicate with the
software. Contained in the RS232 converter is the RS232 library which has RX
(receiver) and TX (transmitter) for both transmissions and reception of
signals. The software in the other end has serial port library which is one of
the controls in c-sharp library. It is thus programmed to enable transmission
and reception of signals. Once the “COM port” is selected in the software, a
link is opened up for communication between the hardware and the software which
will last for microseconds. Through, there is a propagation delay which allows for
execution of commands or instruction before transmission of another signal. For
every button clicked in the graphical user interface. The serial port library uses its TX to
transmit the signal to the hardware. The signal is received by the hardware via
its RX, processed according to instruction and opens up the relay of the
required unit and therefore switches ON its socket The hardware on the reverse
end uses its TX to transmit signal (indicating the reception of the sent signal
by the program) to the software. The software receives the signal via its RX
and thus acknowledges it by displaying the message about the state (ON or OFF)
of the required unit on the room status interface. The flow chart showing
PIC-GUI communication is shown in Figure 6.
Figure 6: Flow chart showing PIC- GUI
communication
Choice of Programming Language
The application program used in this research paper is
C-Sharp.
Reasons for the choice of programming language
(i) It is very convenient to use (i.e it has improved
Graphical User Interface)
(ii) It has controls that one can pick and drop.
(iii) It is easier to communicate with the PIC
microcontroller.
RESULTS
Description of Flow Process Initially, all the switches
are in the state. When the ON button is clicked in the software interface to
turn ON the desired device, the software converts the ON command into hex code,
then sends the value to USB port address. It sends logic 1 (3.5-5V) to the
microcontroller through RS232 converter. The microcontroller then sends a 1 to
the transistor. It will activate the transistor used to energies the relay.
There is an inductor (a wire coil), when energized with an electric pulse, will
generate a magnetic field. The second part of the relay is a system of metallic
arms, which makes up the physical contact of the switch. When the replay is ON,
or an electric pulse is sent to the relay, the swing or switching arm of the
relay moves to another contact of the relay. The arm moves as the generated
magnetic field pulls the swinging arm towards the inductor (or wire coil), the a.c.
circuit is completed and the electrical appliance is turned ON. When the OFF
button is clicked to turn off a device, the software converts the OFF command
into hex code, then sends the value to USB port address. It sends logic 0
(0-1.5V) to the microcontroller through the RS232 converter. Then the
microcontroller sends a 0 to the transistor. It will deactivate the transistor
used to energize the relay. The arm of the relay swings back to another
position, which makes the path of the current flow open and hence electrical
appliance is turned OFF. The terminal input of each appliance is wired across, then
sends the value to USB port address. It sends logic 0 (0-1.5V) to the
microcontroller through the RS232 converter. Then the microcontroller sends a 0
to the transistor. It will deactivate the transistor used to energize the
relay, thus the power to the appliance is switched ON or OFF depending on
whether the relay is active or not. The diagram of the flow chart design system
is as shown in Figure 7.
Figure 7: The flow chart of the designed system
CONCLUSION
The user’s choice is clicked in the developed window
application through the PC and signal travels via the USB cable to the
corresponding connection. Based on this command, the required appliance is
triggered. It can be used at homes, street light management, hotels, power
management, high voltage grid control and in industries.
REFERENCES
1] Al-Ali S.A, AL-Rousan M.T.(2004):“Home Automation
System”. IEEE Transactions on Consumer Electronics, Vol.50, No. 2, Pp. 13- 19.
2] Anamul H.S.M, Kamruzzaman S.M. (2006): “Microprocessor
and Interfacing and Hardware”.Publication, Second Edition, Pp. 33- 41.
3] Casimiro A, Kaiser J and Verissimo P.(2004):“An
Architecture Framework and Middleware for Control Architecture for Home Automation
System in the Internet Era”Proceedings ICRA Cooperating Smart Components, in
Proc. Of CF’04 Italy, ACM. Pp. 28-39.
4] Coyle L, Neely S, Stevenson G,Sullivan M, Dobson S and
Nixon P. (2007): “Sensor Fusion-Based Middleware for Smart Homes”.International
Journal of ARM, Vol.8,No. 2, Pp. 53-60
5] Dickey N, Banks D and Sukittanon S. (2012): “Home
Automation using Cloud Network and Mobile Devices”. Proc. Of IEEE International
Conference at Southeast on, Electrotechnical Conference, MELECON 10th
Mediterranean, Vol. 1,Pp. 298- 301.
6] Kim T, Lee H and Chung Y. (2010): “Advanced Universal
Remote Controller for Home Automation and Security”. IEEE Transaction on
Consumer Electronics, Vol. 56, No. 4, Pp. 2537- 2542.
7] Kobatake S, Shirai H, Owada H and Yoshittomi K.
(1989): “HBS-Standard-Compatible Home Bus Protocol Controller”. IEEE Trans. On
Consumer Electronics, Vol. 35, No. 3, Pp. 605-607.
8] Koyuncu B. (1995): “PC Remote Control of Appliances by
using Telephone Lines”. IEEE Transaction on Consumer Electronics, Vol. 41.No.
1, Pp. 201- 209.
9] Lin P and Broberg H. (2002): “HVAC Application”. IEEE
Industry Application Magazine, Pp. 49- 54.
10] Neng S L, Li-Chen F abd Chao-Lin W. (2002): “An
Integrated, Flexible and Internet- based Networks for Home Automation”. IEEE
International Conference on Robotics and Automation, Vol. 2, Pp. 1101- 1106.
11] Nichols J and Myers B.A. (2006): “Controlling Home
and Office Appliances with Smart Phones”.IEEE Pervasive Computing, Pp. 60- 67.
12] Nunes J and Delgado J. (2000): “An Internet
Application for Home Automation”. Electrotechnical Conference, MELECON, Vol.
1.Pp. 298- 301.
13] Sriskanthan N and Tan K. (2002): “Bluetooth Based
Home Automation System”. Journal of Microprocessors and Microsystem, Vol. 26,
Pp. 281- 289.
14] Swamy N, Kuljaca O and Lewis F. (2002):
“Internet-Based Educational Control System Lab Using Net- Meeting”.IEEE
Transaction on Education, vol. 45, No. 2, Pp.145- 151.
Electrical and Electronics Project by Ravi Devani
No comments:
Post a Comment