Beruflich Dokumente
Kultur Dokumente
Chapter 1
The first part contains a interfacing circuits which should be connected with the PC
via a parallel port. The computer should need a high definition language such as C,
C+, C++, QuickBasic, visual c, c# etc according to user’s choice. The program will
define the address of the LPT port for the computer as well as function and status of
the devices whether the devices are on or off.
The second part contains a setup which could turn on/off the whole system externally.
Here we use cell phone as it is used widely in modern life. The setup contains a
mobile set, a decoder and programmable microcontroller. The decoder will decode the
signal from mobile to microcontroller and the microcontroller trigger the relay which
is connected to the interfacing unit.
· To generate and develop a circuit that will accept the signals from a
computer interface via a port and control the switching of the relays
which in turn will control the appliances running on mains power.
· To analyze and develop the instruction codes utilized by the interface
to interact with the device using a high-level programming language.
· To design a DTMF decoder circuit which decodes the frequency of the
button assigned to mobile phone.
· To connect the decoder with a PIC microcontroller and programming it
with necessary condition.
· Finally Implement and combine the whole system.
2
Automation has had a notable impact in a wide range of highly visible industries,
independent systems and general public services. Medical processes are also carried
out at much greater speed and accuracy by automated systems. Automated teller
machines have reduced the need for bank visits to obtain cash and carry out
transactions. In general, automation has been responsible for the shift in the world
economy from agrarian to industrial in the 19th century and from industrial to
services in the 20th century.
The widespread impact of industrial automation raises social issues one of which is
the impact on labor employment. Historical concerns about the effects of automation
date back to the beginning of the industrial revolution, when a social movement of
English textile machine operators in the early 1800s protested by destroying such
textile machines, which they felt threatened their jobs. When automation was first
introduced, it caused widespread fear. It was thought that the displacement of human
operators by computerized systems would lead to severe unemployment – this
situation might be vague but in certain cases it has been true. Automation might
appear to diminish labor through its replacement with less-expensive machines.
Since the 1960s, the nature of automation has undergone dramatic changes as a result
of the availability of computers. For many years, automated machines were limited by
the amount of feedback data they could collect and interpret. Thus, their operation
was limited to a relatively small number of alternatives. When an automated machine
is placed under the control of a computer, however, that disadvantage disappears. The
computer can analyze a vast number of sensory inputs from a system and decide
which of many responses it should make.
Today, the field of automation is quite advanced, and continues to advance
increasingly more rapidly throughout the world and is influencing on more skilled and
complicated tasks, yet during the same period the general well-being and quality of
life of most people in the world have improved radically.
through a cycle and then stop. A dishwashing machine, microwave oven, a coffee
maker, and a CD player are examples of open-loop machine devices. Closed-loop
machines are devices capable of responding to new instructions at some point in their
operation.
The instructions may come from the operation being performed itself, known as a
feedback or from a human operator. Some closed-loop machines contain sensors, but
are unable to make necessary adjustments on their own. Instead, sensor readings are
sent to human operators who monitor the machine's operation and input any changes
it may need to make in its functioning. Other closed-loop machines contain feedback
mechanisms.
The results of the operation determine what changes, if any, the machine has to make.
Papermaking making machines, steel manufacturing machines, any major
manufacturing machine, etc.
The metaphor of a tree with branches reaching into different locations is a good image
for an integrated full home automation system. Each branch of the tree performs a
different function. One branch of the tree might include home entertainment, such as
television and audio. A second branch could include security, including video
surveillance. A third branch could include telecommunications, like telephone and
intercoms and a fourth branch could include energy and environmental management
including air and water quality, lighting and thermal-comfort.
· burglar alarms
· video entry systems
· programmed thermostats with zoned heating and cooling
· intercoms
· entertainment systems with many speaker and video connections
· central vacuums hazardous gas detectors
· electronic air cleaners water filtration systems
· Fire alarms.
As implied above, there are different levels of home automation. While the more
advanced systems are comprehensive, many households elect not to have a could
notify the occupant at work, if they’re not at home.
The more intelligent system might also automatically activate a back-up pump if the
main pump failed. While many "occupancy sensors" exist to turn on and off lights and
appliances as individuals move through a house, higher level controls can adjust to
individual preferences. For example, Bill Gates’ widely publicized new home has a
system that adjusts the lighting, multi-media displays and other features automatically
to individual user preferences.
5
Chapter 2
comfort, convenience and safety for homeowners and businesses around the world
since 1985. HAI products are sold in over 80 countries through HAI’s worldwide
network of Distribution Partners and installed by trained dealers.
Since 1992, Smarthome has been considered as one of the world's largest home
automation retailer, with a vast collection of lighting, security, and home
entertainment products that the average customer can safely install with the help of
their Do-It-Yourself instruction kits. They are mostly known for the INSTEON and
X10 SmartHome Systems.
The analysis showed that most of the people are now very familiar to automation
systems. This survey has helped the project to get a benchmark on similar products
and set a target range of applications for which the device can be used. It is now
certain that the proposed system can be designed to have capabilities that can compete
with the current systems available on the market with a much cheaper price tag!
Relay Switching
Mobile on/off
system
Figure 2.1: Diagram representing the basic ideology of the proposed system
The approach to the design of the proposed system was divided into following parts:
· The relay controller main board – Hardware component.
· The software to drive the controller – Firmware/software component.
· The mobile decoder circuit and microcontroller circuit.
· The program of the microcontroller
Nevertheless, these are some of the basic capabilities of the very dynamic system. A
more detailed working principle of the device and the components used are
elaborately discussed in the following chapters of this thesis.
Microcontroller can not run if it is not programmed. There are several ways of
programming the microcontroller - using BASIC, C, or Assembly Language. In this
project we use c+ to program the microcontroller. The programming of
microcontroller will be discussed in later chapter.
9
Chapter 3
When a current flows through the control coil , the resulting magnetic field attracts an
armature that is mechanically linked to a moving contact. The movement either makes
or breaks a connection between switch contacts. When the current to the control coil
is switched off, the armature is returned by a force approximately half as strong as the
magnetic force to its relaxed position.
characteristics. The comparisons presented here are between relays with similar
voltage, current, and power ratings in the form factors that are found in typical switch
modules.
The most common types of relays used in automated applications are:
· Electromechanical Relays.
· Reed Relays.
· Solid State Relays (SSRs).
· FET Switches.
In this project, the input voltage rating is 6v DC and the output rating is 120v AC. The
type of relay chosen to handle this specification was dependent on the availability of
relays in the market. So, a survey was conducted to choose the right one for this
application. The following sections explain how these relays operate and identify their
relative strengths and weaknesses.
3.40 Transistors:
In electronics, a transistor is a semiconductor device commonly used to amplify or
switch electronic signals. The transistor is the fundamental building block of
computers, and all other modern electronic devices.
A Bipolar Junction Transistor (BJT) is a type of transistor. It is a three-terminal
device constructed of doped semiconductor material and may be used in amplifying or
switching applications. Bipolar transistors are so named because their operation
involves both electrons and holes. Although a small part of the transistor current is
due to the flow of majority carriers, most of the transistor current is due to the flow of
minority carriers and so BJTs are classified as 'minority-carrier' devices.
The arrow in the NPN transistor symbol is on the emitter leg and points in the
direction of the conventional current flow when the device is in forward active mode.
In this project, NPN transistors were used instead of PNP. The model was NPN
2N2222 transistor.
The other type of BJT is the PNP with the letters "P" and "N" referring to the majority
charge carriers inside the different regions of the transistor.
PNP transistors consist of a layer of N-doped semiconductor between two layers of P-
doped material . A small current leaving the base in common-emitter mode is
amplified in the collector output. In other terms, a PNP transistor is "on" when its base
is pulled low relative to the emitter.
The arrow in the PNP transistor symbol is on the emitter leg and points in the
direction of the conventional current flow when the device is in forward active mode.
An NPN transistor can be considered as two diodes with a shared anode region. In
typical operation, the emitter–base junction is forward biased and the base–collector
junction is reverse biased . In an NPN transistor, when a positive voltage is applied to
the emitter-base junction, the equilibrium between thermally generated carriers and
the repelling electric field of the depletion region becomes unbalanced, allowing
15
thermally excited electrons to inject into the base region. These electrons diffuse
through the base from the region of high concentration near the emitter towards the
region of low concentration near the collector. The electrons in the base are called
minority carriers because the base is doped p-type which would make holes the
majority carriers in the base.
The base region of the transistor must be made thin , so that carriers can diffuse
across it in much less time than the semiconductor's minority carrier lifetime, to
minimize the percentage of carriers that recombine before reaching the base-collector
junction. To ensure this, the thickness of the base is much less than the diffusion
length of the electrons.
The base-collector junction is reverse-biased , so little electron injection occurs from
the collector to the base, but electrons that diffuse through the base towards the
collector are swept into the collector by the electric field in the depletion region of the
base-collector junction.
3.50 Optocouplers:
Optocouplers (or opto-isolators, photocoupler, photoMOS) are useful switching
devices that provide high current gain or drive capability and electrical isolation
between circuit elements. In general, an optocoupler is a hybrid device and consists of
a GaAs-based light-emitting diode (LED) and a photodetector (either a photodiode or
phototransistor) which are optically coupled via an optically-transmitting medium, but
electrically isolated. The basic principle of operation is light emitted from the LED
incident on the photodetector produces a current that switches the output transistor to
conduct current.
The DTMF keypad is laid out in a 4×4 matrix, with each row representing a low
frequency, and each column representing a high frequency. Pressing a single key such as
'1' will send a sinusoidal tone of the two frequencies 697 and 1209 hertz (Hz). The
original keypads had levers inside, so each button activated two contacts. The multiple
tones are the reason for calling the system multi frequency. These tones are then decoded
by the switching center to determine which key was pressed.
20
A crystal is a solid in which the constituent atoms, molecules, or ions are packed in a
regularly ordered, repeating pattern extending in all three spatial dimensions.
Almost any object made of an elastic material could be used like a crystal, with
appropriate transducers, since all objects have natural resonant frequencies of vibration.
For example, steel is very elastic and has a high speed of sound. It was often used in
mechanical filters before quartz. The resonant frequency depends on size, shape,
elasticity, and the speed of sound in the material. High-frequency crystals are typically
cut in the shape of a simple, rectangular plate. Low-frequency crystals, such as those used
in digital watches, are typically cut in the shape of a tuning fork. For applications not
needing very precise timing, a low-cost ceramic resonator is often used in place of a
quartz crystal.
When a crystal of quartz is properly cut and mounted, it can be made to distort in an
electric field by applying a voltage to an electrode near or on the crystal. This property is
21
known as piezoelectricity. When the field is removed, the quartz will generate an electric
field as it returns to its previous shape, and this can generate a voltage. The result is that a
quartz crystal behaves like a circuit composed of an inductor, capacitor and resistor, with
a precise resonant frequency.
Quartz has the further advantage that its elastic constants and its size change in such a
way that the frequency dependence on temperature can be very low. The specific
characteristics will depend on the mode of vibration and the angle at which the quartz is
cut (relative to its crystallographic axes). Therefore, the resonant frequency of the plate,
which depends on its size, will not change much, either. This means that a quartz clock,
filter or oscillator will remain accurate. For critical applications the quartz oscillator is
mounted in a temperature-controlled container, called a crystal oven, and can also be
mounted on shock absorbers to prevent perturbation by external mechanical vibrations.
3.80 Microcontroller:
Microcontrollers are designed for small or dedicated applications. Thus, in contrast to the
microprocessors used in personal computers and other high-performance or general
purpose applications, simplicity is emphasized. Some microcontrollers may operate at
clock frequencies as low as 32kHz, as this is adequate for many typical applications,
enabling low power consumption (milliwatts or microwatts). They will generally have the
ability to retain functionality while waiting for an event such as a button press or other
interrupt; power consumption while sleeping (CPU clock and most peripherals off) may
be just nanowatts, making many of them well suited for long lasting battery applications.
Other microcontrollers may serve performance-critical roles, where they may need to act
more like a Digital signal processor (DSP), using higher clock speeds and not needing
such very low powered operation.
The majority of computer systems in use today are embedded in other machinery, such as
automobiles, telephones, appliances, and peripherals for computer systems. These are
called embedded systems. While some embedded systems are very sophisticated, many
have minimal requirements for memory and program length, with no operating system,
and low software complexity. Typical input and output devices include switches, relays,
solenoids, LEDs, small or custom LCD displays, radio frequency devices, and sensors for
data such as temperature, humidity, light level etc. Embedded systems usually have no
keyboard, screen, disks, printers, or other recognizable I/O devices of a personal
computer, and may lack human interaction devices of any kind.
(i)Interrupts:
Microcontrollers must provide real time (predictable, though not necessarily fast)
response to events in the embedded system they are controlling. When certain events
occur, an interrupt system can signal the processor to suspend processing the current
instruction sequence and to begin an interrupt service routine (ISR, or "interrupt
handler"). The ISR will perform any processing required based on the source of the
interrupt before returning to the original instruction sequence. Possible interrupt sources
are device dependent, and often include events such as an internal timer overflow,
completing an analog to digital conversion, a logic level change on an input such as from
a button being pressed, and data received on a communication link. Where power
consumption is important as in battery operated devices, interrupts may also wake a
23
microcontroller from a low power sleep state where the processor is halted until required
to do something by a peripheral event.
(ii) Programs:
Microcontroller programs must fit in the available on-chip program memory, since it
would be costly to provide a system with external, expandable, memory. Compilers and
assembly language are used to turn high-level language programs into a compact machine
code for storage in the microcontroller's memory. Depending on the device, the program
memory may be permanent, read-only memory that can only be programmed at the
factory, or program memory may be field-alterable flash or erasable read-only memory.
Since embedded processors are usually used to control devices, they sometimes need to
accept input from the device they are controlling. This is the purpose of the analog to
digital converter. Since processors are built to interpret and process digital data, i.e. 1s
and 0s, they won't be able to do anything with the analog signals that may be being sent
to it by a device. So the analog to digital converter is used to convert the incoming data
into a form that the processor can recognize. There is also a digital to analog converter
that allows the processor to send data to the device it is controlling.
Time Processing Unit or TPU for short is a sophisticated timer. In addition to counting
down, the TPU can detect input events, generate output events, and perform other useful
operations.
As of 2008 there are several dozen microcontroller architectures and vendors including:
24
· 68HC11
· 8051
· ARM processors (from many vendors) using ARM7 or Cortex-M3 cores are
generally microcontrollers
· Atmel AVR (8-bit), AVR32 (32-bit), and AT91SAM
· Freescale ColdFire (32-bit) and S08 (8-bit)
· Hitachi H8, Hitachi SuperH
· MIPS (32-bit PIC32)
· NEC V850
· PIC (8-bit PIC16, PIC18, 16-bit dsPIC33 / PIC24)
· PowerPC ISE
· PSoC (Programmable System-on-Chip)
· Rabbit 2000
· Texas Instruments MSP430 (16-bit), C2000 (32-bit), and Stellaris (32-bit)
· Toshiba TLCS-870
· Zilog eZ8, eZ80
and many others, some of which are used in very narrow range of applications or are
more like applications processors than microcontrollers. The microcontroller market is
extremely fragmented, with numerous vendors, technologies, and markets. Note that
many vendors sell (or have sold) multiple architectures. In mid-2009, some consolidation
is evident, with vendors pruning product lines.
PIC16F84 perfectly fits many uses, from automotive industries and controlling home
appliances to industrial instruments, remote sensors, electrical door locks and safety
devices. It is also ideal for smart cards as well as for battery supplied devices because of
its low consumption.
In System Programmability of this chip (along with using only two pins in data transfer)
makes possible the flexibility of a product, after assembling and testing have been
completed. This capability can be used to create assembly-line production, to store
calibration data available only after final testing, or it can be used to improve programs
on finished products.
PIC16F84 has a total of 18 pins. It is most frequently found in a DIP18 type of case but
can also be found in SMD case which is smaller from a DIP. DIP is an abbreviation for
Dual In Package. SMD is an abbreviation for Surface Mount Devices suggesting that
holes for pins to go through when mounting aren't necessary in soldering this type of a
component.
Line Print Terminal (LPT) is the usual designation for a parallel port connection. In the
computer world, a port is a set of signal lines that the microprocessor, or CPU, uses to
exchange data with other components. Typical usages of ports are communicating with
printers, modems, keyboards, displays and just about any component or device except
system memory. Most computer ports are digital, where each signal, or bit, is 0 or 1. The
LPT port transfers multiple bits at once, while a serial port transfers a bit at a time.The
original LPT port design had eight outputs, five inputs, and four bidirectional lines. These
are enough for communicating with many types of peripherals. In later versions, the eight
outputs were able to serve also as inputs, for faster communications with scanners, drives,
and other devices that send data to the PC. The LPT port was designed as a printer port,
and many of the original names for the port's signals reflect that use.
27
components, including other parallel ports. The following sections explain the resources
in a bit more detail.
3.10.2 Addressing:
The standard parallel port uses three adjacent memory address locations, usually in one of
these ranges:
· 3BCh, 3BDh, 3BEh
· 378h, 379h, 37Ah
· 278h, 279h, 27Ah
The first address in the range is the port's base address, also called the Data register or
just the port address. The second address is the port's Status register, and the third is the
Control register. EPPs and ECPs reserve additional addresses for each port.
On early PCs, the parallel port had a base address of 3BCh. On newer systems, the
parallel port’s memory address location is at 378h. If the port's hardware allows, it is
possible to configure a port at any of the addresses.
IBM's Type 3 PS/2 port also had three additional registers. Most often, DOS and
Windows refer to the first port in numerical order as LPTI, the second, LPT2, and the
third, LPT3. LPT1 is most often at 378h, but it may be at any of the three addresses.
LPT2, if it exists, may be at 378h or 278h, and LPT3 can only be at 278h. Various
configuration techniques can change these assignments- however, not all systems will
follow this convention.
3.11.1 Connectors:
The PC's back panel has the connector for plugging in a cable to a printer or other device
with a LPT-port interface. Most parallel ports use the 25-contact D-sub connector shown
in Fig.(a). The shell (enclosure that surrounds the contacts) is roughly in the shape of an
upper-case D. Other names for this connector are the subminiature D, DB-25, D-shell, or
just D connector. The IEEE 1284 standard for the parallel port calls it the IEEE 1284-A
connector.
30
Some other LPT ports uses the compact, 36-pin IEEE 1284-C (also called Centronics)
connector as shown in Fig.(b). The connector on the computer is female, where the
individual contacts are sockets. The cable has a mating male connector, whose contacts
are pins, or plugs. The LPT-port connector is usually the only female 25-pin D-sub on the
back panel.
Some serial ports use a 25-contact D-sub, but with few exceptions, a 25-pin serial D-sub
on a PC is male, with the female connector on the cable-the reverse of the LPT-port
convention. (Other serial ports use 9-pin D-subs instead.)
SCSI is another interface whose connector might occasionally be confused with the LPT
port. The SCSI interface used by disk drives, scanners, and other devices usually has a
50-contact connector, but some SCSI devices use a 25-contact D-sub that is identical to
the LPT-port's connector.
Table 2 shows the information arranged by register rather than by pin number, and
including register bits that does not appear at the connector
Table2: Parallel Port Signals, arranged by Port Registers:
Data Register (Base Address)
Bit Pin: D-sub Pin: Centronics Source Inverted at Connector
0 2 2 PC N
1 3 3 PC N
2 4 4 PC N
3 5 5 PC N
4 6 6 PC N
5 7 7 PC N
6 8 8 PC N
7 9 9 PC N
Sone Data Ports are bidirectional. (See Control register, bit 5)
Status Register(Base Address +1)
Bit Pin: D-sub Pin: Centronics Source Inverted at Connector
3 15 32 Peripheral N
4 13 13 Peripheral N
5 12 12 Peripheral N
6 10 10 Peripheral N
7 11 11 Peripheral Y
Additional bits not available at the connector:
0: may indicate timeout (1=timeout).
1, 2: unused.
0 1 1 PCI Y
1 14 14 PC1 Y
2 16 31 PC N
3 17 36 PC’ Y
'When high, PC can read external input (SPP only).
Additional bits not available at the connector:
4: Interrupt enable. 1 = IRQs pass from nAck to system's interrupt controller.
0 = IRQs do not pass to interrupt controller.
5: Direction control for bidirectional Data ports. 0 = outputs enabled.
1 = outputs disabled; Data port can read external logic voltages.
6,7: unused
33
· CO: nStrobe - The rising edge of this low-going pulse signals the printer to
read DO-D7. Inverted at the connector. After reboot it remains normally high
at the connector.
C1: AutoLF or Automatic line feed - A low tells the printer to automatically
generate a line feed after each Carriage Return. Inverted at the connector. After
reboot it remains normally high at the connector.
C2: nInit or nInitialize - Pulses low to reset the printer and clear its buffer.
Minimum pulse width: 50 microseconds. After reboot it remains normally high at
the connector.
C3: nSelectIn - High to tell the printer to enable its Data inputs. Inverted at the
connector. After reboot it remains normally low at the connector.
C4: Enable interrupt requests - High to allow interrupt requests to pass from nAck
(S6) to the computer's interrupt-control circuits. If C4 is high and the port's IRQ
level is enabled at the interrupt controller, transitions at nAck will cause a hardware
interrupt request. Does not appear at the connector.
· C5: Direction control - In bidirectional ports, it sets the direction of the Data
port. Sets to 0 for output (Data outputs enabled), 1 for input (Data outputs
disabled).
· C6: Unused.
· C7: Unused - except for a few ports where this bit performs the direction
control function which is normally done by C5.
9x/Me, WDM for Windows 98/NT/2000/Me/Xp, and kernel-mode driver for Windows
NT/2000/Xp. Hardware interrupts must use a system-level driver under Windows
9x/NT/2000/Me/Xp.
A third way to access ports is to use the drivers included with Windows. Windows
3.x/9x/NT have no functions for generic port access, only functions tied to specific uses.
For example, there are API calls for accessing printers and for accessing serial ports
controlled by UARTs. Although, built-in functions and controls like these can be used to
accomplish the functionality of LPT ports in an application, programming languages like
Visual C# does not support this technique.
Almost all programming languages allow programmers to access parallel port using some
library functions. For example, Borland C is providing "Inportb" and "Outportb"
functions to read or write IO mapped peripherals. But the software designed in this
project is written in Visual C# and it does not have any functions or support to access
LPT port directly, but it is possible to add such capabilities by assigning a DLL file called
“inpout32.dll” which lets Windows to enable LPT port access for that specific
application.
entirely stop sourcing current (or limit the current in some way) if the output current is
too high, and some regulators may also shut down if the input voltage is outside a given.
The most common part numbers start with the numbers 78 or 79 and finish with two
digits indicating the output voltage. The number 78 represents positive voltage and 79
negative one. The 78XX series of voltage regulators are designed for positive input. And
the 79XX series is designed for negative input.
Chapter 4
4.1 Introduction:
This chapter gives an overview of assembling all the components of this project together
into the entire completed system. It emphasizes on both the hardware and software
sections with elaborate description along with supporting figures and schematics. It
includes the process, necessary tools and supporting software used to design the
schematic and produce the output in bradboard.
Mobile Signal
Decoder
signal decoder circuit. It can be connected with to the main supply of the electrical
appliances so that a mobile unit can individually turned on or off them. The details of
each unit is described below.
The light emotter in Opto1 activates the switching device (mostly a transistor) inside the
optocoupler which, through its emitter (pin 4), triggers the Base of the Q1 (2N2222A
transistor) through the resistor R3.
The Vcc is an external DC supply of +6v which is powered by an adapter. This external
supply powers the optocoupler (through pin 5) and it is also connected to the relay switch
Relay1. The relay switch needs to be powered externally since the rating of relay is 6v
but the computer LPT port has the capability to supply only +5v.
A diode D1 is connected across the Relay1 to protect the transistor Q1 from any voltage
spikes that may damage the circuit. Relay1 is only activated when the collector of Q1
(which has been triggered) connects the terminal of the Relay1 to the ground through its
emitter.
The Relay1 is connected with the AC mains supply AC1 and the Electrical Appliance.
Thus, when Relay1 is triggered the Electrical Appliance starts to operate and when
Relay1 is off, it becomes disconnected from the AC mains supply. This is the entire
process for controlling one electrical appliance.
39
1k
Figure 4.3: Block diagram showing the total system of 8-Relays with LPT Interface
40
Figure 4.4: Diagram representing a single Block of circuit schematic for single
Relay control
The circuit diagram of the mobile Unit is shown in the figure. The circuit consists of a
decoder MT8870 which gets input from the mobile phone head phone. Whenever a user
press a key the tone pair DTMF generated by pressing the mobile button it is converted
into the binary values internally in the IC. The binary values are sent to the
microcontroller port A. These ports are a1 ,a2, a3 and a4. Now the program is so
designed that when the keypad tone is pressed the odd number i.e 1,3,5,7 will give high
input to the port b0, b1,b2 and b3 respectively. Therefore the LEDs connected to them
will glow which means they can activate the relay device. Similarly when the even
number such as 2,4, 6 and 8 are pressed than the LEDs will be turned off and thus the
Device connected to them will also turned off. The ‘’ * ” button will activate all devices
And ‘#’ button will off all the devices. Here 7805 is voltage regulator IC which supply
Five volt and 1A current to both IC. The microcontroller program is given later in this
41
Chapter.
Cell Phone
headphone
1N4001
7805
10
+Vdd PIC16F4a
MT8870 4 CLK Relay
+In 14 1(A0)
B0 Device 1
-In 15 2(A1) B1 Device2
B3 2N2222
1 kΩ
16 17(A2)
B4
7 17 18(A3)
8 3 4MHz
5(Vss) Oscillator
1kΩ
source codes. Details on the approach of code writing have been discussed later in this
chapter.
Chapter 5
5.1 Introduction:
This is the concluding chapter of this report and it contains discussions on different
aspects of the project including the problems that were faced during the desing and
construction of both the hardware and software sections. It also emphasizes on further
improvements and possible limitations of this design. It suggests additional functions that
can be added to the current system. It discusses on the budget considerations that might
make this project a lot better with a bigger budget. It highlights the restrains during the
implementation of the system and the ideas that could not have been included at the time
due to different circumstances.
5.2 Discussion:
The project has capabilities that were not fully exploited due to financial and time
limitations. This device is a very basic design of an automated control system which is
very flexible in design. The design can be modified according to the need of the user (like
adding more relays and increasing the number of LPT ports by using extra LPT PCI
cards).
There were some problems in the code as well. In the debug process, a lot of time was
given in checking each and every port address calculation. The calculations were very
important because if an address was interpreted incorrectly, the port hardware could have
been damaged. However, no computer hardware was damaged during the code writing
process as each module was carefully programmed.
The major drawback in the software was that it used up a lot of processor power during
the time comparison logic debugging. Several attempts were made to resolve the problem
but unfortunately no other algorithm was correct enough to replace the existing
algorithm.
The device can connect up to a maximum of eight appliances at a time. The software to
support the device does not contain any option to increase the number of LPT ports even
if the external hardware was added to connect more appliances. A complete modification
in the source code has to be done in order to enable this function which was not possible
due to time constraint. Therefore, this option was not included in the design process. This
45
project is just a small demonstration of how a computer can be used to control real world
applications and that was the primary target which was accomplished.
Another factor is that the signals were generated by the software and the corresponding
function was indicated by the hardware. If something was found incorrect, it was due to
some loose connection or power supply problem. The functionality of each and every
component to develop the circuit was separately tested.
The mobile unit on/off system was quite complicated circuit work . The programming of
microcontroller is also a quite tough job. It did took several times of progrramming. Lots
of modification was needed in programming to fulfill the required output criterion.
Here we also face the unavailability problems of the circuit components. Specially
MT8870 decoder is quite rare in local electronics shop.
The project needed a mobile set and the headphone where the headphone is modified for
the project. It add an extra cost to the budget.
and Data Registers are not seperately accessible. Therefore, a specific driver is needed to
be developed in order to interact with the device and the entire software application has
to be rewritten due to a change in the interfacing algorithm. Enabling USB method can
increase the overall potential of the device.
The most astounding development would be to build the device independent of software
control. The design will be completely stand-alone, based on microprocessors and
integrated GPRS modem to upload its data on a server. It may include its own remote-
controller with TFT touchscreen functionality to operate the device wirelessly. The GPRS
functionality will help monitor and operate the system remotely from anywhere in the
world. This approach would be very expensive but an attractivly advanced home
automation system.
These were some of the suggestions for improvements that might help other interested
individuals or groups to continue the research on automation technology and provide
further aid to the development of more complex and advanced automation systems.
5.4 Conclusion:
This device can increase the chance for manufacturing afforable automation systems of
different grades that will provide a scale from low to high performance and capability of
such systems. The device is only a prototype and it needs a lot of improvements to
establish itself in the vast competing world of technologically enhanced commercial
products. There are lots of opportunities to help the world be a better place to live and the
automation technology bears a great significance to this cause. The ease it can provide to
an individual’s living style will keep incrementing in the future. For years to come, this
technology will get shaped into something which seems impossible today and the
experience in this field of research has greatly enhanced the perspective of the individuals
who worked behind this project. Technology needs the world, to evolve and the world
needs technology, to survive.
Appendix
Port Access:
using System;
using System.Runtime.InteropServices;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace TestApplication
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
namespace TestApplication
{
public partial class Form1 : Form
{
public int i = 0, j = 0, adress = 888,value = 0;
public System.Drawing.Color c1 = Color.Lime, c2 = Color.Transparent;
public Form1()
{
InitializeComponent();
48
Reset_Device();
private void Reset_Device() // Makes all the data pins low so the LED's turned off
{
PortAccess.Output(adress, 0);
}
}
PortAccess.Output(adress, value);
}
}
else
{
value -= (int)Math.Pow(2, 5);
checkBox6.BackColor = c2;
}
PortAccess.Output(adress, value);
}
if (checkBox7.Checked)
{
value += (int)Math.Pow(2, 6);
checkBox7.BackColor = c1;
}
else
{
value -= (int)Math.Pow(2, 6);
checkBox7.BackColor = c2;
}
PortAccess.Output(adress, value);
}
}
else
{
value -= (int)Math.Pow(2, 7);
checkBox8.BackColor = c2;
}
PortAccess.Output(adress, value);
}
Reset_Device();
Form1 mainmenu = new Form1();
mainmenu.Close();
Form2 set_timer = new Form2();
set_timer.ShowDialog();
}
parallel
If a = 11 Then PORTB = 15
If a = 12 Then PORTB = 0
Goto main
53
References
1. Mason, C. R., Art & Science of Protective Relaying, Chapter 2, GE Consumer &
Electrical.
2. Gurevich, Vladimir (2005). Electrical Relays: Principles and Applications. London -
New York: CRC Press.
3. Walter A. Elmore. Protective Relaying Theory and Applications. Marcel Dekker,
Inc.. ISBN 0-8247-9152-5.
4. Peter Ashburn (2003). Bipolar Transistors. New York: Wiley, Chapter 10.
5. Herb’s Bipolar Transistors IEEE TRANSACTIONS ON ELECTRON DEVICES,
VOL. 48, NO. 11, NOVEMBER 2001
6. Influence of Mobility and Lifetime Variations on Drift-Field Effects in Silicon-
Junction Devices PDF
7. A.S. Sedra and K.C. Smith (2004). Microelectronic Circuits, Fifth Edition, New
York: Oxford, Eqs. 4.103-4.110, p. 305, 509
8. R S Muller, Kamins TI & Chan M (2003). Device electronics for integrated circuits,
Third Edition, New York: Wiley, pp. 280 ff.
9. Pratt, Terrence W. and Marvin V. Zelkowitz. Programming Languages: Design and
Implementation, 3rd ed. Englewood Cliffs, N.J.: Prentice Hall, 1996.
10. Sebesta, Robert W. Concepts of Programming Languages, 3rd ed. Reading, Mass.:
Addison-Wesley Publishing Company, 1996.
11. Schach, Stephen (2006). Object-Oriented and Classical Software Engineering,
Seventh Edition. McGraw-Hill.
12. http://www.kpsec.freeuk.com/components/relay.htm
13. http://www.gmonline.demon.co.uk/cscene/CS4/CS4-02.html
14. http://www.beyondlogic.org/spp/parallel.htm
15. http://www.nordicdx.com/dxlab/makepcb2.html/
16. http://www.expresspcb.com/ pcb_layout~2.htm
17. http://www.electricstuff.co.uk/crystal-oscillator~`php/index.htm
18. http://www.turnpike.net/~kepro/
54