Subscribe Now Subscribe Today
Research Article

Hybrid Programmable Logic Controller for Load Automation

Aamir Shahzad, Hashim Farooq, Sofia Akba, Mushtaq Yousaf, Kamran Hafeez and M. Hanif
Facebook Twitter Digg Reddit Linkedin StumbleUpon E-mail

The purpose of this study is to design a Programmable Logic Controller (PLC) to command 8-relays to control and automate ac loads via PC parallel port. In this project, the PLC is connected to the Personal Computer called hybrid PLC and this PC controls all the field ac loads via parallel printer port. Eight signals of different sequences are sent on parallel port via computer keyboard, which activate the microcontroller as inputs. Microcontroller responds according to these inputs and its user programming, which then commands 8-relays to control (on/off) different electronic appliances. Microcontroller memory makes easier to store its programming permanently. This hybrid PLC is applicable for controlling and monitoring industrial processes particularly of small to medium scale manufacturing processes and may be used for home automation as well. Parallel port is accessed by a program written in C++ language and microcontroller is programmed in assembly language. Ac load of any kind, whether resistive or inductive can be controlled with the help of this project.

Related Articles in ASCI
Similar Articles in this Journal
Search in Google Scholar
View Citation
Report Citation

  How to cite this article:

Aamir Shahzad, Hashim Farooq, Sofia Akba, Mushtaq Yousaf, Kamran Hafeez and M. Hanif, 2007. Hybrid Programmable Logic Controller for Load Automation. Journal of Applied Sciences, 7: 2904-2907.

DOI: 10.3923/jas.2007.2904.2907



A PLC is a user-friendly, microprocessor-based, specialized computer that can control multi-functions of different complexity levels. It can operate any system with output devices that turn on and off, as well systems with variable outputs. Due to its easy operation and powerful functions, PLC has become widely used in industry. The advantages of PLC, makes it the brain of modern industrial control systems (Chien et al., 1999) Chien stated that if a logical relationship between inputs and outputs can be achieved then many potential faults and combinations of faults can be avoided and PLC provides this logic relationship between inputs and outputs.

PLCs are the control hubs for a wide variety of automated systems, processes and these are special purpose computers designed for sequence control devices that are developed to replace electromechanical relay hard-wired controllers (Brinksma et al., 2002; Kevin and Wenlong, 1997; Antonio, 2006; Seungkweon et al., 2003; Atef et al., 2005; Can and Kahramen, 2004). PLCs were first conceived in 1968 but these were introduced into manufacturing in 1969 and the advent of PLCs began in 1970s and have become the most common choice for manufacturing controls and are now the most widely employed industrial process control technology used today (John, 1999; Antonio, 2006). Microcontroller individually and PLC collectively, both are being tried to use for controlling and monitoring purposes on the factory floor (Bliesener et al., 2002). PLCs provide a cost-effective solution to real time control in small to medium sized process plants especially when combined with supervisory PC using hybrid systems (Kevin and Wenlong, 1997). In some large industrial manufacturing processes, PLC raised some issues in their use therefore PLC in a PC-based control environment is introduced called hybrid PLC (Polschuk and Brezina, 2001).

The main objective of this study was to control the different ac loads with PC. Parallel interfacing was made between the designed PLC and the PC via printer port. A designed PLC connected to PC or to another PLC is called hybrid PLC. Microcontroller which is the brain of the PLC was used to connect the PC parallel port circuitry to the electromagnetic relays circuitry to which ac loads were attached. Microcontroller sends signals to the output according to its incoming parallel port signals and its own programming which is made in assembly language while the parallel port was accessed in C++ language using outport (0x378, data) instruction. Parallel port can also be programmed and accessed in assembly language. Serial port transfers data bit-wise while parallel port transfers data byte-wise (8-bits) simultaneously. In general, the parallel printer port has five modes of operation for communication. In the present study compatibility mode is used to interface the PLC. Because printer parallel port consists of eight pins therefore its any concerned pin can be partially activated by changing the amount of data but the address 0x378 is same for its all pins. Switch statement is used in C++ program and in its each case the pin is turned on first and after some delay it is turned off again for the proper switching of relays. These ac loads were signaled from the control keys of keyboard, if one keyboard digital key is pressed then its corresponding load is switched on while if the same digital key is pressed again then this load is switched off. An ac load can be remains turned on for number of hours and days with its accurate functioning.

