7/31/2019 Pc Based Appliances Controller Ag 111508
1/18
PC BASED APPLIANCES CONTROLLER
Submitted by:
7/31/2019 Pc Based Appliances Controller Ag 111508
2/18
CONTENTS:
S.NO. TOPICS
1. INTRODUCTION
2. DESRIPTION OF PROJECT
3. BRIEF INTRODUCTION TO PARALLEL PORT
4. DESCRIPTION FOR REGISTERS
5. POWER SUPPLY
6. OPTOCOUPLER
7. PROGRAMMING FOR THE REQUIRED CIRCUIT
8. FUTURESCOPE
9. CONCLUSION
10. REFERENCES
7/31/2019 Pc Based Appliances Controller Ag 111508
3/18
INTRODUCTION
This project can be used for the controlling of various appliances using PC.
It consist a circuit for using the printer port of a PC, for control application
using software and some interface hardware. The interface circuit along with
the given software can be used with the printer port of any PC for
controlling up to eight equipment. Parallel port is a simple and inexpensive
tool for building computer controlled devices and projects. The simplicity
and ease of programming makes parallel port popular.
DESRIPTION OF PROJECT
BASIC COMPONENTS REQUIRED
1. Personal Computer
2. Optocoupler
3. ULN 2803
4. Electro-mechanical Relay(SPDT)
5. Transformer(15v)
6. Voltage Regulator 78XX
7. Diode(IN4007), Resistors, capacitors
7/31/2019 Pc Based Appliances Controller Ag 111508
4/18
BASIC CIRCUIT DIAGRAM
7/31/2019 Pc Based Appliances Controller Ag 111508
5/18
BRIEF INTRODUCTION TO PARALLEL PORT
Parallel port modes
The IEEE 1284 Standard which has been published in 1994 defines five modes of data
transfer for parallel port. They are:
1. Compatibility Mode
2. Nibble Mode
3. Byte Mode
4. EPP
5. ECP
The programs, circuits, and other information found in this tutorial are compatible to
almost all types of parallel ports and can be used without any problems (Not tested, just
because of confidence!).
Hardware
The pin outs of DB25 connector is shown in the picture below:
The lines in DB25 connector are divided into three groups, they are:
1. Data lines (data bus)2. Control lines
3. Status lines.
7/31/2019 Pc Based Appliances Controller Ag 111508
6/18
As the name refers, data is transferred over data lines. Control lines are used to control the
peripheral, and of course, the peripheral returns status signals back to the computer through
Status lines. These lines are connected to Data, Control and Status registers internally.
Pin No
(DB25)
Signal
name
DirectionRegister
- bit
Inverted
1 nStrobe Out Control-0 Yes
2 Data0 In/Out Data-0 No
3 Data1 In/Out Data-1 No
4 Data2 In/Out Data-2 No
5 Data3 In/Out Data-3 No
6 Data4 In/Out Data-4 No
7 Data5 In/Out Data-5 No
8 Data6 In/Out Data-6 No
9 Data7 In/Out Data-7 No
10 nAck In Status-6 No
11 Busy In Status-7 Yes
12 Paper-Out In Status-5 No
13 Select In Status-4 No
14 Linefeed Out Control-1 Yes
15 nError In Status-3 No
16 nInitialize Out Control-2 No
17nSelect-
PrinterOut Control-3 Yes
18-25 Ground - - -
Parallel port registers
The Data, Control and Status lines are connected to there corresponding registers inside the
computer. So, by manipulating these registers in program, one can easily read or write to
parallel port with programming languages like 'C' and BASIC.
7/31/2019 Pc Based Appliances Controller Ag 111508
7/18
The registers found in a standard parallel port are:
1. Data register
2. Status register3. Control register
As their names specify, Data register is connected to Data lines, Control register is
connected to Control lines and Status register is connected to Status lines. (Here the word
connection does not mean that there is some physical connection between
data/control/status lines. The registers are virtually connected to the corresponding lines.)
So, whatever you write to these registers will appear in the corresponding lines as voltages.
Of course, you can measure it with a multimeter. And whatever you give to Parallel port as
voltages can be read from these registers (with some restrictions). For example, if we write
'1' to Data register, the line Data0 will be driven to +5v. Just like this, we can
programmatically turn on and off any of the Data lines and Control lines.
Description for registers
In an IBM PC, these registers are IO mapped and will have an unique address. We have to
find these addresses to work with the parallel port. For a typical PC, the base address of
LPT1 is 0x378 and of LPT2 is 0x278. The Data register resides at this base address, Status
register at base address + 1 and the control register is at base address + 2. So, once we have
the base address, we can calculate the address of each register in this manner. The table
below shows the register addresses of LPT1 and LPT2.
Register LPT1 LPT2
7/31/2019 Pc Based Appliances Controller Ag 111508
8/18
Data register (baseaddress + 0) 0x378 0x278
Status register (baseaddress + 1) 0x379 0x279
Control register (baseaddress + 2) 0x37a 0x27a
POWER SUPPLY
REGULATOR IC (78XX)
It is a three pin IC used as a voltage regulator. It converts unregulated DC
current into regulated DC current.
BRIDGE RECTIFIER
A bridge rectifier makes use of four diodes in a bridge arrangement to
achieve full-wave rectification. This is a widely used configuration, both
with individual diodes wired as shown and with single component bridges
where the diode bridge is wired internally.
CIRCUIT DIAGRAM OF POWER SUPPLY
7/31/2019 Pc Based Appliances Controller Ag 111508
9/18
OPTOCOUP LERThere are many situations where signals and data need to be transferred from
one subsystem to another within a piece of electronics equipment, or from
one piece of
equipment to another, without making a direct ohmic contact electrical
connection. Often this is because the source and destination are (or may be
at times) at very different voltage levels, like a microprocessor which is
operating from 5V DC but being used to control a triac which is switching
240V AC. In such situations the link between the two must be an isolatedone, to protect the microprocessor from over-voltage damage.
7/31/2019 Pc Based Appliances Controller Ag 111508
10/18
HIGH VOLTAGE HIGH CURRENT DARLINGTON
TRANSISTOR ARRAY (ULN2803)
The eight NPN Darlington connected transistors in this family of arrays are
ideally suited for interfacing between low logic level digital circuitry (such
as TTL, CMOS or PMOS/NMOS) and the higher current/voltage
requirements of lamps, relays, printer hammers or other similar loads for abroad range of computer, industrial, and consumer applications. All devices
feature opencollector outputs and free wheeling clamp diodes for transient
suppression.
The ULN2803 is designed to be compatible with standard TTL families
while the ULN2804 is optimized for 6 to 15 volt high level CMOS or PMOS
7/31/2019 Pc Based Appliances Controller Ag 111508
11/18
ULN 2803
RELAY
A relay is an electrical switch that opens and closes under the control of another electricalcircuit. In the original form, the switch is operated by an electromagnet to open or close
one or many sets of contacts. It was invented by Joseph Henry in 1835. Because a relay isable to control an output circuit of higher power than the input circuit, it can be consideredto be, in a broad sense, a form of an electrical amplifier.
Here relay is used for the isolation of various heavy appliances to the PC. Since the PC
operates on very low current, but the current in various appliances is in Amperes therefore
isolation is necessary and relay is required. Here we have used single pole dual throughrelay for the purpose.
7/31/2019 Pc Based Appliances Controller Ag 111508
12/18
CIRCUIT DIAGRAM OF PROJECT
7/31/2019 Pc Based Appliances Controller Ag 111508
13/18
PROGRAMMING FOR THE REQUIRED CIRCUIT
/*program to control devices using PC parallel port
The devices are controlled by pressing the keys 1-8
that corresponds to each of the 8 possible devices
*/
#include
#include#include
#define PORT 0x378 /* This is the parallel port address */
main()
{
char val=0,key=0;
char str1[]="ON ";
char str2[]="OFF";char *str;
clrscr();printf("Press the appropriate number key to turn on/off devices:\n\n");
printf("Here Device1 is connected to D0 of parallel port and so on\n\n");
printf("Press \"x\" to quit\n\n");gotoxy(1,8);
printf("Device1:OFF Device2:OFF Device3:OFF Device4:OFF\n");
printf("Device5:OFF Device6:OFF Device7:OFF Device8:OFF");
while(key!='x' && key!='X')
{gotoxy(1,12);printf("Value in hex sent to the port:");
key=getch();
switch(key){
case '1':
gotoxy(9,8);
val=(val&0x01)?(val&(~0x01)):val|0x01;
str=(val&0x01)?str1:str2;
printf("%s",str);outportb(PORT,val);
gotoxy(1,13);
printf("%x",val);break;
case '2':
7/31/2019 Pc Based Appliances Controller Ag 111508
14/18
gotoxy(21,8);
val=(val&0x02)?(val&(~0x02)):val|0x02;
str=(val&0x02)?str1:str2;printf("%s",str);
outportb(PORT,val);
gotoxy(1,13);printf("%x",val);
break;
case '3':
gotoxy(33,8);
val=(val&0x04)?(val&(~0x04)):val|0x04;str=(val&0x04)?str1:str2;
printf("%s",str);
outportb(PORT,val);
gotoxy(1,13);printf("%x",val);
break;
case '4':
gotoxy(45,8);
val=(val&0x08)?(val&(~0x08)):val|0x08;
str=(val&0x08)?str1:str2;
printf("%s",str);outportb(PORT,val);
gotoxy(1,13);
printf("%x",val);break;
case '5':
gotoxy(9,9);
val=(val&0x10)?(val&(~0x10)):val|0x10;
str=(val&0x10)?str1:str2;printf("%s",str);
outportb(PORT,val);
gotoxy(1,13);printf("%x",val);
break;
case '6':
gotoxy(21,9);
val=(val&0x20)?(val&(~0x20)):val|0x20;
7/31/2019 Pc Based Appliances Controller Ag 111508
15/18
str=(val&0x20)?str1:str2;
printf("%s",str);
outportb(PORT,val);gotoxy(1,13);
printf("%x",val);
break;
case '7':
gotoxy(33,9);
val=(val&0x40)?(val&(~0x40)):val|0x40;
str=(val&0x40)?str1:str2;
printf("%s",str);outportb(PORT,val);
gotoxy(1,13);
printf("%x",val);
break;
case '8':gotoxy(45,9);
val=(val&0x80)?(val&(~0x80)):val|0x80;
str=(val&0x80)?str1:str2;printf("%s",str);
outportb(PORT,val);
gotoxy(1,13);
printf("%x",(unsigned char)val);break;
}
}
}
7/31/2019 Pc Based Appliances Controller Ag 111508
16/18
ESTIMATED COST OF PROJECT
The estimate cost of project is rupees 8000
FUTURE SCOPE OF PROJECT
This project can be used in industries as well as in houses to control the
various appliances through PC. Devices can be controlled from the desktop
while working on it.
You can use voice recognition (or DTMF) to control your house by this
method (Smart House).
7/31/2019 Pc Based Appliances Controller Ag 111508
17/18
CONCLUSION
The greatest learning experience in this project comes from the design and
construction of PC Based Appliance Controller which answer a lot of
questions regarding the real implementation of Embedded system, Electro-
mechanical relays and Opto-couper, ULN 2803, Parallel Port of PC .
During the development of our project we studied and analyzed many real
world applications
of Electronics and Software Engineering. Some of the theoretical knowledge
that was inculcated in us within our engineering program, which we have
applied practically, are:
1. Use of voltage regulation and filtering in power supply.
2. Study of parallel ports.
3. Study of C-Language.
4. Study of ULN.
5. Understanding of single pole dual through relay.
6. Study of Optocoupler.
7/31/2019 Pc Based Appliances Controller Ag 111508
18/18
REFERENCES
http://www.sparkfun.com/tutorials/57
http://www.codeproject.com/KB/cs/control_e_appliances.aspx
http://www.electronic-circuits-
diagrams.com/computersimages/computersckt1.shtml
http://www.ehow.com/how_5993533_use-computer-control-household-
appliances.html
http://www.sparkfun.com/tutorials/57http://www.codeproject.com/KB/cs/control_e_appliances.aspxhttp://www.electronic-circuits-diagrams.com/computersimages/computersckt1.shtmlhttp://www.electronic-circuits-diagrams.com/computersimages/computersckt1.shtmlhttp://www.ehow.com/how_5993533_use-computer-control-household-appliances.htmlhttp://www.ehow.com/how_5993533_use-computer-control-household-appliances.htmlhttp://www.sparkfun.com/tutorials/57http://www.codeproject.com/KB/cs/control_e_appliances.aspxhttp://www.electronic-circuits-diagrams.com/computersimages/computersckt1.shtmlhttp://www.electronic-circuits-diagrams.com/computersimages/computersckt1.shtmlhttp://www.ehow.com/how_5993533_use-computer-control-household-appliances.htmlhttp://www.ehow.com/how_5993533_use-computer-control-household-appliances.html