This research seeks to highlight a method and tact to control number of ac electronic appliances with the help of single PC. Any industrial ac load whether resistive or inductive can be controlled (on/off) with this project, so there is large number of applications of this project for industrial and home automation. Any device, which is powered with alternating current, is termed as ac load. Every electrical load may be categorized into two types, inductive and resistive. Type of load decides the type of circuit used to power or control. An inductive load has wire coils and windings in it; examples are motors, transformers, relays and solenoids. A resistive load doesn’t have any inductive coils or wire windings, examples are incandescent lights, toasters, coffee makers and heaters (John, 2000).


The basic idea was to design a hybrid PLC with performance comparable to dedicated industrial hybrid PLC’ designed by big companies. Designed hybrid PLC consists of five modules namely input and PLC module, PLC and output module, Relay module, Switch Module and Power supply module. Input and PLC module consists of LPT parallel port inputs from the PC to the microcontroller through opto-couplers used for signals isolation, PLC and output module consists of microcontroller outputs to the relays via serial combination of resistors and CE-transistors, relay module consists of relays which are activated with the help of dc signals taken from the collector of CE-transistors to control alternating current, the switch module consists of switches to connect different ac loads and appliances with this hybrid PLC and the power supply module gives the two different dc voltage output levels of 5V and 12V. Infect microcontroller is the heart of this hybrid PLC which is connected in between to the PC and the relays while relays are made as intermediary components between as loads and the PLC (Can and Kahramen, 2004). Parallel port can be programmed to read data in and to write data out. There are three possible locations in which the parallel printer port registers can reside namely, 0x378 (most common), 0x278 and 0x3BC. Data port register of parallel port contains 8 bits. Every bit corresponds to a pin on the parallel printer port connector (Kavanagh, 2000). In this project, the parallel port is accessed in C++ language using address 0x378 and by using C++ statement outport(address, data) i.e., outport (0x378, data), where data might be (1, 2, 4, 8, 16, 32, 64, 128) for eight relays, respectively. The time delay for parallel port in C++ language and for the microcontroller in assembly language is set equal for correct switching of the relays. Communication among the PLC, PC and the ac loads are vital and needed to be cautiously designed to fulfill the requirements of desired operation (Can and Kahramen, 2004). The PLC and ac loads are interfaced via eight relay contacts. Each relay was powered by a 12 VDC from external power supply. The signals are sent from the PC keyboard to trigger the PLC and its outputs are connected to each relay to switch the ac loads (Can and Kahramen, 2004).

A PLC for load automation controlling through PC is developed keeping in mind the complexity of this system, cost effectiveness as well as latest trend of PC based instrumentation and embedded technology. All the components and software of the system were developed as independent subsystem and tested individually. Here, a midrange microcontroller from ATMEL, which is less expensive but with comparable performances is used. It has the same number of I/O lines, working at the same clock frequencies and its flash memory can be programmed number of times. The power supply module is built in a classic way, 5 and 12V regulators were used to assign the right voltages to the devices and a 100 nF capacitor was used to cut the appeared spikes.

The PLC presented is built around an ATMEL 89C51 microcontroller. It is low power, high performance 8-bit microcomputer with 4 KByte of flash memory. It has total 40 pins and has 4 external I/O ports (P0, P1, P2, P3) with 8 pins of each port, in this way total 32 single-bit I/O pins are available which are used in interaction with exterior world. These pins can be addressed individually or in groups of eight. This microcontroller can be programmed through a hardware programmer connected to the PC’ serial port; this programmer makes digital level conversions from serial port levels to levels that microcontroller needs. Assembler provided by the manufacturer is used to generate a. hex file which is loaded in microcontroller’ flash memory.


This hybrid PLC can command up to 8 relays. The maximum frequency that can be reached on microcontroller’ pin is given by the following relation (Antonio, 2006).

FOUT = FOSC/4 = 11.0592/4 = 2.765 MHZ

FOUT = Pin frequency
FOSC = Timing oscillator frequency

In this study, 11.0592 MHZ quartz is used, so the pin frequency is 2.765 MHZ according to the above given formula. Pin frequency calculated by Antonio (2006) was higher than above calculated frequency because the frequency of oscillator used in his project was higher than this. Similarly, time taken to execute instruction (scan time) is given below;

Time taken to execute instruction = T = 12xC/crystal frequency

T = 12x419/11.0592 = 454.6 M sec

In above equation, C is the number of machine cycles while Crystal frequency is the frequency of the crystal used with microcontroller. Here, total machines cycles are 419 while crystal frequency is 11.0592 MHZ. Thus, processing time of the microcontroller for change in input (scan time) is 454.6 M sec as calculated above.

The performance of hybrid PLC is studied by switching different ac loads. A high signal is sent from the PC parallel port to the microcontroller which gave output according to these inputs which turns on a transistor that energizes a relay to control ac loads. Eight set of relays control 220 Volt of alternating current, each relay operates independently. More than one relay can be turned on at the same time i.e., all relays can be switched on simultaneously. When a particular output is activated then its associated LED is turned on indicating the correct functioning of the project. If a signal is sent to the relay then its associated ac load is switched on and if signal is sent again to the same relay then its associated ac load is switched off. Relay used in this project is of 5 Ampere ac of 220 v, 50 Hz, so any ac load of current less than this mentioned ampere can be controlled with the help of this project. Parallel port gives 5 V DC signal to the microcontroller. The driver software of parallel port is written in C++ language using switch statement and is run in windows 98 while the assembly software of microcontroller resides in 2KB of EEPROM microcontroller memory. Note that C++ program for parallel port does not work proper in the systems having Windows XP, Windows NT or higher versions. Microcontroller outputs are open-drain and do not support a greater current than 20 mA. For this reason transistors have been used. The transistors are working in switching mode; the current through the LEDs is limited by resistors.

We have designed, implemented and tested the functionality of a complete hybrid PLC built around ATMEL 89C51 microcontroller. The maximum values for currents and voltages, as indicated by the manufacturer were reached, with little differences on internal open-drain output current drivers. This hybrid PLC provides a cost-effective solution in small to medium sized industrial manufacturing and processing plants. It was also used to control the home ac load automation too like fans, electric bulbs, tube lights, water pumps etc. In industry, this project was used for controlling high machines like spinning machines, dying machines, printing machines and boiler etc. So, with the help of this project, a home and an industry can be automated and controlled using a single PC. This designed hybrid PLC is smaller in size, simple and its programming can be changed without system intervention.

There are some suggestions and improvements in this project which can be carried out. In this project the relay of 5 Ampere is used but if heavy industrial machinery is to be controlled and automated then relays of higher Ampere can be used. Similarly, number of relays can be increased by changing the programming of the microcontroller. AT89C51 microcontroller has 32 I/O pins. In this project, out of these 32 pins, only 8 pins are used for input while 8 pins are used for output, in this way 16 pins are used while remaining 16 are left useless. So, these remaining 16 pins can also be used to send the input signal on these pins as well by changing the microcontroller programming. Parallel port can also be accessed and programmed in assembly language. Matrix keypad and LCD both can be used at place of conventional monitor and keyboard.

Antonio, S.T., 2006. Programmable logic controller. Rom. J. Phys., 5: 305-310.

Atef, A.A., R. Ahmad and Y. Hanani, 2005. Sensory-Based colour sorting automated robotic cell. J. Intell. Robotic Syst., 43: 99-110.
Direct Link  |  

Bliesener, R., F. Ebel, C. Loffler, B. Plagemann, H. Regber, E.V. Terzi and A. Winter, 2002. Programmable logic controller basic level festo didactic textbook TP 301.

Brinksma, E., A. Madder and A. Fehnker, 2002. Verification and optimization of a PLC control schedule. Int. J. STTT., 4: 21-23.
Direct Link  |  

Can, S. and F. Kahraman, 2004. A web-based programmable logic controller laboratory for manufacturing engineering education. Int. J. Adv. Manufact. Technol., 24: 590-598.
Direct Link  |  

Chien, P.C., X. Lan and J.C. Chen, 1999. A systematic procedure for designing state combination circuits in PLCs. J. Ind. Technol., 15: 1-5.
Direct Link  |  

John, I., 2000. PIC Microcontroller Project Book. McGrah Hills, USA.

John, R.W., 1999. The debate over which PLC programming language is the stae-of-the-art. J. Ind. Technol., 15: 1-5.
Direct Link  |  

Kavanagh, K., 2000. Use a PC printer port as a control device when evaluating new designs. Elect. Design, 48: 105-112.

Kevin, J.M. and A.Y. Wenlong, 1997. Developing a hybrid programmable logic controller platform for a flexible manufacturing system. Int. J. Flexible Manufact. Syst., 9: 367-374.
Direct Link  |  

Polschuk, T. and D. Brezina, 2001. PC-based controller provides powerful tool for precision-part manufacturer. Control Solutions, 74: 31-35.

Seungkweon, J., K. Chang and W.H. Kwon, 2003. Response time driven scheduling for programmable logic controllers with network-based I/O systems. Real-Time Syst., 25: 67-91.
Direct Link  |  

©  2020 Science Alert. All Rights Reserved